We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML Bullet List Formatting

I am using ASPose.Words 14.7 to make a document from HTML. I have applied style formatting to the html document with ordered list tags, which looks the way I want in a web browser, but it does not generate the number format I need in the exported word document.


Please review the attached HTML and let me know what code I would need to use to produce a word document with a similar order list numbering format.

My code looks like this:

Dim asposeDOC As Aspose.Words.Document = Nothing
asposeDOC = New Aspose.Words.Document()
Dim builder As New DocumentBuilder(asposeDOC)
builder.InsertHtml(bullet3HTML)

Response.Clear()
Response.ContentType = “application/vnd.openxmlformats-officedocument.wordprocessingml.document”
Response.AppendHeader(“content-disposition”, “filename=Test.docx”)
Dim dstStream As New MemoryStream()
asposeDOC.Save(dstStream, SaveFormat.Docx)
dstStream.Position = 0

Response.BinaryWrite(dstStream.ToArray())
Response.End()


The output word document should look like this:

1. Procedures
1.1. Induction Motors
1.1.1. Visual and Mechanical Inspection
1.1.2. Test Inspection
1.1.2.1. Recorded equipment nameplate data.
1.1.2.2. Inspected for physical damage.
etc.

Hi there,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support counter, counter-reset and counter-increment css properties at the moment. However, we had already logged this feature request as WORDSNET-7662 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

I don’t need direct support for the specific .css in my example. I need a way to manipulate the lists once they are in the ASPose.Word document so that I can control the numbering of the list to make it look the way we need it to look. Surely there is some programming work around to control the lists that are in the document?

Hi there,


Thanks
for your inquiry. ListLevel.NumberFormat Property Returns or sets the number format for the list level. Among normal text characters, the string can contain placeholder characters \x0000 to \x0008 representing the numbers from the corresponding list levels.

For example, the string “\x0000.\x0001)” will generate a list label that looks something like “1.5)”. The number “1” is the current number from the 1st list level, the number “5” is the current number from the 2nd list level.

You can do the formatting by using the Font properties
of ListLevel. Please check the following code example for your kind reference.


Document doc = new
Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.ListFormat.List = doc.Lists.Add(ListTemplate.NumberDefault);

builder.ListFormat.ListLevel.Font.Bold = true;

builder.ListFormat.ListLevel.Font.Color = Color.Red;

builder.Writeln("Main Section1");

builder.ListFormat.ListIndent();

builder.ListFormat.ListLevel.Font.Italic = true;

builder.ListFormat.ListLevel.Font.Color = Color.Green;

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.Arabic;

builder.ListFormat.ListLevel.NumberFormat = "\x0000.\x0001";

builder.Writeln("Sub Section1.1 ");

builder.ListFormat.ListIndent();

builder.ListFormat.ListLevel.Font.Underline = Underline.Dash;

builder.ListFormat.ListLevel.Font.Color = Color.Blue;

builder.ListFormat.ListLevel.NumberStyle = NumberStyle.Arabic;

builder.ListFormat.ListLevel.NumberFormat = "\x0000.\x0001.\x0002";

builder.Writeln("Sub Section 1.1.1");

builder.ListFormat.ListOutdent();

builder.Writeln("Sub Section 1.2 ");

builder.ListFormat.ListOutdent();

builder.Writeln("Main Section2");

builder.ListFormat.ListIndent();

builder.Writeln("Sub Section2.1");

builder.ListFormat.RemoveNumbers();

doc.Save(MyDir + @“out.docx”);



Hope this helps you. Please let us know if you have any more queries.

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


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

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan