Ok, you were talking about Word. Word doesn't behave the way you want either, 
but I can have some text left aligned, and other text right aligned to simulate 
the effect you are looking for. I just have to manually ensure the text doesn't 
overlap the diagonal line.

-----Original Message-----
From: Krishna Vyas Majji [mailto:krishna.ma...@quest-global.com] 
Sent: Friday, August 19, 2016 3:23 AM
To: POI Users List <user@poi.apache.org>
Subject: RE: How to add diagonal up border to a tablecell in word document 
using XWPF

Mark,

I think my attachment is not visible. I added "diagonal up border"  in "Row 
One, Column One" Cell.
Now I want to display first string in the top and second string in the bottom 
of the "diagonal up border".
Can you please help me on that.

Thanks and Regards,
Krishna

-----Original Message-----
From: Krishna Vyas Majji
Sent: Friday, August 19, 2016 12:10 PM
To: POI Users List
Subject: Bulk Mail : RE: How to add diagonal up border to a tablecell in word 
document using XWPF

Mark,

Does apache-poi  supports text to be display in the cell in the format I 
attached in the screen-shot.

Thanks,
Krishna

-----Original Message-----
From: Krishna Vyas Majji
Sent: Thursday, August 18, 2016 7:08 POk, You were talking about Word
To: POI Users List
Subject: Bulk Mail : RE: How to add diagonal up border to a tablecell in word 
document using XWPF

Mark,

Thanks a lot. Your code snippet is working.

Regards,
Krishna

-----Original Message-----
From: Murphy, Mark [mailto:murphym...@metalexmfg.com]
Sent: Thursday, August 18, 2016 6:48 PM
To: 'POI Users List'
Subject: Bulk Mail : RE: How to add diagonal up border to a tablecell in word 
document using XWPF

Ok, I didn't go all the way through it. You need to add attributes to the 
border.

                CTTc ctTc = cell.getCTTc();
                CTTcPr ctTcPr = ctTc.isSetTcPr() ? ctTc.getTcPr() : 
ctTc.addNewTcPr();
                CTTcBorders ctTcBorders = ctTcPr.isSetTcBorders() ? 
ctTcPr.getTcBorders() : ctTcPr.addNewTcBorders();
                CTBorder ctBorder = ctTcBorders.isSetTr2Bl() ? 
ctTcBorders.getTr2Bl() : ctTcBorders.addNewTr2Bl();
                ctBorder.setVal(STBorder.Enum.forString("single"));
                ctBorder.setSz(new BigInteger("1"));
                ctBorder.setSpace(new BigInteger("0"));
                ctBorder.setColor("FF0000");

This adds a thin red diagonal border.

-----Original Message-----
From: Krishna Vyas Majji [mailto:krishna.ma...@quest-global.com]
Sent: Thursday, August 18, 2016 8:55 AM
To: POI Users List <user@poi.apache.org>
Subject: RE: How to add diagonal up border to a tablecell in word document 
using XWPF

Mark,

Thanks for the reply. I tried your code snippet but it didn't work. 
Alternatively I will go throw the reference to you provide i.e. " Office Open 
XML Part 4: Markup Language Reference, December 2006 (1st edition)"
My code snippet:

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

                   //create table
                   XWPFTable table = document.createTable();
                   //create first row
                   XWPFTableRow tableRowOne = table.getRow(0);
                   tableRowOne.getCell(0).setText("");
                   tableRowOne.addNewTableCell().setText("col two, row one");
                   tableRowOne.addNewTableCell().setText("col three, 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");
                   tableRowTwo.getCell(2).setText("col three, row two");

                   //Diagonal Border
                   XWPFTableCell cellRow00 = table.getRow(0).getCell(0);
                   CTTc ctTc = cellRow00.getCTTc();
                   CTTcPr ctTcPr = ctTc.isSetTcPr() ? ctTc.getTcPr() : 
ctTc.addNewTcPr();
                   CTTcBorders ctTcBorders = ctTcPr.isSetTcBorders() ? 
ctTcPr.getTcBorders() : ctTcPr.addNewTcBorders();
                   if (!ctTcBorders.isSetTr2Bl()) {
                           ctTcBorders.addNewTr2Bl();
                   }

                                   //Write the Document in file system
                   FileOutputStream out = new FileOutputStream(new 
File("create_table_example.docx"));
                   document.write(out);
                   out.close();

Thanks,
Krishna

-----Original Message-----
From: Murphy, Mark [mailto:murphym...@metalexmfg.com]
Sent: Thursday, August 18, 2016 5:27 PM
To: 'POI Users List'
Subject: Bulk Mail : RE: How to add diagonal up border to a tablecell in word 
document using XWPF

Here is some code that works its way from the table cell object - cell to add 
an up diagonal border:

        CTTc ctTc = cell.getCTTc();
        CTTcPr ctTcPr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
        CTTcBorders ctTcBorders = ctTcPr.isSetTcBorders() ? 
ctTcPr.getTcBorders() : ctTcPr.addNewTcBorders();
        if (!ctTcBorders.isSetTr2Bl()) {
                ctTcBorders.addNewTr2Bl();
        }

You will need to use the documentation found in Office Open XML Part 4: Markup 
Language Reference, December 2006 (1st edition)

-----Original Message-----
From: Krishna Vyas Majji [mailto:krishna.ma...@quest-global.com]
Sent: Thursday, August 18, 2016 7:16 AM
To: user@poi.apache.org
Subject: How to add diagonal up border to a tablecell in word document using 
XWPF

Hello Team,

I created a table with 2 rows and 3 columns using XWPF. Now I want to know if I 
can add "diagonal up border" to a cell in my table.
Something like this.



col two, row one

col three, row one

col one, row two

col two, row two

col three, row two


My code looks like this.

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

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

                 //create table
                 XWPFTable table = document.createTable();

                 //create first row
                 XWPFTableRow tableRowOne = table.getRow(0);
                 tableRowOne.getCell(0).setText("");
                 tableRowOne.addNewTableCell().setText("col two, row one");
                 tableRowOne.addNewTableCell().setText("col three, 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");
                 tableRowTwo.getCell(2).setText("col three, 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-unsubscr...@poi.apache.org For additional 
commands, e-mail: user-h...@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-unsubscr...@poi.apache.org For additional 
commands, e-mail: user-h...@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional 
commands, e-mail: user-h...@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-unsubscr...@poi.apache.org For additional 
commands, e-mail: user-h...@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. 
-----------------------------------------------------------------------------------

---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-unsubscr...@poi.apache.org For additional 
commands, e-mail: user-h...@poi.apache.org


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

Reply via email to