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

Free Support Forum - aspose.com

Failed to Apply TextFrame Style to Paragraph

hi,

requirement: apply super script to a text.

I am trying to add super script to text in a table.
as per API documentation, currently superscript can apply only to paragraph.

So we created an object IPortion which is added to paragraph portion. During this process, i am loosing the original style.

how to set textframe style to paragraph?

rowstart =1

itextStyle style = iTable.getRows().getitem(rowStart).getItem(0).getTextFrame().getTextFrameformat().getTextStyle();

iTable.getRows().getItem(rowStart).getItem(0).getTextFrame().getParagraphs().clear();

created a portion
created a paragraph
set the text to paragraph
add portion to paragraph.

Paragraph para = new Paragraph();
para.setText(“Dummy”);
para.getPortions().add(superPortion);

iTables.getRows().getItem(rowStart).getItem(0).getTextFrame).getParagraphs().add(para)

how to apply the style to newly created Paragraph(para) object?
Please suggest the way to apply style.

@dkishore,
Thank you for contacting support.

The final text style in PowerPoint documents may be defined in various formats such as text portion format, paragraph format, text frame format, etc. For these properties, the inheritance mechanism is also used. The getTextStyle method returns only part of the formatting that might have been applied by default to a paragraph. You should read all necessary formatting properties before deleting paragraphs and apply the properties to a new paragraph or portion.

Please note if you clear all paragraphs in PowerPoint and read a paragraph count in a table cell with Aspose.Slides, you will see one empty paragraph (portion) that can contain some formatting properties. That is why you can add a new paragraph in PowerPoint with the same properties.

Also you can know the final formatting properties applied to a text portion as shown below:

var effectivePortionFormat = portion.getPortionFormat().getEffective();

Documents: Text Formatting