diff --git a/OfficeIMO.Examples/Word/Lists/Lists.Create8.cs b/OfficeIMO.Examples/Word/Lists/Lists.Create8.cs index db9ae7a5..5aae0a93 100644 --- a/OfficeIMO.Examples/Word/Lists/Lists.Create8.cs +++ b/OfficeIMO.Examples/Word/Lists/Lists.Create8.cs @@ -8,8 +8,7 @@ internal static void Example_BasicLists8(string folderPath, bool openWord) { string filePath = System.IO.Path.Combine(folderPath, "Document with Lists11.docx"); using (WordDocument document = WordDocument.Create(filePath)) { - // add list and nest a list - WordList wordList1 = document.AddList(WordListStyle.Headings111, false); + WordList wordList1 = document.AddList(WordListStyle.Headings111, false, 15); wordList1.AddItem("Text 1"); wordList1.AddItem("Text 1.1"); wordList1.AddItem("Text 1.2"); @@ -18,7 +17,7 @@ internal static void Example_BasicLists8(string folderPath, bool openWord) { document.AddParagraph("Second List"); document.AddParagraph(); - WordList wordList2 = document.AddList(WordListStyle.Headings111, false); + WordList wordList2 = document.AddList(WordListStyle.Headings111, false, 25); wordList2.AddItem("Text 2"); wordList2.AddItem("Text 2.1"); wordList2.AddItem("Text 2.2"); @@ -28,14 +27,13 @@ internal static void Example_BasicLists8(string folderPath, bool openWord) { document.AddParagraph("Third List"); document.AddParagraph(); - WordList wordList3 = document.AddList(WordListStyle.Headings111, false); + WordList wordList3 = document.AddList(WordListStyle.Headings111, false, 50); wordList3.AddItem("Text 3"); wordList3.AddItem("Text 3.1"); wordList3.AddItem("Text 3.2"); wordList3.AddItem("Text 3.3"); wordList3.AddItem("Text 3.4"); - document.Save(openWord); } } diff --git a/OfficeIMO.Word/WordDocument.PublicMethods.cs b/OfficeIMO.Word/WordDocument.PublicMethods.cs index 5f6f75cd..03f96046 100644 --- a/OfficeIMO.Word/WordDocument.PublicMethods.cs +++ b/OfficeIMO.Word/WordDocument.PublicMethods.cs @@ -92,15 +92,15 @@ public WordChart AddPieChart(string title = null, bool roundedCorners = false, i return pieChart; } - public WordList AddList(WordListStyle style, bool continueNumbering = false) { + public WordList AddList(WordListStyle style, bool continueNumbering = false, int? fontSize = null) { WordList wordList = new WordList(this); - wordList.AddList(style, continueNumbering); + wordList.AddList(style, continueNumbering, fontSize); return wordList; } - public WordList AddTableOfContentList(WordListStyle style) { + public WordList AddTableOfContentList(WordListStyle style, int? fontSize = null) { WordList wordList = new WordList(this, true); - wordList.AddList(style, continueNumbering: true); + wordList.AddList(style, continueNumbering: true, fontSize); return wordList; } diff --git a/OfficeIMO.Word/WordHeaderFooter.Methods.cs b/OfficeIMO.Word/WordHeaderFooter.Methods.cs index b6f53695..adf81226 100644 --- a/OfficeIMO.Word/WordHeaderFooter.Methods.cs +++ b/OfficeIMO.Word/WordHeaderFooter.Methods.cs @@ -53,9 +53,9 @@ public WordTable AddTable(int rows, int columns, WordTableStyle tableStyle = Wor } } - public WordList AddList(WordListStyle style, bool continueNumbering = false) { + public WordList AddList(WordListStyle style, bool continueNumbering = false, int? fontSize = null) { WordList wordList = new WordList(this._document, this); - wordList.AddList(style, continueNumbering); + wordList.AddList(style, continueNumbering, fontSize); return wordList; } } diff --git a/OfficeIMO.Word/WordList.cs b/OfficeIMO.Word/WordList.cs index 0e1c240f..54303d12 100644 --- a/OfficeIMO.Word/WordList.cs +++ b/OfficeIMO.Word/WordList.cs @@ -401,7 +401,7 @@ private static int GetNextNumberingInstance(Numbering numbering) { return ids.Count > 0 ? ids.Max() + 1 : 1; } - internal void AddList(WordListStyle style, bool continueNumbering) { + internal void AddList(WordListStyle style, bool continueNumbering, int? numberingSymbolFontSize = null) { CreateNumberingDefinition(_document); var numbering = _document._wordprocessingDocument.MainDocumentPart!.NumberingDefinitionsPart!.Numbering; @@ -409,6 +409,22 @@ internal void AddList(WordListStyle style, bool continueNumbering) { _numberId = GetNextNumberingInstance(numbering); var abstractNum = WordListStyles.GetStyle(style); + + // set font size for numbering symbol + if (numberingSymbolFontSize != null) { + + // Convert to half-point measure + var val = numberingSymbolFontSize * 2; + + foreach (Level level in abstractNum.Elements()) { + NumberingSymbolRunProperties numberingSymbolRunProperties1 = new NumberingSymbolRunProperties(); + numberingSymbolRunProperties1.Append(new FontSize() { + Val = val.ToString() + }); + level.Append(numberingSymbolRunProperties1); + } + } + abstractNum.AbstractNumberId = _abstractId; var abstractNumId = new AbstractNumId { Val = _abstractId diff --git a/OfficeIMO.Word/WordParagraph.PublicMethods.cs b/OfficeIMO.Word/WordParagraph.PublicMethods.cs index d44a865b..a26989a2 100644 --- a/OfficeIMO.Word/WordParagraph.PublicMethods.cs +++ b/OfficeIMO.Word/WordParagraph.PublicMethods.cs @@ -315,9 +315,9 @@ public WordParagraph AddTab() { return wordParagraph; } - public WordList AddList(WordListStyle style, bool continueNumbering = false) { + public WordList AddList(WordListStyle style, bool continueNumbering = false, int? fontSize = null) { WordList wordList = new WordList(this._document, this); - wordList.AddList(style, continueNumbering); + wordList.AddList(style, continueNumbering, fontSize); return wordList; } diff --git a/OfficeIMO.Word/WordTableCell.cs b/OfficeIMO.Word/WordTableCell.cs index 473f2302..469ee4db 100644 --- a/OfficeIMO.Word/WordTableCell.cs +++ b/OfficeIMO.Word/WordTableCell.cs @@ -454,9 +454,9 @@ public WordTable AddTable(int rows, int columns, WordTableStyle tableStyle = Wor return wordTable; } - public WordList AddList(WordListStyle style, bool continueNumbering = false) { + public WordList AddList(WordListStyle style, bool continueNumbering = false, int? fontSize = null) { WordList wordList = new WordList(this._document, this.Paragraphs.Last()); - wordList.AddList(style, continueNumbering); + wordList.AddList(style, continueNumbering, fontSize); return wordList; } }