Results 1 to 2 of 2
  1. #1
    louisa2012 is offline Member
    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Question Change the font-size from a table in a word-document using poi and XWPF

    Hello :-)

    I change a table in a word-document with poi.
    Anybody haven an idea how could I change the font-size/font of my text in each cell?

    Java Code:
    private void adText2Table(XWPFDocument doc, String text, int row, int cell, int tableIdx) {
    
    		XWPFTableRow xWPFTableRow;
    		XWPFTable table = doc.getTables().get(tableIdx);
    		List<XWPFTableRow> zeile = table.getRows();
    
    		if (zeile.size() >= row + 1) {
    			xWPFTableRow = zeile.get(row);
    		} else {
    			xWPFTableRow = doc.getTables().get(tableIdx).createRow();
    		}
    
    		xWPFTableRow.getCell(cell).setText(text);
    	}
    Best regards and thanks for reading it,

    Louisa

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,008
    Rep Power
    20

    Default Re: Change the font-size from a table in a word-document using poi and XWPF

    The whole API for handling docs in POI is a bit experimental.
    It's never actually come out of the sandbox.

    Anyway, as the XWPFDocument documentation says, you probably need to look OOXML spec, which this structure is based on. That would at least give you an idea where to look. Looks like it might involve paragraphs.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. how can I change font size?
    By rippon in forum AWT / Swing
    Replies: 6
    Last Post: 11-10-2011, 02:42 PM
  2. Regarding color, font and size in table
    By sas in forum New To Java
    Replies: 4
    Last Post: 04-05-2011, 02:59 PM
  3. Replies: 1
    Last Post: 05-06-2010, 09:48 AM
  4. Change the Font Size and Text Position
    By stayfierce in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 05:17 AM
  5. Replies: 4
    Last Post: 02-22-2009, 06:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •