cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vmarv
Regular Visitor

Number of pages in a Docx file

I would like to obtain the number of pages in a DOCX document. Is there anyway?

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @vmarv,

 

You can convert it to a pdf and count the pages with an expression from the $content property (after converting it to a string).

 

Kudos to @Paulie78 for the expression: https://powerusers.microsoft.com/t5/Building-Flows/Number-of-pages-in-a-PDF-file/m-p/932846/highligh...

 

Below is an example of that approach with a docx.

Be aware that Convert action is a part of a premium connector.

 

 

sub(length(split(replace(base64ToString(outputs('Convert_Word_Document_to_PDF')?['body']['$content']), 'Type/Pages', ''), 'Type/Page')),1)

 

 

converttopdf_typepage.png

View solution in original post

2 REPLIES 2
Expiscornovus
Dual Super User
Dual Super User

Hi @vmarv,

 

You can convert it to a pdf and count the pages with an expression from the $content property (after converting it to a string).

 

Kudos to @Paulie78 for the expression: https://powerusers.microsoft.com/t5/Building-Flows/Number-of-pages-in-a-PDF-file/m-p/932846/highligh...

 

Below is an example of that approach with a docx.

Be aware that Convert action is a part of a premium connector.

 

 

sub(length(split(replace(base64ToString(outputs('Convert_Word_Document_to_PDF')?['body']['$content']), 'Type/Pages', ''), 'Type/Page')),1)

 

 

converttopdf_typepage.png

vmarv
Regular Visitor

Thanks! 😁😁😁😁😁😁

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,598)