我想输出两个项目符号列表,如图所示:
但我得到的是两个列表都有第二个(黑色圆圈)皮肤。
我的代码:
private static void AddNumberingDefinition(WordprocessingDocument docx)
{
NumberingDefinitionsPart numberingPart =
docx.MainDocumentPart.AddNewPart<NumberingDefinitionsPart>();
Numbering element =
new Numbering(
// new Nsid(){ Val="FFFFFF80"},
new AbstractNum(new Nsid() { Val = "FFFFFF80" },
new MultiLevelType() { Val = MultiLevelValues.HybridMultilevel },
new TemplateCode() { Val = "4970B4E6" },
new Level(
new NumberingFormat() { Val = NumberFormatValues.Bullet },
new LevelText() { Val = "°" },//char.ConvertFromUtf32(61616) }
new LevelJustification() { Val = LevelJustificationValues.Left }//,
// new RunProperties() { RunFonts = new RunFonts() { Hint = FontTypeHintValues.Default, Ascii = "Symbol",
//HighAnsi = "Symbol" } }
) { LevelIndex = 0 }
) { AbstractNumberId = 0 },
new NumberingInstance(
new AbstractNumId() { Val = 0 }
) { NumberID = 1 },
// element.Save(numberingPart);
// element = new Numbering(
new AbstractNum(new Nsid() { Val = "FFFFFF89" },
new MultiLevelType() { Val = MultiLevelValues.HybridMultilevel },
new TemplateCode() { Val = "4970B4E6" },
new Level(
new NumberingFormat() { Val = NumberFormatValues.Bullet },
new LevelText() { Val = "•" },//char.ConvertFromUtf32(61616) }
new LevelJustification() { Val = LevelJustificationValues.Left }//,
// new RunProperties() { RunFonts = new RunFonts() { Hint = FontTypeHintValues.Default, Ascii = "Symbol",
// HighAnsi = "Symbol" } }
) { LevelIndex = 0 }
) { AbstractNumberId = 1 },
new NumberingInstance(
new AbstractNumId() { Val = 1 }
) { NumberID = 2 });
element.AddNamespaceDeclaration("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006");
element.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
element.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
element.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
element.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
element.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
element.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
element.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
element.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
element.Save(numberingPart);
}
private static Paragraph GenerateParagraph()
{
return new Paragraph(
new ParagraphProperties(
new NumberingProperties(
new NumberingLevelReference() { Val = 0 },
new NumberingId() { Val = 1 })),
new Run(
new RunProperties(),
new Text("Hello, Wordl!"))
);
}
private static Paragraph GenerateParagraph2()
{
return new Paragraph(
new ParagraphProperties(
new NumberingProperties(
new NumberingLevelReference() { Val = 0 },
new NumberingId() { Val = 2 })),
new Run(
new RunProperties(),
new Text("Hello, Wordl!"))
);
}
我不知道,问题隐藏在哪里?我使用 Productivity Tool for Open XML 来比较我生成的文件和手动创建的文件,但我无法让它工作。提前感谢您的任何提示。