Aspose word DocumentBuilder.InsertHtml() issue

Hi Team,

I am using Aspose Words .NET to embed HTML content in text document.

I am getting issue while inserting list types HTML content in Word document.

Bullet ed list with empty Circle and Square type and roman number is not inserted in document.

See below sample code:-

string htmltext1 = "<html><body><ul style='list-style-type: circle;'><li>Circle 1</li></ul><p>&nbsp;</p><p>&nbsp;</p><ul style='list-style-type: square;'><li>Square1</li></ul></html></body>";
string htmltext2 = "<html><body><ol style='list-style-type: lower-greek;'><li>Bullet1</li></ol><p>&nbsp;</p><ol style='list-style-type: lower-alpha;'><li>Bullets2</li></ol><p>&nbsp;</p><ol style='list-style-type: lower-roman;'><li>Bullet3</li></ol></html></body>";</div>

// This is instance
DocumentBuilder.InsertHtml(htmltext1);
DocumentBuilder.InsertHtml(htmltext2);

Result is as below:

<ul style="margin-top:0in" type="disc">
    <li>Circle 1</li>
</ul>
<p> </p>
<p> </p>
<ul style="margin-top:0in" type="disc">
    <li>Square1</li>
</ul>
<p> </p>
<ol style="margin-top:0in" start="1" type="1">
    <li>Bullet1</li>
</ol>
<p> </p>
<ol style="margin-top:0in" start="1" type="1">
    <li>Bullets2</li>
</ol>
<p> </p>
<ol style="margin-top:0in" start="1" type="1">
    <li>Bullet3</li>
</ol>

Please help in solving this issue.

Regards,
Nakul

Hello

Thanks for your inquiry. Unfortunately, list-style-type is not yet supported during HTML import. Your request has been linked to the appropriate issue. You will be notified as soon as this feature is supported.

But you can still achieve what you need using Type Attribute of <ul> <ol>:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

string htmltext1 = @"<html>
<body>
        <ul type='circle'>
            <li>Circle 1</li>
        </ul>
        <ul type='square'>
            <li>Square1</li>
        </ul>
        <ol type='1'>
            <li>Bullet1</li>
        </ol>
        <ol type='a'>
            <li>Bullets2</li>
        </ol>
        <ol type='i'>
            <li>Bullet3</li>
        </ol>
</body>
</html>";

 
// This is instance
builder.InsertHtml(htmltext1);

doc.Save("C:\\Temp\\out.doc", SaveFormat.Doc);

Please see the following link to learn more about Optional Attributes: http://www.w3schools.com/tags/tag_ol.asp

Best regards,

Thanks for quick reply Andrey,

I will implement like this.

Regards,
Nakul

The issues you have found earlier (filed as WORDSNET-1203) have been fixed in this .NET update and this Java update.

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