Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Aug 27, 2025 11:51 pm

Hi guys

The following code no longer works in Spire.Doc 13.8.1

Code: Select all
var style = new Spire.Doc.Documents.ListStyle(document, Spire.Doc.Documents.ListType.Numbered)
{
   Name = "Style"
};
style.Levels[0].CharacterFormat.FontName = "Arial";


We get compile errors as follows:

'ListStyle' does not contain a constructor that takes 2 arguments
'ListStyle' does not contain a definition for Levels

This was working with 13.7.14

I can't see any documentation about what has changed, can you help?

formsbyair
 
Posts: 9
Joined: Tue Mar 29, 2016 8:13 am

Thu Aug 28, 2025 1:59 am

Hello,

Thank you for your inquiry.
Starting from Spire.Doc 13.8.1, the public constructor for ListStyle has been deprecated. ListStyle objects are now managed within the Document.Styles collection and should be created using the StyleCollection.Add(ListType listType, string name) method. Please refer to the following code example:
Code: Select all
ListStyle listStyle = document.Styles.Add(ListType.Numbered, "levelstyle");
listStyle.IsCustomStyle = true;
listStyle.CharacterFormat.FontName = "Arial";

For more details regarding list-related adjustments, you may refer to the following link:
https://www.e-iceblue.com/news/Spire.Doc-for-.NET/spiredoc-1381.html
We sincerely apologize for any inconvenience this may have caused.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 341
Joined: Mon Apr 14, 2025 3:33 am

Fri Nov 21, 2025 5:49 am

[Text.]

– [Bullet level 1]

• [Bullet level 2]
• [Bullet level 2]

– [Bullet level 3]
– [Bullet level 1]

[Text.]

1. [Numbered level 1]

a) [Numbered level 2]
b) [Numbered level 2]

1. [Numbered level 3]
2. [Numbered level 3]

[Text.]
How to generate the above format of bullet with space alignment and symbol using spire.doc .Net version 13.10.3

eswaribaskar
 
Posts: 5
Joined: Fri Nov 21, 2025 5:30 am

Fri Nov 21, 2025 9:04 am

Hello eswaribaskar,

Thank you for your inquiry,
Our latest version has indeed made adjustments in this part. Please refer to the attached example code to implement your requirements. If you have any other questions, just feel free to contact.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1533
Joined: Wed Apr 25, 2018 3:20 am

Fri Nov 21, 2025 11:05 am

I want to create a table of contents with dotted lines using Spire.Doc for .NET. The numbering (e.g., 1, 2, 2.1, 3, 3.1, 4, 5) should be generated automatically when I add text, and the page numbers should also update automatically. The text in the table of contents should use a different font size and font name than the headings in the document. For the headings themselves, I need to apply different fonts and styles.
After adding bullets under section 2.1 [Heading 2], the subheadings should appear as:

2.1.1 [Heading 3]
[Text]
2.1.2 [Heading 3]
2.1.2.1 [Heading 4]
[Text]
2.1.2.1.1 [Heading 5]
[Text]

These numbers (e.g., 2.1.2, 2.1.2.1, 2.1.2.1.1) should populate automatically. If I add a new heading like 2.2 [Heading 3], its numbering should also update automatically using Spire.Doc version 13.10.3.
I have attached my sample code. Could you review and modify it as requested, or share a sample code?
Last edited by eswaribaskar on Tue Nov 25, 2025 5:20 am, edited 1 time in total.

eswaribaskar
 
Posts: 5
Joined: Fri Nov 21, 2025 5:30 am

Mon Nov 24, 2025 9:27 am

Hello eswaribaskar,

Thank you for your feedback. Please refer to the attached modified example, which mainly involves the following adjustments:
1. Add the "ChangeTocStyle" method to modify the TOC tab style
2. Define the "ListStyle headingList" style and apply it to paragraphs with a heading style
3. Customize some fonts and styles for "BuiltinStyle.Heading1"
If you have any other questions, just feel free to write back.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1533
Joined: Wed Apr 25, 2018 3:20 am

Mon Nov 24, 2025 10:50 am

Hi Team,

Thanks for your support!

This is my final updated code. Everything is working properly except the Table of Contents. The heading numbers in the TOC are not updating correctly. In the document, the correct heading numbers are generated, but the Table of Contents is not reflecting the correct values.
I have attached my final version of the code and the Word output.
Kindly review and provide a solution to fix this issue.

Thanks,
Eswari B

eswaribaskar
 
Posts: 5
Joined: Fri Nov 21, 2025 5:30 am

Tue Nov 25, 2025 8:01 am

Hello eswaribaskar,

Thank you for your feedback.
Yes, I did find that the list number was not updated correctly in the TOC. I have logged this issue into our bug tracking system with SPIREDOC-11692, Our Dev team will do more investigations to resolve it.
At the same time, if I reload the current result and update the TOC, the output can be updated correctly. You can use this temporary solution first, once SPIREDOC-11692 is fixed, we will provide the hotfix version for you.
Code: Select all
Spire.Doc.Document documentNew = new Spire.Doc.Document();
documentNew.LoadFromFile(@"ProjectMonthlyReport.docx");
documentNew.IsUpdateFields = true;
documentNew.UpdateTableOfContents();
documentNew.SaveToFile(@"ProjectMonthlyReport-out.docx", Spire.Doc.FileFormat.Docx);


Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1533
Joined: Wed Apr 25, 2018 3:20 am

Thu Jan 22, 2026 2:05 am

Hello eswaribaskar,

Regarding the issue of SPIREDOC-11692, please use the modified code in the following link for testing. If you have any other questions, just feel free to write back.

spire-doc-format-table-with-custom-document-style-t8915.html

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1533
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc

cron