I have a requirement to add a footer to a pptx file. I already have code in place to work with ppt files, this code simply adds a rectangle with text to the master slides.
Presentation pres = new Aspose.Slides.Presentation(fileName);
Slides masterSlides = pres.Masters;
foreach (Slide slide in masterSlides)
Aspose.Slides.Shapes shapes = slide.Shapes;
Rectangle rect = shapes.AddRectangle(100, 4100, 100, 100 );
rect.LineFormat.ShowLines = false; rect.AddTextFrame("MY FOOTER TEXT HERE " );
Aspose.Slides.Paragraph para = rect.TextFrame.Paragraphs;
Portion port = para.Portions;
port.FontHeight = 8;
I have tried to modify the code to use the pptx namespace.
PresentationEx presX = new Aspose.Slides.Pptx.PresentationEx(fileName);
MasterSlidesEx masterSlidesX = presX.Masters;
foreach (MasterSlideEx slideX in masterSlidesX)
Aspose.Slides.Pptx.ShapesEx shapesX = slideX.Shapes;
int shapeIndex = shapesX.AddAutoShape(ShapeTypeEx.Rectangle, 100, 4100, 100, 100);
AutoShapeEx rectX = slideX.Shapes[shapeIndex] as AutoShapeEx;
rectX.AddTextFrame("MY FOOTER TEXT");
rectX.TextFrame.Paragraphs.Portions.RawFontHeight = 8;
I can debug through the code and see that each lines executes without any exceptions although it doesn't work. The rectangle that should be added is not visible.
Can you please advise were I'm going wrong?