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 Apr 24, 2020 7:21 am

Hello,
In Spire.Doc Free edition, I am working on merging few small docx files a there rises a need to know, how much paragraphs are left to reach the free edition limit.
Is there a way to count the amout of paragraphs in final merged document?
T.

bt777_azet.sk
 
Posts: 12
Joined: Thu Apr 23, 2020 8:19 am

Fri Apr 24, 2020 8:55 am

Hello,

Thanks for your inquiry.
Please refer to the following code to get the number of paragraphs in a Word document. If there is any question, please get back to us.
Code: Select all
        public static int GetParagraphNumber(Document doc)
        {
            int paraNum = 0;
            foreach (Section s in doc.Sections)
            {
                paraNum += s.Paragraphs.Count;
            }
            return paraNum;
        }


Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Apr 24, 2020 9:18 am

Thank you very much.
It works just as needed :)
T.

bt777_azet.sk
 
Posts: 12
Joined: Thu Apr 23, 2020 8:19 am

Fri Apr 24, 2020 9:28 am

Hello,

You are welcome.
Just feel free to contact us if you need further assistance.
Have a nice day!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc