https://bz.apache.org/bugzilla/show_bug.cgi?id=69501

Thomas Dubuis <thomasdubui...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thomasdubui...@gmail.com

--- Comment #1 from Thomas Dubuis <thomasdubui...@gmail.com> ---
My full code : 



import java.awt.Color;
import java.awt.Rectangle;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.sl.usermodel.TableCell.BorderEdge;
import org.apache.poi.xslf.usermodel.*;

/**
 * pptx Tables
 */
public class Test {

    public static void main(String[] args) throws IOException {
        try (XMLSlideShow ppt = new XMLSlideShow()) {
            // XSLFSlide#createSlide() with no arguments creates a blank slide
            XSLFSlide slide = ppt.createSlide();

            XSLFTable tbl = slide.createTable();
            tbl.setAnchor(new Rectangle(50, 50, 450, 300));

            int numColumns = 3;
            int numRows = 5;
            // rows

            for (int rownum = 0; rownum < numRows; rownum++) {
                XSLFTableRow tr = tbl.addRow();
                tr.setHeight(50);
                // header
                for (int i = 0; i < numColumns; i++) {
                    XSLFTableCell cell = tr.addCell();
                    XSLFTextParagraph p = cell.addNewTextParagraph();
                    XSLFTextRun r = p.addNewTextRun();
                    cell.setBorderWidth(BorderEdge.left, 1.0);
                    cell.setBorderColor(BorderEdge.left, Color.MAGENTA);

                    r.setText("Cell " + (i + 1));
                    if (rownum % 2 == 0)
                        cell.setFillColor(new Color(208, 216, 232));
                    else
                        cell.setFillColor(new Color(233, 247, 244));

                }
            }

            try (FileOutputStream out = new
FileOutputStream("../Output/table.pptx")) {
                ppt.write(out);
            }
        }
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to