Free Support Forum -

Portion text size and color

I’m trying to find out how to get the text size of a portion in the paragraph and how to get the background color and font color of a portion. Can you show me please? I need to gather information about text font color and background color to make sure that the text is more visible. For example, a purple font with black background is hard to read. I need a way to identify these. Thank you in advance for your help.


Here is the complete code example for setting text formatting properties:

Presentation pres = new Presentation();

Slide sld = pres.GetSlideByPosition(1);

Aspose.Slides.Rectangle rect= sld.Shapes.AddRectangle(100, 100, 500, 500);

TextFrame tf= rect.AddTextFrame("Hello");

tf.Paragraphs[0].Portions[0].FontColor = Color.Green;

tf.Paragraphs[0].Portions[0].FontHeight = 15;

tf.FillFormat.Type = FillType.Solid;

tf.FillFormat.BackColor = Color.Black;

tf.FitShapeToText = true;

pres.Fonts[tf.Paragraphs[0].Portions[0].FontIndex].FontName = "Times New Roman";


Hi, Can you give me the pptx version too please?

Also, how do I use pptx version to extract the text and title from the slides.

Thank you for your help.


Here is the sample code to find text from PPTX and set its formatting attributes:

PresentationEx pres = new PresentationEx("tst.pptx");

TextFrameEx[] tf = PresentationScanner.GetAllTextFrames(pres, false);

for (int i = 0; i < tf.Length; i++)

foreach (ParagraphEx para in tf[i].Paragraphs)

foreach (PortionEx port in para.Portions)


FontDataEx fnt = new FontDataEx("Times New Roman");

port.RawFontBold = NullableBool.True;

port.RawFontUnderline = TextUnderlineTypeEx.Double;

port.RawLatinFont = fnt;

port.RawFontHeight = 40;