0

is there a way to apply Font and FontSize settings to a numbered list? There are 2 ways to set this settings to a TEXT of list:

document.InsertList( numberedList, .Font(new Xceed.Words.NET.Font("Cambria"), 15 );

  numberedList.Items[2].Font(new Xceed.Words.NET.Font("Cambria"));

But how can I apply this settings to numeration of my list?

Also : default font for a document - will be available in v1.5 through a new method : Document.SetDefaultFont.(GitHub)

1 Answers1

0

The short answer is: It can't be done with the current version of xceed

I submitted a ticket to xceedsoftware/docx on github and asked this question:

I understand how to create a numbered list:

using (DocX document = DocX.Create(ListSample.ListSampleOutputDirectory + @"AddList.docx"))
{
    var numberedList = document.AddList("Berries", 0, ListItemType.Numbered, 1);
    .
    .
}

But, how do I modify the font and/or font size of the numbers? I see the ParagraphNumberProperties property in the debugger but don't see anything in the DocX class docs that helps

Just to be clear, I want to modify the font and font size of the number in the list, not the text to the right of the number.

Their reply follows (i.e., you can't change the font of the numbers using the current version)

Hi,

Thank you for your suggestion.

Currently, only the font/font size of the ListItems can be set with the Document.InsertList( List list, Font fontFamily, double fontSize ) method. We will investigate to add this feature.

Thank you.

VA systems engineer
  • 2,856
  • 2
  • 14
  • 38
  • Can you give an example, because I tried numbered List.Add Item(new Paragraph()) and several similar solutions and always getting error. – Vladyslav Hrehul May 05 '18 at 11:00
  • Sorry - I don't own the Xeed software ($500 ?!!!!). If you look at the S.O. question I referenced, it may help you figure it out. I don't know how big your program is, but if its small, may abandon XCeed and just use Word Interop? Its free and then the S.O question I referenced is your answer. – VA systems engineer May 05 '18 at 11:04
  • Simple Xceed.Words.Net is free and avaible on nuget.org. – Vladyslav Hrehul May 05 '18 at 11:06
  • Please post **all** the code you currently have so I don't have to start from scratch – VA systems engineer May 05 '18 at 11:10
  • Is [this](https://www.nuget.org/packages/DocX/) the Nuget package? Xceed DocX 1.1.0? – VA systems engineer May 05 '18 at 11:23
  • string fileName = @"D:\DocXExample.docx"; var doc = DocX.Create(fileName); var numberedList = doc.AddList("Text", 0, ListItemType.Numbered, 14); doc.AddListItem(numberedList, "Gnome Alone", 3); doc.AddListItem(numberedList, "Test", 3); doc.InsertList(numberedList, new Xceed.Words.NET.Font("Cambria"), 8); – Vladyslav Hrehul May 05 '18 at 12:03
  • Yes, Xceed DocX 1.1.0 – Vladyslav Hrehul May 05 '18 at 12:05
  • You don`t understand me correctly. Yes, you aplied styling for text, but not for numeration. – Vladyslav Hrehul May 05 '18 at 12:29
  • Its not a good idea to provide cryptic links like `ibb.co/g0iyM7`. I have no idea what that link goes to. Your original question is poorly worded and lacks much information. You need to update your question to include all this information instead of putting it into comments – VA systems engineer May 05 '18 at 12:39
  • @VladyslavHrehul: I changed my answer – VA systems engineer Jun 03 '18 at 23:45