How to insert page break end of each table in Docx

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to insert page break end of each table in Docx

venkatesh
i am trying to insert page break end of end page, but my code is not working

                XWPFDocument doc = new XWPFDocument(OPCPackage.open(filePath));
                int count =0;

          List<XWPFTable> tables = doc.getTables();
               
                    for (XWPFTable table : tables) {
                    doc.createParagraph().createRun().addBreak(BreakType.PAGE);
                        count++;
                    }  
               
                        System.out.println("Total tables in doc "+count);



--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How to insert page break end of each table in Docx

Mark Murphy
This looks like you are creating a page break at the end of the document
for each table in the document. So you will have all your tables, and at
the end of the document, you have a bunch of page breaks.

On Tue, Aug 7, 2018 at 10:57 AM venkatesh <[hidden email]>
wrote:

> i am trying to insert page break end of end page, but my code is not
> working
>
>                 XWPFDocument doc = new
> XWPFDocument(OPCPackage.open(filePath));
>                 int count =0;
>
>                                 List<XWPFTable> tables = doc.getTables();
>
>                         for (XWPFTable table : tables) {
>
> doc.createParagraph().createRun().addBreak(BreakType.PAGE);
>                                 count++;
>                         }
>
>                         System.out.println("Total tables in doc "+count);
>
>
>
> --
> Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>