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 Nov 17, 2017 7:32 am

Dear support team,
Kindly provide VB script for extracting the number of pages in Word document.

Thanks!

kdr13
 
Posts: 72
Joined: Fri Apr 15, 2016 4:35 pm

Fri Nov 17, 2017 10:06 am

Hello,

Thanks for your inquiry. I am sorry our product doesn't support to use in VB script. I am sorry for the inconvenience caused.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Fri Nov 17, 2017 10:12 am

Please provide VB.Net script for extracting the number of pages in Word document.

Thanks!

kdr13
 
Posts: 72
Joined: Fri Apr 15, 2016 4:35 pm

Mon Nov 20, 2017 1:57 am

Hello,

Thanks for your reply.
I think you need the code for VB.NET instead of VB script. Please refer to the below code snippet for VB.NET to get the number of pages.

Code: Select all
Dim doc As New Document()
doc.LoadFromFile("sample.docx")
Dim pageCount = doc.PageCount


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Nov 21, 2017 7:56 am

Hello,

Greeting from E-iceblue.
Did you try the code I provided? Is it helpful to you?
Your feedback will be greatly appreciated.

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Sat Nov 25, 2017 5:58 am

Thank you - I did try this code but for some reason it does not work properly: I'm checking the number of pages of an uploaded Word document that has 1 page only, but the code I'm using shows that its page count is >1

Kindly advise,

Thanks!

kdr13
 
Posts: 72
Joined: Fri Apr 15, 2016 4:35 pm

Mon Nov 27, 2017 1:50 am

Hello,

Thanks for your feedback. To help us investigate the issue, please share us with your word document and MS Word version you are using as attached. You could send them to our email(support@e-iceblue.com).

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Nov 27, 2017 6:16 pm

It seems like Spire.Doc does not handle the count page properly when the doc margins are customized - When I changed the doc margins and selected one of the Word default options such as "Narrow" it worked fine surprisingly.

YW to check.

Thanks!

kdr13
 
Posts: 72
Joined: Fri Apr 15, 2016 4:35 pm

Tue Nov 28, 2017 6:28 am

Hello,

Thanks for your feedback. Would you please provide your word document and MS Word version information? You could attached here or send to our email(support@e-iceblue.com).

Sincerely,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Wed Nov 29, 2017 3:36 am

Hello,

Greeting from E-iceblue.
How is the issue going? Would you please provide the above information? Then we can investigate further and get back to you.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Wed Jan 15, 2020 6:22 pm

Hi,

Here I join a sample of a document that has 5 pages but Spire.doc says 6 from the PageCount property.

One thing that I note is that when I have, as an example, a table in which one column is resized vertically (the column growth automatically) based on the content of a cell, Spire is not able to retrieve the valid number of pages if the growing process change the number of pages.

It would be nice if you can have a workaround for this bug because of it a little bit critical (as usual :D) for my customer.

Thank you very much.

mystcreater
 
Posts: 18
Joined: Tue Sep 29, 2015 12:10 am

Thu Jan 16, 2020 3:49 am

Hello,

Thanks for your post.
Sorry I didn't find any document here. I simulated a Word document based on your description and tested it with the latest Spire.Doc Pack Version:8.1, but I could get the correct page count. If you were using an old version, I suggest that you download the latest version and try again. If your issue still exists, to help us investigate it more accurately, please provide your input file, your full testing code as well as your MS Word version information. You could send them to us via emial (support@e-iceblue.com).

Sincerely,
Rachel
E-iceblue support team
User avatar

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

Thu Jan 16, 2020 12:43 pm

Sorry, I missed the attachment.

I tried to add a file with an invalid extension and I don't noticed the warning message.

Here it is.

Thanks

mystcreater
 
Posts: 18
Joined: Tue Sep 29, 2015 12:10 am

Thu Jan 16, 2020 12:55 pm

Noticed that I've tried with the latest version, 8.1.4.4046 of Spire.doc and it returns 6 from the PageCount property even if the document have 5 pages.

mystcreater
 
Posts: 18
Joined: Tue Sep 29, 2015 12:10 am

Fri Jan 17, 2020 5:56 am

Hello,

Thanks for your sharing.
I opened your Word file in Office 2016 and other lower vesions, but the page count is all 6 rather than 5. However, when opening it in Office 365, the page count is 5. Are you using the Office 365? And after the furthur investigation, we found that some empty paragraphs are not displayed in Office 365, you can refer to the attached screenshot. This should be related to the compatibility of Microsoft Office itself. And when our product calculates the page count, it will count the empty paragraphs together, so the result is 6 pages. Hope you can understand.

Sincerely,
Rachel
E-iceblue support team
User avatar

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

Return to Spire.Doc

cron