How to add Superscript/Subscript.!

How to add Superscript/Subscript in slide title on text box. please help.

image.png (636 Bytes)


I have observed your requirement and regret to share that at present the support for adding Superscript or Subscript text inside text frame is unavailable in Aspose.Slides. An issue with ID SLIDESNET-39242 has been added as new feature request in our issue tracking system to provide requested support. This thread has been linked with the issue so that you may be automatically notified once the support will be available.

@mudassir.fayyaz ,
Thanks for your quick response.

The issues you have found earlier (filed as SLIDESNET-39242) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz


For adding Superscript or Subscript text in Aspose.Slides text frame you must use Escapement properties of PortionFormat class. This property returns or sets the superscript or subscript text (value from -100% (subscript) to 100% (superscript). For example:

using (Presentation presentation = new Presentation())
    // Get slide
    ISlide slide = presentation.Slides[0];

    // Create text box
    IAutoShape shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 200, 100);
    ITextFrame textFrame = shape.TextFrame;

    // Create paragraph for superscript text
    IParagraph superPar = new Paragraph();
    // Create portion with usual text
    IPortion portion1 = new Portion();
    portion1.Text = "SlideTitle";

    // Create portion with superscript text
    IPortion superPortion = new Portion();
    superPortion.PortionFormat.Escapement = 30;
    superPortion.Text = "TM";

    // Create paragraph for subscript text
    IParagraph paragraph2 = new Paragraph();
    // Create portion with usual text
    IPortion portion2 = new Portion();
    portion2.Text = "a";

    // Create portion with subscript text
    IPortion subPortion = new Portion();
    subPortion.PortionFormat.Escapement = -25;
    subPortion.Text = "i";

    // Add paragraphs to text box

    presentation.Slides[0].GetThumbnail(2f, 2f).Save("TestOut.png", ImageFormat.Png);

Please share the code for java.
And we have need to change the text of a text frame into a superscript or subscript format with color properties . There is no need to save extra image/image format on chart.I have again attached the snapshot of actual requirement in PowerPoint.
AsposeSlideRequirement.PNG (6.0 KB)


This text will be hidden


I suggest you to please refer to Java documentation article, How to add superscript and sub-script text. In order to set font related properties for text portion, please refer to this documentation article. I hope the shared information will be helpful.

thank you for resolve my issue. :grinning: