Set Background Colour to Multiple Paragraphs in Single Text Frame in C#

I have a single shape in a slide which has a text frame. I can create multiple paragraphs in it from the aspose slides.net from code. On the created presentation, I can open it in MS powerpoint and colour individual paragraphs background to a different colour( see attached example)Demo1.png (12.5 KB)

Is there a way I can set background colour of different paragraphs in same text frame to be of different color.

@Abhishek_Deshwal,
Thank you for posting the question.

You can use the IPortionFormat.HighlightColor property to set a background color for a text paragraph like this:

paragraph.ParagraphFormat.DefaultPortionFormat.HighlightColor.Color = Color.Green;

then all text portions in the paragraph will inherit this color by default.

You can also change background color for a text portion like this:

// Set the background color for the first text portion in the paragraph to Red
paragraph.Portions[0].PortionFormat.HighlightColor.Color = Color.Red;

Useful article: Text Formatting