Line Numbering

Technical support for Spire.Doc

Moderator: iceblue support

Line Numbering

Postby shivin » Fri Jul 07, 2017 11:49 am

I want to apply line numbering only on the 1 sections out of 3 of my word document using spire.doc, please provide a solution for this.

detail description: if there are 3 main headings in my document A, B and C. i just want to apply line numbering in the content of heading A, what code should i use.

Please guide
shivin
 
Posts: 4
Joined: Fri Jul 07, 2017 11:33 am

Re: Line Numbering

Postby Jane.Bai » Mon Jul 10, 2017 3:35 am

Hello,

Thanks for your inquiry.
Considering your description,if the headings are in the different sections or different pages, your requirement is available. You could set the "LineNumberingRestartMode" specially as the "page" or the "section" accordingly.
Below is the reference for adding line numbering.
https://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/Page-Setup/How-to-add-line-numbers-in-C.html
Please feel free to contact us if there's still any doubt.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 612
Joined: Tue Nov 29, 2016 1:47 am

Re: Line Numbering

Postby shivin » Mon Jul 10, 2017 1:16 pm

Thanks for your reply.

but it does not clarify my doubt.

Actually we have 4 choices for restart mode
None, Continuous, RestartPage and RestartSection
but none of them allow me to stop the line numbering for the next section or next page.

my exact query is i want to display numbering for first section but stop displaying numbering from the next section.

any help will be appreciated.
shivin
 
Posts: 4
Joined: Fri Jul 07, 2017 11:33 am

Re: Line Numbering

Postby Jane.Bai » Tue Jul 11, 2017 1:51 am

Hello,

Thanks for your response.
Please kindly note that MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” and “Line” concept in Word document, and our Spire.Doc product is based on MS Word specification, so your requirement on stopping the line break for next page is not available. However, since the line numbering setting is based on each section, when you set the line numbering for the first section, it will not take effect in the other sections, so you could set the line numbering to the section in which you want to display line numbers.
For example, the code below can be used to stop displaying the sections except for the first section.
Code: Select all
Document document = new Document();
            document.LoadFromFile(input file);

            document.Sections[0].PageSetup.LineNumberingStartValue = 1;
            document.Sections[0].PageSetup.LineNumberingStep = 6;
            document.Sections[0].PageSetup.LineNumberingRestartMode = LineNumberingRestartMode.Section;

            document.SaveToFile(output file);
            System.Diagnostics.Process.Start(output file);

Hope I make it clear.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 612
Joined: Tue Nov 29, 2016 1:47 am

Re: Line Numbering

Postby shivin » Tue Jul 11, 2017 8:49 am

Hi,

Thanks for quick response.

Actually the document on which i am working is written only in a single section having number of paragraphs and have only 2 page breaks in whole document.

is it possible to stop displaying line numbering after 1st page break
or
is it possible to stop displaying line numbering after a particular paragraph.

hope i am not making it irritating for you.
shivin
 
Posts: 4
Joined: Fri Jul 07, 2017 11:33 am

Re: Line Numbering

Postby Jane.Bai » Tue Jul 11, 2017 9:21 am

Hello,

Never mind, it's always our pleasure to help you. :lol:
I have mentioned before, MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” and “Line” concept in Word document,and it is impossible to achieve the features you want in MS word, neither in our Spire.Doc.
Please feel free to contact us if you need any assistance.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 612
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 0 guests