poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krishna Vyas Majji <krishna.ma...@quest-global.com>
Subject RE: Remove space before and after paragraph in table i.e. word document
Date Tue, 23 Aug 2016 09:24:57 GMT
Thanks Mark. Will try that.

-----Original Message-----
From: Murphy, Mark [mailto:murphymdev@metalexmfg.com]
Sent: Monday, August 22, 2016 10:11 PM
To: 'POI Users List'
Subject: Bulk Mail : RE: Remove space before and after paragraph in table i.e. word document

The problem is that when creating table, a row containing a cell containing a paragraph containing
a blank run is already created. Those are the extra blanks you see. When you do cell.addParagraph(),
you are adding a second paragraph. This is not really appropriate behavior, and is likely
to change in the future as the Word API is worked through. However, you need to code to look
for those empty parts in the table cell and just update then if you find them rather than
automatically create new.

-----Original Message-----
From: Krishna Vyas Majji [mailto:krishna.majji@quest-global.com]
Sent: Monday, August 22, 2016 3:07 AM
To: POI Users List <user@poi.apache.org>
Subject: Rmove space before and after paragraph in table i.e. word document

Hi Team,

Good morning,

I am adding a paragraph to a TableRowCell . But it is generating spaces before and after the
paragraph. Please help me how to remove those extra blank lines.
This is my code snippet:


                 //Blank Document
                 XWPFDocument document= new XWPFDocument();

                 //Write the Document in file system
                 FileOutputStream out = new FileOutputStream(new File("create_table.docx"));

                 //create table
                 XWPFTable table = document.createTable();
                 //create first row
                 XWPFTableRow tableRowOne = table.getRow(0);
                 XWPFParagraph paragraph00 = tableRowOne.getCell(0).addParagraph();
                 XWPFRun cell00= paragraph00.createRun();
                 cell00.setBold(true);
                 cell00.setFontFamily("Lao UI");
                 cell00.setText("Hello World");

                 tableRowOne.addNewTableCell().setText("col two, row one");

                 //create second row
                 XWPFTableRow tableRowTwo = table.createRow();
                 tableRowTwo.getCell(0).setText("col one, row two");
                 tableRowTwo.getCell(1).setText("col two, row two");

                 document.write(out);
                 out.close();

Thanks,
Krishna


---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL
INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient,
please notify the sender by e-mail and delete the original message. Opinions, conclusions
and other information in this transmission that do not relate to the official business of
QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by
it. Any statements made herein that are tantamount to contractual obligations, promises, claims
or commitments shall not be binding on the Company unless followed by written confirmation
by an authorized signatory of the Company. -----------------------------------------------------------------------------------

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

---Disclaimer------------------------------ This e-mail contains PRIVILEGED AND CONFIDENTIAL
INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient,
please notify the sender by e-mail and delete the original message. Opinions, conclusions
and other information in this transmission that do not relate to the official business of
QuEST Global and/or its subsidiaries, shall be understood as neither given nor endorsed by
it. Any statements made herein that are tantamount to contractual obligations, promises, claims
or commitments shall not be binding on the Company unless followed by written confirmation
by an authorized signatory of the Company. -----------------------------------------------------------------------------------

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


Mime
View raw message