You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Raghvender Sundarjee <ra...@gsk.com> on 2012/01/16 10:14:09 UTC

Count Pages in word Doc 2003!!!

Hi,
In Microsoft word 2003 document, below is the code which counts the number of pages in the document.

HWPFDocument wordDoc = new HWPFDocument(fi);
 int noPages = wordDoc.getSummaryInformation().getPageCount();

The count is not always correct and for some of the documents due to "Pagination", it gives the wrong or incorrect result.

Please let me know is it possible to address "Pagination" issue in POI or is there any other means to count exact page numbers of a word document???

Thank You,
Raghv





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Count Pages in word Doc 2003!!!

Posted by haughtycool <ha...@gmail.com>.
I think you can get the sheet count by this way:


Of course this is a very bad solution :))

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/How-to-format-cell-with-mutil-line-in-multi-format-tp5147950p5148244.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Count Pages in word Doc 2003!!!

Posted by Raghvender Sundarjee <ra...@gsk.com>.
Can you explain me with a sample code, if possible.
I have tried WordToFoConverter and WordToHTMLConverter and finally I got an xml and HTML. What is the attribute in xml or html to discriminate the pages
Please help me out.It is very urgent

Thank You,
Raghv

-----Original Message-----
From: Sergey Vladimirov [mailto:vlsergey@gmail.com] 
Sent: 16 January 2012 09:20
To: POI Users List
Subject: Re: Count Pages in word Doc 2003!!!

Raghv,

Word document doesn't store text pagination, i.e. it is not possible
to count pages or find out what text placed on which page.

Unless you are ready to emulate Word and render all text on pages by
yourself (like using WordToFoConverter and Apache FOP).

Best regards,
Sergey

On Mon, Jan 16, 2012 at 1:14 PM, Raghvender Sundarjee
<ra...@gsk.com> wrote:
> Hi,
> In Microsoft word 2003 document, below is the code which counts the number of pages in the document.
>
> HWPFDocument wordDoc = new HWPFDocument(fi);
>  int noPages = wordDoc.getSummaryInformation().getPageCount();
>
> The count is not always correct and for some of the documents due to "Pagination", it gives the wrong or incorrect result.
>
> Please let me know is it possible to address "Pagination" issue in POI or is there any other means to count exact page numbers of a word document???
>
> Thank You,
> Raghv
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>



-- 
Sergey Vladimirov

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org



Re: Count Pages in word Doc 2003!!!

Posted by Sergey Vladimirov <vl...@gmail.com>.
Raghv,

Word document doesn't store text pagination, i.e. it is not possible
to count pages or find out what text placed on which page.

Unless you are ready to emulate Word and render all text on pages by
yourself (like using WordToFoConverter and Apache FOP).

Best regards,
Sergey

On Mon, Jan 16, 2012 at 1:14 PM, Raghvender Sundarjee
<ra...@gsk.com> wrote:
> Hi,
> In Microsoft word 2003 document, below is the code which counts the number of pages in the document.
>
> HWPFDocument wordDoc = new HWPFDocument(fi);
>  int noPages = wordDoc.getSummaryInformation().getPageCount();
>
> The count is not always correct and for some of the documents due to "Pagination", it gives the wrong or incorrect result.
>
> Please let me know is it possible to address "Pagination" issue in POI or is there any other means to count exact page numbers of a word document???
>
> Thank You,
> Raghv
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>



-- 
Sergey Vladimirov

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org