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.
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;
textFrame.Paragraphs.Clear();
// Create paragraph for superscript text
IParagraph superPar = new Paragraph();
// Create portion with usual text
IPortion portion1 = new Portion();
portion1.Text = "SlideTitle";
superPar.Portions.Add(portion1);
// Create portion with superscript text
IPortion superPortion = new Portion();
superPortion.PortionFormat.Escapement = 30;
superPortion.Text = "TM";
superPar.Portions.Add(superPortion);
// Create paragraph for subscript text
IParagraph paragraph2 = new Paragraph();
// Create portion with usual text
IPortion portion2 = new Portion();
portion2.Text = "a";
paragraph2.Portions.Add(portion2);
// Create portion with subscript text
IPortion subPortion = new Portion();
subPortion.PortionFormat.Escapement = -25;
subPortion.Text = "i";
paragraph2.Portions.Add(subPortion);
// Add paragraphs to text box
textFrame.Paragraphs.Add(superPar);
textFrame.Paragraphs.Add(paragraph2);
presentation.Slides[0].GetThumbnail(2f, 2f).Save("TestOut.png", ImageFormat.Png);
System.Diagnostics.Process.Start("TestOut.png");
}
@mudassir.fayyaz,
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.
thanks
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.