Free Support Forum - aspose.com

RightToLeft for Bidi content not separating portions of text

I’m trying to implement bidirectional support into our software. We have noticed that Aspose.Slides is not developed as well as Aspose.Words in this area. Aspose.Words divides the text into runs and it does a pretty decent job of separating let’s say Arabic and English content into their own runs. Aspose.Slides seems to use paragraph portions but I noticed it’s always showing it as 1 portion. We have not done full implementation we are testing the code for bidirectional capabilities. We noticed this when using AddFromHtml. Also we noticed it doesn’t support the directional “dir” flag in html like Aspose.Words does ie. dir=“rtl”. Are there any plan on implementing these issues in the future?

Here’s some sample code.

PresentationEx presentation = new PresentationEx();
SlideExCollection slds = presentation.Slides;
SlideEx slide = presentation.Slides[slds.AddEmptySlide(presentation.LayoutSlides[0])];

int idx = slide.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 10, 10, presentation.SlideSize.Size.Width - 20, presentation.SlideSize.Size.Height - 10);

AutoShapeEx ashp = (AutoShapeEx)slide.Shapes[idx];

//Add TextFrame to the Rectangle
ashp.AddTextFrame("");
ashp.TextFrame.Paragraphs.Clear();

//Accessing the text frame
TextFrameEx txtFrame = ashp.TextFrame;

//Adding text from HTML stream reader in text frame
ashp.TextFrame.Paragraphs.AddFromHtml("<div dir=“rtl”>شا: this is a test.");

//Create the Paragraph object for text frame
ParagraphEx para = txtFrame.Paragraphs[0];
// para.ParagraphFormat.RightToLeft = NullableBool.True;
presentation.Save(“demo.ppt”, SaveFormat.Pptx);

Hi David,


Thanks for inquiring Aspose.Slides.

I have observed the requirements shared by you and have been able to reproduce both of them. An issue with ID SLIDESNET-34348 has been created to further investigate and resolve the issue of support for RTL tag in Aspose.Slides HTML import method. A separate issue with ID SLIDESNET-34349 has been created to investigate the requirement for maintaining the bidirectional text in separate portions.

This thread has been linked with the issues so that you may be automatically notified once the features will be available. For your kind reference, I have attached the html and generated presentation image where by you can see that both HTML and Aspose.Slides text frame are rendered alike even rtl tag is set in html. We will investigate this as well.

Many Thanks,