How to Append Portion to Paragraph and Paragraph to TextFrame?

I want to add rich text into the textframe. I have manually converted the rich text to jason, but I don’t know how to add the format to the slide

  1. How to append Portion to paragraph?
  2. How to append paragraph to textFrame?

@iyyb930,
Thank you for your inquiry.

I hope the following code snippet helps you to add portions and paragraphs to TextFrame objects.

Portion portion = new Portion();
portion.setText("text portion");
// add portion formatting here

Paragraph paragraph = new Paragraph();
paragraph.getPortions().add(portion);

someTextFrame.getParagraphs().add(paragraph);

Documents: Manage Paragraph
API Reference: Portion Class | Paragraph Class | ITextFrame Interface