Discrepancy between Shapes in PPT and PPTX

Hi

I observed that rectangle shape is not the same in PPTX as in PPT. Even in forum link http://www.aspose.com/documentation/.net-components/aspose.slides-for-.net/adding-rectangle-shape-to-slide-1.html it is given as Rectangle shape appearing in blue color fill by default in PPTX. But this is not the case in PPT.

Also I tried with sample code on adding rectangle with red color in PPT and PPTX. I could see that the rectangle is positioned in different positions in PPT and PPTX eventhough the parameters that I used to create Reactangle is same in both the cases.

Please clarify.

Code is given below and the output is in the attachements.

Rectangle with PPT:

Presentation pres = new Presentation();

Slide sld = pres.Slides[0];

sld.Shapes.AddRectangle(10, 20, 50, 100);

foreach (Shape shape in sld.Shapes)

{

shape.FillFormat.Type = FillType.Solid;

shape.FillFormat.ForeColor = System.Drawing.Color.Red;

}

pres.Write("C:\\PPT Output.ppt");

Rectangle with PPTX:

PresentationEx pres = new PresentationEx();

SlideEx sld = pres.Slides[0];

//System.Drawing.Image img = (System.Drawing.Image)new System.Drawing.Bitmap("C:\\Documents and Settings\\327308\\My Documents\\My Pictures\\images.jpg");

//ImageEx imgx = pres.Images.AddImage(img);

//sld.Shapes.AddPictureFrame(ShapeTypeEx.Rectangle, 30, 20, imgx.Width, imgx.Height, imgx);

//sld.Shapes.InsertPictureFrame(pres.Images.Count, ShapeTypeEx.Ellipse, 100, 150, imgx.Width, imgx.Height, imgx);

//sld.Shapes.InsertAutoShape(0, ShapeTypeEx.Rectangle, 10, 20, 50, 100);

int index = sld.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 10, 20, 50, 100);

foreach (ShapeEx shape in sld.Shapes)

{

shape.FillFormat.FillType = FillTypeEx.Solid;

shape.FillFormat.SolidFillColor.Color = System.Drawing.Color.Red;

}

pres.Write("C:\\PPTX Output.pptx");

Hi Htanmo,


I have observed the issue shared by you. If you observe the slide size using Presentation and PresentationEx class, you will observe that Presentation class has slide size 5760 x 4320 and PresentationEx class has slide size of 720 X 540. The PowerPoint on back end accepts the slide size by factor of 8, i.e. 7208=5760 and 5408=4320. Hope it clears. When you will set the shape size and position in Presentation class that will be set relative to 5760 x 4320. However, the shape position and size in PresentationEx is set in accordance to 720 X 540. Hope you understand the concept here.

Many Thanks,

Thanks for your response.

I got the difference. I could see that with the factor of 8 I get the expected one in PPTX as in PPT.

One small difference I found that the rectangle border alone is visible with more thickness when compared to PPT.

Can u please tell me how to modify the line to NoLine in Rectangle shape.

I tried

ShapeEx shapeEx = slide.Shapes[index]; after adding shape to picture frame.

then tell me which property to be used to hide the line of shape. I tried

shapeEx.LineFormat.Style = LineStyleEx.some property.

NO LINE property is not achieved.

Hi Htanmo,


Please use the following property to remove the shape border.


shapeEx.LineFormat.FillFormat.FillType = FillTypeEx.NoFill;

Many Thanks,

Thanks for the update. It works fine.