Hello,
Thank you for contacting.
Our Spire.Presentation has no direct way like
textRange.CloneNode(true) to clone the TextRange and TextParagraph from one shape to another, but you can refer to the following sample code to achieve it. If there is any question, to help further look into it, please share us with your sample PPT file as well as your desired effect of output. You could send them via email (
[email protected]).
- Code: Select all
Presentation ppt = new Presentation();
ppt.LoadFromFile(@"test.pptx");
ISlide slide = ppt.Slides[0];
//get the textRange from the first shape
TextRange textRange = (slide.Shapes[0] as IAutoShape).TextFrame.TextRange;
TextRange newTextRange = new TextRange(textRange);
//clear the textrange of second shape
(slide.Shapes[1] as IAutoShape).TextFrame.Paragraphs[0].TextRanges.Clear();
//append new textRange to the second shape
(slide.Shapes[1] as IAutoShape).TextFrame.Paragraphs[0].TextRanges.Append(newTextRange);
//get the TextParagraph from the first shape
TextParagraph tp = (slide.Shapes[0] as IAutoShape).TextFrame.Paragraphs[1];
TextParagraph newtp = new TextParagraph(tp);
//append new TextParagraph to the second shape
(slide.Shapes[1] as IAutoShape).TextFrame.Paragraphs.Append(newtp);
//save
ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013);
Sincerely,
Lisa
E-iceblue support team