How to insert text with html tags at bookmarks

Hi,

I am using Aspose.words for java. My requirement is to insert html at the bookmarks and save the document. I used documentBuilder.insertHtml(argText) method for this. Most of the html tag are working fine but few tags like <ol>, <address> are not working properly. <ol> is displaying some junk characters and <address> is displayed as normal(it should be italic).

Are these tags supported in Aspose.words? Where can I get the list of supported html tags ?

Thanks,
Nalini

Hi

Thanks for your request. Which version of Aspose.Words for java do you use? Problem with list bullets was resolved in the latest version of Aspose.Words for java. You can download it from here:
https://releases.aspose.com/words/net
You can find an approximate list of what is supported in HTML import/export here:
https://releases.aspose.com/words/net
But, you should note, this list could be out of date, since we are working on improving out HTML import/export modules.
Best regards.

Hi,

I have taken the latest Aspose.words for Java 3.1.1.1 and tested. The html I have used for testing is

Testing OL without Type

<OL>
<LI> Item 1 </LI>
<LI> Item 2 </LI>
</OL>

Testing <OL> Type - 1

<OL TYPE="1">
    <LI> Item 1  </LI>
    <LI> Item 2  </LI>
</OL>

Testing <OL> Type - a

<OL TYPE="a">
    <LI> Item 1 </LI>
    <LI> Itme 2 </LI>
</OL>

Testing <OL> Type - A

<OL TYPE="A">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

Testing <OL> Type - i

<OL TYPE="i">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

Testing <OL> Type - I

<OL TYPE="I">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

The first 2 i.e., “Testing OL without Type” and " Testing <OL> Type - 1 " are working fine but the remaining are displaying junk characters. Attached the generated document for your reference.

Thanks,
Nalini

Hi
Thank you for additional information. I cannot reproduce the problem on my side. Here is code I used for testing:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
 
String html = "Testing OL without Type" +
        "<OL><LI> Item 1 </LI><LI> Item 2 </LI></OL>" +
        "Testing <OL> Type - 1" +
        "<OL TYPE= \"1\"><LI> Item 1  </LI><LI> Item 2  </LI></OL>" +
        "Testing <OL> Type - a" +
        "<OL TYPE= \"a\"><LI> Item 1 </LI><LI> Itme 2 </LI></OL>" +
        "Testing <OL> Type - A" +
        "<OL TYPE= \"A\"><LI> Item 1 </LI><LI> Item 2 </LI></OL>" +
        "Testing <OL> Type - i" +
        "<OL TYPE= \"i\"><LI> Item 1 </LI><LI> Item 2 </LI></OL>" +
        "Testing <OL> Type - I" +
        "<OL TYPE= \"I\"><LI> Item 1 </LI><LI> Item 2 </LI></OL>";
 
builder.insertHtml(html);
 
doc.save("C:\\Temp\\out.doc", SaveFormat.DOC);

My output document is also attached. Please make sure you use Aspose.Words 3.1.1 in your application. Maybe some older version was cached.

Best regards.

Hi,

I have checked your output document. Though it is not displaying junk characters, the numberings it is showing is wrong. They are not as per the type.

The expected output should be like this:
Testing OL without Type

<ol><li>Item 1 </li><li>Item 2 </li></ol>

Testing OL Type - 1

<ol type="1"><li>Item 1 </li><li>Item 2 </li></ol>

Testing OL Type - a

<ol type="a"><li>Item 1 </li><li>Itme 2 </li></ol>

Testing OL Type - A

<ol type="A"><li>Item 1 </li><li>Item 2 </li></ol>

Testing OL Type - i

<ol type="i"><li>Item 1 </li><li>Item 2 </li></ol>

Testing OL Type - I

<ol type="I"><li>Item 1 </li><li>Item 2 </li></ol>

There is a mistake in the html that I posted earlier. It is not displaying juck characters because there is <OL> tag in the headings. I have removed those and tried. The junk characters are still getting displayed.

Testing OL without Type

<OL>
<LI> Item 1 </LI>
<LI> Item 2 </LI>
</OL>

Testing OL Type - 1

<OL TYPE= "1">
    <LI> Item 1  </LI>
    <LI> Item 2  </LI>
</OL>

Testing OL Type - a

<OL TYPE= "a">
    <LI> Item 1 </LI>
    <LI> Itme 2 </LI>
</OL>

Testing OL Type - A

<OL TYPE= "A">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

Testing OL Type - i

<OL TYPE= "i">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

Testing OL Type - I

<OL TYPE= "I">
    <LI> Item 1 </LI>
    <LI> Item 2 </LI>
</OL>

Can you please try with the above HTML once again?

Thanks,
Nalini

Hi

Thank you for additional information. I managed to reproduce the problem. You will be notified as soon as it is resolved.
Best regards.

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

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

Hi,

I have included Aspose.Words.jdk14.jar in my application and tested. Still the same issue persits. I have uploaded the output document for your reference.

Regards,
Nalini

Hi
Thanks for your request. It seems you are right, I reproduced the same on Aspose.Words for Java 3.2.0 too. I reopened the issue, we will further investigate it and provide you more information. Sorry for inconvenience.
Best regards.

Hi Nalini,
Thanks for your report. I have emailed to you the fixed Aspose.Words.jdk14.jar. Please check your e-mail. And please inform me how it works for you.
Best Regards,

Thanks. It is working fine.

Regards,
Nalini

Hi Nalini,
We just published Aspose.Words for Java 3.2.1 that contains your fix. Anyone can find it on Aspose.Words download page. You don’t need to download it – the jar inside the release exactly the same.
Best Reagards,

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