Examples of CTTable


Examples of org.docx4j.dml.CTTable

   
    graphic.setGraphicData(graphicData);
    graphicData
        .setUri("http://schemas.openxmlformats.org/drawingml/2006/table");
       
    CTTable ctTable = dmlFactory.createCTTable();
    JAXBElement<CTTable> tbl = dmlFactory.createTbl(ctTable);
    graphicData.getAny().add(tbl);
   
    CTTableGrid ctTableGrid = dmlFactory.createCTTableGrid();   
    CTTableCol gridCol = dmlFactory.createCTTableCol();
    ctTable.setTblGrid(ctTableGrid);
    ctTableGrid.getGridCol().add(gridCol);
    ctTableGrid.getGridCol().add(gridCol);
    gridCol.setW(300000);

    CTTableRow ctTableRow = dmlFactory.createCTTableRow();
    ctTableRow.setH(370840);
   
   
    ctTableRow.getTc().add(createTableCell());
    ctTableRow.getTc().add(createTableCell());
   
    for (int i = 0; i < 4; i++) {
      ctTable.getTr().add(ctTableRow);
    }
   
    return graphicFrame;
 
View Full Code Here

Examples of org.docx4j.dml.CTTable

   
    graphic.setGraphicData(graphicData);
    graphicData
        .setUri("http://schemas.openxmlformats.org/drawingml/2006/table");
       
    CTTable ctTable = dmlFactory.createCTTable();
    JAXBElement<CTTable> tbl = dmlFactory.createTbl(ctTable);
    graphicData.getAny().add(tbl);
   
    CTTableGrid ctTableGrid = dmlFactory.createCTTableGrid();   
    CTTableCol gridCol = dmlFactory.createCTTableCol();
    ctTable.setTblGrid(ctTableGrid);
    ctTableGrid.getGridCol().add(gridCol);
    ctTableGrid.getGridCol().add(gridCol);
    gridCol.setW(300000);

    CTTableRow ctTableRow = dmlFactory.createCTTableRow();
    ctTableRow.setH(370840);
   
   
    ctTableRow.getTc().add(createTableCell());
    ctTableRow.getTc().add(createTableCell());
   
    for (int i = 0; i < 4; i++) {
      ctTable.getTr().add(ctTableRow);
    }
   
    return graphicFrame;
 
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable

        SXSSFWorkbook outputWorkbook = new org.apache.poi.xssf.streaming.SXSSFWorkbook(inputWorkbook);
        outputWorkbook.write(new FileOutputStream(outputFile));

        // re-read the saved file and make sure headers in the xml are in the original order
        inputWorkbook = new org.apache.poi.xssf.usermodel.XSSFWorkbook(new FileInputStream(outputFile));
        CTTable ctTable = inputWorkbook.getSheetAt(0).getTables().get(0).getCTTable();
        List<CTTableColumn> ctTableColumnList = ctTable.getTableColumns().getTableColumnList();

        assertEquals("number of headers in xml table should match number of header cells in worksheet",
                headers.size(), ctTableColumnList.size());
        for (int i = 0; i < headers.size(); i++) {
            assertEquals("header name in xml table should match number of header cells in worksheet",
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable

        XSSFSheet sheet = (XSSFSheet) wb.createSheet();
       
        //Create
        XSSFTable table = sheet.createTable();
        table.setDisplayName("Test");      
        CTTable cttable = table.getCTTable();
       
        //Style configurations
        CTTableStyleInfo style = cttable.addNewTableStyleInfo();
        style.setName("TableStyleMedium2");
        style.setShowColumnStripes(false);
        style.setShowRowStripes(true);
       
        //Set which area the table should be placed in
        AreaReference reference = new AreaReference(new CellReference(0, 0),
                new CellReference(2,2));
        cttable.setRef(reference.formatAsString());
        cttable.setId(1);
        cttable.setName("Test");
        cttable.setTotalsRowCount(1);
       
        CTTableColumns columns = cttable.addNewTableColumns();
        columns.setCount(3);
        CTTableColumn column;
        XSSFRow row;
        XSSFCell cell;
        for(int i=0; i<3; i++) {
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable

     */
    private static void processTable( XSSFSheet sheet, PackagePart table, XmlObject xmlSourceObject ) throws IOException, XmlException {

        TableDocument tableXml = TableDocument.Factory.parse(table.getInputStream());

        CTTable sht = tableXml.getTable();

        assert sht!=null;

        final String ref = sht.getRef();

        assert ref!=null;
        if( ref==null ) {
            final String msg = String.format( "ref attribute of table [%] is null!", sht );
            log.error( msg);
            throw new IllegalStateException(msg);
        }

        final String [] cellRef = ref.split(":");

        assert cellRef!=null;
        assert cellRef.length==2;

        if( cellRef==null || cellRef.length!=2 ) {
            final String msg = String.format( "ref value [%s] is not valid !", ref );
            log.error( msg);
            throw new IllegalStateException(msg);
        }

        final CellReference startCell = new CellReference( cellRef[0] );
        final CellReference endCell = new CellReference( cellRef[1] );

        final CTTableColumns columns = sht.getTableColumns();

        assert columns!=null;
        assert columns.getCount()>0;

        if( columns==null || columns.getCount()<=0 ) {
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTTable

        SXSSFWorkbook outputWorkbook = new org.apache.poi.xssf.streaming.SXSSFWorkbook(inputWorkbook);
        outputWorkbook.write(new FileOutputStream(outputFile));

        // re-read the saved file and make sure headers in the xml are in the original order
        inputWorkbook = new org.apache.poi.xssf.usermodel.XSSFWorkbook(new FileInputStream(outputFile));
        CTTable ctTable = inputWorkbook.getSheetAt(0).getTables().get(0).getCTTable();
        CTTableColumn[] ctTableColumnArray = ctTable.getTableColumns().getTableColumnArray();

        assertEquals("number of headers in xml table should match number of header cells in worksheet",
                headers.size(), ctTableColumnArray.length);
        for (int i = 0; i < headers.size(); i++) {
            assertEquals("header name in xml table should match number of header cells in worksheet",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.