We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Portions of a paragraph are separated incorrectly

Hello,

When getting all portions of a paragraph in our presentation file, the text is separated incorrectly. Our text: “Image from Sheet1(C4:H7)” is separated into two: “Image from Sheet1(C4:H7” and “)”.

Here is the code used to reproduce this issue, along with the file provided:
------------
var presentation = new Presentation(“testFile.pptx”);

var ash = presentation.Slides[0].Shapes[0] as AutoShape;
if (ash == null)
return;

foreach (var par in ash.TextFrame.Paragraphs)
{
foreach (var por in par.Portions)
System.Console.WriteLine("’" + por.Text + “’”);
}
---------

Observe the output:
’ ‘
‘Image from Sheet1(C4:H7’
’)’
’'

InternalId: 27990

Best regards,
Jean-Alexandru Stanescu
Junior Developer
IBM Romania

Hi Jean-Alexandru,


Thank you for your interest in Aspose.Slides.

I have observed your comments and like to share with you that there is some difference in these portions that is why they are being read as different portions. I request you to please try using the below code on your end to serve the purpose.

var presentation = new Presentation(@“D:\testFile.pptx”);<o:p></o:p>

presentation.JoinPortionsWithSameFormatting();

var ash = presentation.Slides[0].Shapes[0] as AutoShape;

if (ash == null)

return;

foreach (var par in ash.TextFrame.Paragraphs)

{

foreach (var por in par.Portions)

Console.WriteLine("'" + por.Text + "'");

}


I hope this will be helpful. Please share if I may help you further in this regard.

Best Regards,

Hello,

Indeed, for the presented case the information you provided me led to a fix. Although, do you have something along the lines of “join portions with the same hyperlink”?

Best regards,
Jean-Alexandru Stanescu
Junior Developer
IBM Romania

Hi Jean-Alexandru,



I have observed your comments and also the presentation file shared by you. If you observe the presentation file in PowerPoint the hyperlink in presentation is covering Image from Sheet1(C4:H7 and ) separately. That is what why when you read the presentation using Aspose.Slides you get text in two separate portions. I request you to please reset the hyperlink for the text in PowerPoint again ad then try reading the presentation using Aspose.Slides. The other option that you can use is to try the option of merge portions with similar formatting property exposed by Presentation class.



Many Thanks,