Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 91A8B200B66 for ; Thu, 18 Aug 2016 15:18:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 90429160AAE; Thu, 18 Aug 2016 13:18:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ADB94160AAB for ; Thu, 18 Aug 2016 15:18:29 +0200 (CEST) Received: (qmail 77743 invoked by uid 500); 18 Aug 2016 13:18:28 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 77728 invoked by uid 99); 18 Aug 2016 13:18:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2016 13:18:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 270131A09F6 for ; Thu, 18 Aug 2016 13:18:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.026 X-Spam-Level: X-Spam-Status: No, score=0.026 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-1.426, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id W_LaqtM9Il0t for ; Thu, 18 Aug 2016 13:18:24 +0000 (UTC) Received: from mail.metalexmfg.com (mail.metalexmfg.com [66.42.197.62]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E862A5FB17 for ; Thu, 18 Aug 2016 13:18:23 +0000 (UTC) Received: from EXCHANGE3.exchange2.metalexmfg.com ([fe80::4d44:ea20:4125:b9f3]) by Exchange3.exchange2.metalexmfg.com ([fe80::4d44:ea20:4125:b9f3%13]) with mapi id 14.02.0342.003; Thu, 18 Aug 2016 09:17:44 -0400 From: "Murphy, Mark" To: 'POI Users List' Subject: RE: How to add diagonal up border to a tablecell in word document using XWPF Thread-Topic: How to add diagonal up border to a tablecell in word document using XWPF Thread-Index: AdH5QfSbDqyFIwBcTgSR/nXEHiqlvAAA0ZDwAAJ/DmAAALnR0A== Date: Thu, 18 Aug 2016 13:17:43 +0000 Message-ID: <4CBBBDD7FB566C4DB70EB7A04E0B466FC7A4DA@Exchange3.exchange2.metalexmfg.com> References: <0A4752563AB42545A5BE46515985E6C51CB44740@INBLCORMX01.quest-global.com> <4CBBBDD7FB566C4DB70EB7A04E0B466FC7A4AC@Exchange3.exchange2.metalexmfg.com> <0A4752563AB42545A5BE46515985E6C51CB44765@INBLCORMX01.quest-global.com> In-Reply-To: <0A4752563AB42545A5BE46515985E6C51CB44765@INBLCORMX01.quest-global.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [132.0.5.109] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 archived-at: Thu, 18 Aug 2016 13:18:30 -0000 Ok, I didn't go all the way through it. You need to add attributes to the b= order. CTTc ctTc =3D cell.getCTTc(); CTTcPr ctTcPr =3D ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr(); CTTcBorders ctTcBorders =3D ctTcPr.isSetTcBorders() ? ctTcPr.getTcBorders= () : ctTcPr.addNewTcBorders(); CTBorder ctBorder =3D 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"); =09 This adds a thin red diagonal border. -----Original Message----- From: Krishna Vyas Majji [mailto:krishna.majji@quest-global.com]=20 Sent: Thursday, August 18, 2016 8:55 AM To: POI Users List 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. Alterna= tively 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=3D new XWPFDocument(); //create table XWPFTable table =3D document.createTable(); //create first row XWPFTableRow tableRowOne =3D table.getRow(0); tableRowOne.getCell(0).setText(""); tableRowOne.addNewTableCell().setText("col two, row one"= ); tableRowOne.addNewTableCell().setText("col three, row on= e"); //create second row XWPFTableRow tableRowTwo =3D 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 =3D table.getRow(0).getCell(0); CTTc ctTc =3D cellRow00.getCTTc(); CTTcPr ctTcPr =3D ctTc.isSetTcPr() ? ctTc.getTcPr() : ct= Tc.addNewTcPr(); CTTcBorders ctTcBorders =3D ctTcPr.isSetTcBorders() ? ct= TcPr.getTcBorders() : ctTcPr.addNewTcBorders(); if (!ctTcBorders.isSetTr2Bl()) { ctTcBorders.addNewTr2Bl(); } //Write the Document in file system FileOutputStream out =3D new FileOutputStream(new File("= create_table_example.docx")); document.write(out); out.close(); Thanks, Krishna -----Original Message----- From: Murphy, Mark [mailto:murphymdev@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 wo= rd document using XWPF Here is some code that works its way from the table cell object - cell to a= dd an up diagonal border: CTTc ctTc =3D cell.getCTTc(); CTTcPr ctTcPr =3D ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTc= Pr(); CTTcBorders ctTcBorders =3D ctTcPr.isSetTcBorders() ? ctTcPr.getTcB= orders() : ctTcPr.addNewTcBorders(); if (!ctTcBorders.isSetTr2Bl()) { ctTcBorders.addNewTr2Bl(); } You will need to use the documentation found in Office Open XML Part 4: Mar= kup Language Reference, December 2006 (1st edition) -----Original Message----- From: Krishna Vyas Majji [mailto:krishna.majji@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 usin= g 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=3D new XWPFDocument(); //Write the Document in file system FileOutputStream out =3D new FileOutputStream(new File("cr= eate_table_example.docx")); //create table XWPFTable table =3D document.createTable(); //create first row XWPFTableRow tableRowOne =3D 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 =3D 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-ma= il and delete the original message. Opinions, conclusions and other informa= tion in this transmission that do not relate to the official business of Qu= EST Global and/or its subsidiaries, shall be understood as neither given no= r endorsed by it. Any statements made herein that are tantamount to contrac= tual obligations, promises, claims or commitments shall not be binding on t= he Company unless followed by written confirmation by an authorized signato= ry of the Company. --------------------------------------------------------= --------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional comm= ands, 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-ma= il and delete the original message. Opinions, conclusions and other informa= tion in this transmission that do not relate to the official business of Qu= EST Global and/or its subsidiaries, shall be understood as neither given no= r endorsed by it. Any statements made herein that are tantamount to contrac= tual obligations, promises, claims or commitments shall not be binding on t= he Company unless followed by written confirmation by an authorized signato= ry of the Company. --------------------------------------------------------= --------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional comm= ands, e-mail: user-help@poi.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org