私は空白の単語のdocを作成し、1つの箇条書きの項目に入れました。あなたはまた、あなたが(私の例では、以下のレベル0である)を使用している箇条書きのレベルが定義されているようにする必要があり
Paragraph paragraph1 = new Paragraph(){ RsidParagraphAddition = "002C2112", RsidParagraphProperties = "00CD1798", RsidRunAdditionDefault = "002C2112" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId(){ Val = "ListParagraph" };
NumberingProperties numberingProperties1 = new NumberingProperties();
NumberingLevelReference numberingLevelReference1 = new NumberingLevelReference(){ Val = 0 };
NumberingId numberingId1 = new NumberingId(){ Val = 1 };
numberingProperties1.Append(numberingLevelReference1);
numberingProperties1.Append(numberingId1);
paragraphProperties1.Append(paragraphStyleId1);
paragraphProperties1.Append(numberingProperties1);
Run run1 = new Run();
Text text1 = new Text();
text1.Text = "Test bullet list";
run1.Append(text1);
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
:私は、そのリストを作ったコードを反映するために、オープンXML SDK 2.0生産性向上ツールを使用しましたnumbering.xmlの部分にあります。これは、番号を使用するときにのみ作成されます。私は以下の部分を作成する方法を投稿しました:
NumberingDefinitionsPart numberingDefinitionsPart1 = part.AddNewPart<NumberingDefinitionsPart>("rId1"); //<-This id must be unique so you might have to change it
GenerateNumberingDefinitionsPart1Content(numberingDefinitionsPart1);
// Generates content of part.
private void GeneratePartContent(NumberingDefinitionsPart part)
{
Numbering numbering1 = new Numbering();
numbering1.AddNamespaceDeclaration("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006");
numbering1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
numbering1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
numbering1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
numbering1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
numbering1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
numbering1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
numbering1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
numbering1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
AbstractNum abstractNum1 = new AbstractNum(){ AbstractNumberId = 0 };
Nsid nsid1 = new Nsid(){ Val = "4BEB3E25" };
MultiLevelType multiLevelType1 = new MultiLevelType(){ Val = MultiLevelValues.HybridMultilevel };
TemplateCode templateCode1 = new TemplateCode(){ Val = "C2420342" };
Level level1 = new Level(){ LevelIndex = 0, TemplateCode = "04090001" };
StartNumberingValue startNumberingValue1 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat1 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText1 = new LevelText(){ Val = "·" };
LevelJustification levelJustification1 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties1 = new PreviousParagraphProperties();
Indentation indentation1 = new Indentation(){ Left = "720", Hanging = "360" };
previousParagraphProperties1.Append(indentation1);
NumberingSymbolRunProperties numberingSymbolRunProperties1 = new NumberingSymbolRunProperties();
RunFonts runFonts1 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Symbol", HighAnsi = "Symbol" };
numberingSymbolRunProperties1.Append(runFonts1);
level1.Append(startNumberingValue1);
level1.Append(numberingFormat1);
level1.Append(levelText1);
level1.Append(levelJustification1);
level1.Append(previousParagraphProperties1);
level1.Append(numberingSymbolRunProperties1);
Level level2 = new Level(){ LevelIndex = 1, TemplateCode = "04090003", Tentative = true };
StartNumberingValue startNumberingValue2 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat2 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText2 = new LevelText(){ Val = "o" };
LevelJustification levelJustification2 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties2 = new PreviousParagraphProperties();
Indentation indentation2 = new Indentation(){ Left = "1440", Hanging = "360" };
previousParagraphProperties2.Append(indentation2);
NumberingSymbolRunProperties numberingSymbolRunProperties2 = new NumberingSymbolRunProperties();
RunFonts runFonts2 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Courier New", HighAnsi = "Courier New", ComplexScript = "Courier New" };
numberingSymbolRunProperties2.Append(runFonts2);
level2.Append(startNumberingValue2);
level2.Append(numberingFormat2);
level2.Append(levelText2);
level2.Append(levelJustification2);
level2.Append(previousParagraphProperties2);
level2.Append(numberingSymbolRunProperties2);
Level level3 = new Level(){ LevelIndex = 2, TemplateCode = "04090005", Tentative = true };
StartNumberingValue startNumberingValue3 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat3 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText3 = new LevelText(){ Val = "§" };
LevelJustification levelJustification3 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties3 = new PreviousParagraphProperties();
Indentation indentation3 = new Indentation(){ Left = "2160", Hanging = "360" };
previousParagraphProperties3.Append(indentation3);
NumberingSymbolRunProperties numberingSymbolRunProperties3 = new NumberingSymbolRunProperties();
RunFonts runFonts3 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Wingdings", HighAnsi = "Wingdings" };
numberingSymbolRunProperties3.Append(runFonts3);
level3.Append(startNumberingValue3);
level3.Append(numberingFormat3);
level3.Append(levelText3);
level3.Append(levelJustification3);
level3.Append(previousParagraphProperties3);
level3.Append(numberingSymbolRunProperties3);
Level level4 = new Level(){ LevelIndex = 3, TemplateCode = "04090001", Tentative = true };
StartNumberingValue startNumberingValue4 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat4 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText4 = new LevelText(){ Val = "·" };
LevelJustification levelJustification4 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties4 = new PreviousParagraphProperties();
Indentation indentation4 = new Indentation(){ Left = "2880", Hanging = "360" };
previousParagraphProperties4.Append(indentation4);
NumberingSymbolRunProperties numberingSymbolRunProperties4 = new NumberingSymbolRunProperties();
RunFonts runFonts4 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Symbol", HighAnsi = "Symbol" };
numberingSymbolRunProperties4.Append(runFonts4);
level4.Append(startNumberingValue4);
level4.Append(numberingFormat4);
level4.Append(levelText4);
level4.Append(levelJustification4);
level4.Append(previousParagraphProperties4);
level4.Append(numberingSymbolRunProperties4);
Level level5 = new Level(){ LevelIndex = 4, TemplateCode = "04090003", Tentative = true };
StartNumberingValue startNumberingValue5 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat5 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText5 = new LevelText(){ Val = "o" };
LevelJustification levelJustification5 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties5 = new PreviousParagraphProperties();
Indentation indentation5 = new Indentation(){ Left = "3600", Hanging = "360" };
previousParagraphProperties5.Append(indentation5);
NumberingSymbolRunProperties numberingSymbolRunProperties5 = new NumberingSymbolRunProperties();
RunFonts runFonts5 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Courier New", HighAnsi = "Courier New", ComplexScript = "Courier New" };
numberingSymbolRunProperties5.Append(runFonts5);
level5.Append(startNumberingValue5);
level5.Append(numberingFormat5);
level5.Append(levelText5);
level5.Append(levelJustification5);
level5.Append(previousParagraphProperties5);
level5.Append(numberingSymbolRunProperties5);
Level level6 = new Level(){ LevelIndex = 5, TemplateCode = "04090005", Tentative = true };
StartNumberingValue startNumberingValue6 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat6 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText6 = new LevelText(){ Val = "§" };
LevelJustification levelJustification6 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties6 = new PreviousParagraphProperties();
Indentation indentation6 = new Indentation(){ Left = "4320", Hanging = "360" };
previousParagraphProperties6.Append(indentation6);
NumberingSymbolRunProperties numberingSymbolRunProperties6 = new NumberingSymbolRunProperties();
RunFonts runFonts6 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Wingdings", HighAnsi = "Wingdings" };
numberingSymbolRunProperties6.Append(runFonts6);
level6.Append(startNumberingValue6);
level6.Append(numberingFormat6);
level6.Append(levelText6);
level6.Append(levelJustification6);
level6.Append(previousParagraphProperties6);
level6.Append(numberingSymbolRunProperties6);
Level level7 = new Level(){ LevelIndex = 6, TemplateCode = "04090001", Tentative = true };
StartNumberingValue startNumberingValue7 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat7 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText7 = new LevelText(){ Val = "·" };
LevelJustification levelJustification7 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties7 = new PreviousParagraphProperties();
Indentation indentation7 = new Indentation(){ Left = "5040", Hanging = "360" };
previousParagraphProperties7.Append(indentation7);
NumberingSymbolRunProperties numberingSymbolRunProperties7 = new NumberingSymbolRunProperties();
RunFonts runFonts7 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Symbol", HighAnsi = "Symbol" };
numberingSymbolRunProperties7.Append(runFonts7);
level7.Append(startNumberingValue7);
level7.Append(numberingFormat7);
level7.Append(levelText7);
level7.Append(levelJustification7);
level7.Append(previousParagraphProperties7);
level7.Append(numberingSymbolRunProperties7);
Level level8 = new Level(){ LevelIndex = 7, TemplateCode = "04090003", Tentative = true };
StartNumberingValue startNumberingValue8 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat8 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText8 = new LevelText(){ Val = "o" };
LevelJustification levelJustification8 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties8 = new PreviousParagraphProperties();
Indentation indentation8 = new Indentation(){ Left = "5760", Hanging = "360" };
previousParagraphProperties8.Append(indentation8);
NumberingSymbolRunProperties numberingSymbolRunProperties8 = new NumberingSymbolRunProperties();
RunFonts runFonts8 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Courier New", HighAnsi = "Courier New", ComplexScript = "Courier New" };
numberingSymbolRunProperties8.Append(runFonts8);
level8.Append(startNumberingValue8);
level8.Append(numberingFormat8);
level8.Append(levelText8);
level8.Append(levelJustification8);
level8.Append(previousParagraphProperties8);
level8.Append(numberingSymbolRunProperties8);
Level level9 = new Level(){ LevelIndex = 8, TemplateCode = "04090005", Tentative = true };
StartNumberingValue startNumberingValue9 = new StartNumberingValue(){ Val = 1 };
NumberingFormat numberingFormat9 = new NumberingFormat(){ Val = NumberFormatValues.Bullet };
LevelText levelText9 = new LevelText(){ Val = "§" };
LevelJustification levelJustification9 = new LevelJustification(){ Val = LevelJustificationValues.Left };
PreviousParagraphProperties previousParagraphProperties9 = new PreviousParagraphProperties();
Indentation indentation9 = new Indentation(){ Left = "6480", Hanging = "360" };
previousParagraphProperties9.Append(indentation9);
NumberingSymbolRunProperties numberingSymbolRunProperties9 = new NumberingSymbolRunProperties();
RunFonts runFonts9 = new RunFonts(){ Hint = FontTypeHintValues.Default, Ascii = "Wingdings", HighAnsi = "Wingdings" };
numberingSymbolRunProperties9.Append(runFonts9);
level9.Append(startNumberingValue9);
level9.Append(numberingFormat9);
level9.Append(levelText9);
level9.Append(levelJustification9);
level9.Append(previousParagraphProperties9);
level9.Append(numberingSymbolRunProperties9);
abstractNum1.Append(nsid1);
abstractNum1.Append(multiLevelType1);
abstractNum1.Append(templateCode1);
abstractNum1.Append(level1);
abstractNum1.Append(level2);
abstractNum1.Append(level3);
abstractNum1.Append(level4);
abstractNum1.Append(level5);
abstractNum1.Append(level6);
abstractNum1.Append(level7);
abstractNum1.Append(level8);
abstractNum1.Append(level9);
NumberingInstance numberingInstance1 = new NumberingInstance(){ NumberID = 1 };
AbstractNumId abstractNumId1 = new AbstractNumId(){ Val = 0 };
numberingInstance1.Append(abstractNumId1);
numbering1.Append(abstractNum1);
numbering1.Append(numberingInstance1);
part.Numbering = numbering1;
}
これはほぼ確実にどこかのエンコードの問題です。サーバーはおそらくdevマシンとは異なるロケールにあります。もしそうなら、あなたのソースコード中の '・'をエスケープシーケンスに置き換えて修正する必要があります。 –
特に、 'Val =" \ u00b7 "'です。 –