Text Formatting Changes when replacing fields int a template PPT file

Hello,

We just purchased the Aspose.Slides library and we are using to basically replace text fields in a template PPT file. Our goal is to simply bind data values from a database to create a self contained PowerPoint report that uses live data to populate the template fields. The correct data is being supplied but unfortunately the resulting presentation has different text sizes than the original. Also some of the text is showing a bullet point next to it even though none is being supplied. Any ideas on why this would happen?

I’ve attached the source and the resulting PPT files.

Thanks,

Rob

Dear Rob,

This problem occurs, when you set the text inside the textframe using TextFrame.setText method.

You should set the text inside a portion, for example, this is one way

TextFrame.getParagraphs().get(0).getPortions().get(0).setText("here is some text");

The above code is setting the text of the first portion in the first paragraph of the textframe.

The reason of setting text via portion is that Portion maintains the formatting of the text. If you will set it via the TextFrame, then this formatting gets lost.

Please see Working with Text section on Aspose.Slides Wiki

Thanks I’ll give that a try