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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (4,042)