Free Support Forum - aspose.com

Powerpoint shapes

Hi Guys

I get an error when I try to work with the slide (orig_Slide7). When I get it back from Aspose.Slides I can see the purple background but it is sized in correctly (error_Slide7)

Here is the code I am using :

Aspose.Slides.Presentation parent = null;
parent = new Aspose.Slides.Presentation(stream);

for (int i = 0; i < parent.Slides.LastSlidePosition; i++)
{

string targetFileName = path + i.ToString();

//Issue with index v slide position, try to access by position instead
Aspose.Slides.Slide parentSlide = parent.GetSlideByPosition(i + 1);

Aspose.Slides.Presentation child = new Aspose.Slides.Presentation();
child.SlideSize = new System.Drawing.Size(parentWidth, parentHeight);
parent.CloneSlide(parentSlide, 0, child, new System.Collections.SortedList());
if (child.Slides.LastSlidePosition > 1)
{
//remove default slide added during instantiation of presentation
child.Slides.RemoveAt(0);
child.DeleteUnusedMasters();

//address potential header footer issue that is documented
HeaderFooter parentHeadFoot = parentSlide.HeaderFooter;
HeaderFooter childHeadFoot = child.Slides[0].HeaderFooter;

//Assigning the visibility information (about header, footer,
//page number, date/time) of source slide to destination slide
childHeadFoot.IsHeaderVisible = parentHeadFoot.IsHeaderVisible;
childHeadFoot.IsFooterVisible = parentHeadFoot.IsFooterVisible;
childHeadFoot.IsPageNumberVisible = parentHeadFoot.IsPageNumberVisible;
childHeadFoot.IsDateTimeVisible = parentHeadFoot.IsDateTimeVisible;
childHeadFoot.IsDateTimeFixed = parentHeadFoot.IsDateTimeFixed;
childHeadFoot.IsShowOnTitleSlide = parentHeadFoot.IsShowOnTitleSlide;

//save presentation
child.Write(targetFileName + Presentation.PowerPointAppend);
}

}

Any thoughts ?

Guyan -- (3.0.1.35473)

Hi Guyan,

You have placed another shape over the shape with purple background, which is not cloned properly. You can write your text on the shape with puple background using the "Edit Text" option by right clicking the shape with purple background for proper cloning. Attached is the modified one.

Thanks that worked a treat. One more thing.. When I clone the attached slide I find that the text alignment is centered. I tried various text alignment settings but to no avail

Anything I can do about that ?

Thanks

Guyan

Hi Guyan,

As your source slide has shape with text alignment as centered, so is the cloned slide.

Well thats where I get a little confused. When I check the alignment of the shape it says its left aligned . When I check the first sentance "6 key outcomes...." it is centered and the subsequent numbered list is left aligned. When I clone and write the slide all the text is centered.

Any thoughts ?

Hi Guyan,

The alignment works perfectly only with textbox. Attached is the modified ppt that can be cloned properly.