How could I get the page count of a document?

Questions and answers on how to use DOCXReadWrite
Post Reply
aristeo
Posts: 9
Joined: Sun Sep 17, 2017 8:47 pm

How could I get the page count of a document?

Post by aristeo »

I'm trying get the page count with this code, but the message returns 0

with TDOCXReadWrite.Create(nil) do
try
LoadFromFile(Path);
ShowMessage(IntToStr(Editor.Pages.Count));
finally
Free;
end;

How could I get the page count of a document? Thanks.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: How could I get the page count of a document?

Post by larsa »

Hello

You must preview the document in order to get the page count. Pages don't exists until the document is paginated.
Lars Arvidsson, Axolot Data
eteoklis
Posts: 31
Joined: Wed Feb 03, 2021 10:42 am

Re: How could I get the page count of a document?

Post by eteoklis »

Hello

Is it possible to <<preview>> the document in order to get the pagination working with out showing the actual preview form?

Thanks in advance
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: How could I get the page count of a document?

Post by larsa »

Hello

Open the file AXWPreviewVcl.pas and take a look at the procedure UpdateUI.
Lars Arvidsson, Axolot Data
eteoklis
Posts: 31
Joined: Wed Feb 03, 2021 10:42 am

Re: How could I get the page count of a document?

Post by eteoklis »

Hello

You have to direct us more. Or send us the code .

Thanks in advance
Post Reply