Trouble applying format to number list in openxml word document

322 Views Asked by At

I have been able to create simple word document using OpenXML. I am trying to add multi-level numbered list as follows:

1. Point 1 
  a. Sub Point 1

I have tried following code

Step 1:

Dim numberid As New NumberingId
numberid.Val = 1

Dim numlevelref As New NumberingLevelReference
numlevelref.Val = 0

Dim numberprop As New NumberingProperties
numberprop.NumberingId = numberid
numberprop.NumberingLevelReference = numlevelref

Dim pp As New ParagraphProperties
pp.NumberingProperties = numberprop

Dim p As Paragraph = New Paragraph
p.Append(pp)

Dim run As New Run
run.Append(New Text("Point 1"))
p.Append(run)

Step 2:

Dim numberid As New NumberingId
numberid.Val = 1

Dim numlevelref As New NumberingLevelReference
numlevelref.Val = 1    '(Only this has changed from Step 1)

Dim numberprop As New NumberingProperties
numberprop.NumberingId = numberid
numberprop.NumberingLevelReference = numlevelref

Dim pp As New ParagraphProperties
pp.NumberingProperties = numberprop

Dim p As Paragraph = New Paragraph
p.Append(pp)

Dim run As New Run
run.Append(New Text("Sub Point 1"))
p.Append(run)

This gives me following output:

1. Point 1
   1. Sub Point 1

Please let me know how to apply number format. I have understood following is the class to use:

Dim numformat As New NumberingFormat
numformat.Val = NumberFormatValues.LowerLetter

But where to use numformat in Step 2?

0

There are 0 best solutions below