无法将格式应用于openxml word文档中的数字列表

时间:2015-06-15 02:02:38

标签: asp.net vb.net openxml

我已经能够使用OpenXML创建简单的word文档。我正在尝试添加多级编号列表,如下所示:

1. Point 1 
  a. Sub Point 1

我尝试过以下代码

第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)

第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)

这给了我以下输出:

1. Point 1
   1. Sub Point 1

请告诉我如何应用数字格式。我理解以下是要使用的课程:

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

但是在步骤2中使用numformat的位置?

0 个答案:

没有答案