Free Support Forum - aspose.com

CloneSlide does not

I am evaluating Aspose.PPT and have a need to build a single PPT file out of several, when I call cloneNode, the slides are copied to the new presentation, but the notes are not? I do not see a way to copy Notes as this is ReadOnly, does cloneNode attempt to copy the slide and its notes? or just the slide?

I would also like to be able to access the raw notes to determine the formatting (bold, italic, etc) is this possible?

Thanks

I am using this simple code below to copy all slides from p to newPres.

for (int x=0; x<p.Slides.Count; x++) {
p.CloneSlide(p.Slides[x],newPres.Slides.Count,newPres);
}


Hellooooo? Is there anybody out there?



Dear rodnex,

Cloning notes between presentations was not implemented yet but you can create new one and write formatted text (write new or clone paragraphs from source presentation). It’s possible with last hot fixes.

Alex,
thanks for the response, I have looked over the API of version[1.5.14.0] and don’t see a way to clone formatted notes.

So if my source presentations have slides with rich formatted notes, I won’t be able to clone these, as there is only a property to access the raw text of the notes, is this correct?

Except for the lack of ability to clone formatted notes, I find your component perfectly suited for my needs, without this though, I will have to consider using office automation to handle this myself

I’d humbly suggest some sort of cloneNode functionality, which picks up and copies formatted notes, as well as a property to read the formatted notes in addition to the plain text, which you currently provide.

thanks again

Dear rodnex,

It’s possible to change formatted text (not plain text) for the notes.
Please check Notes.Paragraphs.

Alex, thanks for the reply, I see what you mean and have looked into the Paragraphs and Portions, however when I attempt to call Notes.ParagraphsIdea.Add() on a newly cloned slide, a null reference exception is thrown

Paragraph clonedParagraph;

for (int x=0; x<p.Slides.Count; x++) {
p.CloneSlide(p.Slides[x],x,newPres);
if (p.Slides[x].Notes != null) {
for (int i=0; i<p.Slides[x].Notes.Paragraphs.Count; i++) {
clonedParagraph = p.Slides[x].Notes.ParagraphsIdea;
newPres.Slides[x].Notes.Paragraphs.Add(clonedParagraph);
clonedParagraph = null;
} //each paragraph
} //slideNotes != null
} //each slide





Dear rodnex,

for (int i = 0; i < part2.Slides.Count; i++)
{
if (part2.Slides[ i ].SlidePosition != 0)
{
Slide sl = part2.CloneSlide(part2.Slides[ i ], part1.Slides.Count, part1);
if (part2.Slides[ i ].Notes != null)
{
sl.AddNotes();
for (int j = 0; j < part2.Slides[ i ].Notes.Paragraphs.Count; j++)
{
sl.Notes.Paragraphs.Add(new Paragraph(part2.Slides[ i ].Notes.Paragraphs[ j ]));
}
sl.Notes.Paragraphs.RemoveAt(0);
}
}
}