I’m trying to insert HTML to my document with the DocumentBuilder class.
This is the HTML I try to insert (it is generated using the Aspose dll as well):
hello
The “hello” string ends up to be on the right of the paragraph instead on the left, as I want it to be. I attach the final docx document, where the “hello” string appears on the right.
Hi
Thanks for your request. In the attached document “hello” text is Right-to-Left. Right-to-Left is not supported during converting to HTML. This is known issue #390 in our defect database.
Try using the following html:
I couldn’t figure out what you meant. Should I write “text-align:right” when I want it to appear on the left? and the “text-align:left” if I want it on the right?
About issue #390, is there an estimation when it will be fixed?
Hi
Thanks for your inquiry. I meant that text in the document you attached is RTL, so it is right aligned.
If you need to set alignment in your HTML just use text-align attribute as shown in my example.
Best regards.
Hi
Thanks for your inquiry. I tried to inset your HTML into the document and the text is left aligned. Could you please attach your source document and your code? I will try to reproduce the issue and provide you more information.
Best regards.
Hi
Thank you for additional information. I managed to reproduce the problem and created new issue #6505 in our defect database. I will notify you as soon as it is fixed.
It seems that problem occur because Bidi=true in Normal style of the document. You can solve the problem using the following code:
Document doc = new Document(@"Test201\in.doc");
doc.Styles[StyleIdentifier.Normal].ParagraphFormat.Bidi = false;
Hello!
Thank you for your patience. I have addressed issue #6505. As my colleague wrote this document defines Normal style with Bidi property. Since InsertHtml method assigns Normal style to inserted paragraphs, they all become RTL.
Currently RTL is not supported on import/export. The task is logged as #390 in our defect database. So there is no chance to specify RTL-LTR attributes in the HTML code and the only workaround is modifying Normal style as it was shown. We are sorry for inconvenience. #6505 is considered by design. So I’m closing it. We’ll notify you here in the forum when #390 is fixed.
Regards,
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.