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.

Fri Sep 29, 2017 4:03 pm

I create a heading for my document using BuiltIn Style Heading 1:

var p = tmpSection.AddParagraph();
p.AppendText("Appendices");
p.ApplyStyle(BuiltinStyle.Heading1);

This heading (since it is appendices) shall not have a chapter number. How to achieve this behavior?

mhofer1976
 
Posts: 5
Joined: Thu Mar 09, 2017 12:24 pm

Sat Sep 30, 2017 3:28 am

Dear mhofer1976,

Thanks for your inquiry.
I used the latest Spire.Doc Pack(hot fix) Version:6.0.21 and the following code:
Code: Select all
            Document doc = new Document();
            Section tmpSection = doc.AddSection();
            var p = tmpSection.AddParagraph();
            p.AppendText("Appendices");
            p.ApplyStyle(BuiltinStyle.Heading1);
            doc.SaveToFile("11747.docx", FileFormat.Docx2013);

The Heading doesn't have a number, please check the screenshot.
Could you please provide the input document(if any) and the entire code you were using for further investigation ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Oct 09, 2017 12:25 pm

I'm sorry, but i don't see how that would resolve my problem. It is EXACTLY the same code i wrote and in our document definition the Heading 1 style has a chapter number.

So if your Heading 1 definition does not have a numbering this will work of course. But not in my scenario.

Or was there something fixed in this Hotfix you recommend? If so: Does it mean we have to update all of our other headings and set the (desired) numbering manually?

Please advise - is there something i don't see?

mhofer1976
 
Posts: 5
Joined: Thu Mar 09, 2017 12:24 pm

Mon Oct 09, 2017 1:47 pm

Now i know why you might have problems to find out what i'm asking for:

In the default Word template, Heading 1-3 do not have numbering applied. However, in our scenario, the document owner has modified Headings 1-3 to be numbered (1 --> 1.1 --> 1.1.3 etc.).

Now for most chapters this is fine and desired. However, for the appendices of the document we do not want to have them numbered. This is a very common scenario in many documents.

Please find attached a sample word document that has modified Heading 1 to include numbering and how the created document should look. All you need to do in Word is to select the appendices and "uncheck" the numbering.

mhofer1976
 
Posts: 5
Joined: Thu Mar 09, 2017 12:24 pm

Tue Oct 10, 2017 5:50 am

Dear mhofer1976,

Thanks for your feedback.
I noticed the document you provided has added numbering setting in Heading1, so when applying Heading1, it will add a number by default. We found there is an issue when removing the number, and I have logged it in our bug system. We will let you know when it is fixed.
Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Oct 23, 2017 8:37 am

Dear mhofer1976,

Thanks for waiting.
Now the issue is fixed in Spire.Doc Pack(hot fix) Version:6.0.31. Please add following code if you don't want the number.
Code: Select all
            p.ListFormat.RemoveList();

Looking forward to your feedback.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 24, 2017 8:58 am

Dear mhofer1976,

Greetings from E-iceblue.
Has your issue been resolved ?
Could you please give us some feedback at your convenience.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc