Text aligning problem when inserting html

Hi,

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.

How can I prevent this from happening?

Thanks a lot,
Shay.

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:

<html>
<body>
<p style="text-align:right;">
<span style="font-family:'Calibri'; font-size:11pt; ">hello</span>
</p>
</body>
</html>

Best regards.

Hi,

Thanks for the response.

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?

Thanks,
Shay.

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

How does it end up to be RTL? The HTML I posted on my first post here had no alignment attributes…

Thanks,
Shay.

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,

We’re trying to insert the HTML instead of the xxxDescriptionxxx string on the attached file.

We use Find and Replace in order to insert HTML there, using code that appears on this forum (here: Is there a markup for making styling text (making italics) in Aspose.Words?).

Thanks!
Shay.

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;

Best regards.

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,

The issues you have found earlier (filed as 390) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)