Package org.openxmlformats.schemas.spreadsheetml.x2006.main

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


       if(! worksheet.isSetTableParts()) {
          worksheet.addNewTableParts();
       }
      
       CTTableParts tblParts = worksheet.getTableParts();
       CTTablePart tbl = tblParts.addNewTablePart();
      
       // Table numbers need to be unique in the file, not just
       //  unique within the sheet. Find the next one
       int tableNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.TABLE.getContentType()).size() + 1;
       XSSFTable table = (XSSFTable)createRelationship(XSSFRelation.TABLE, XSSFFactory.getInstance(), tableNumber);
       tbl.setId(table.getPackageRelationship().getId());
      
       tables.put(tbl.getId(), table);
      
       return table;
    }
View Full Code Here


    public XSSFTable createTable() {
       if(! worksheet.isSetTableParts()) {
          worksheet.addNewTableParts();
       }
      
       CTTableParts tblParts = worksheet.getTableParts();
       CTTablePart tbl = tblParts.addNewTablePart();
      
       // Table numbers need to be unique in the file, not just
       //  unique within the sheet. Find the next one
       int tableNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.TABLE.getContentType()).size() + 1;
       XSSFTable table = (XSSFTable)createRelationship(XSSFRelation.TABLE, XSSFFactory.getInstance(), tableNumber);
View Full Code Here

     * Create a new CTWorksheet instance with all values set to defaults
     *
     * @return a new instance
     */
    private static CTWorksheet newSheet(){
        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
        CTSheetFormatPr ctFormat = worksheet.addNewSheetFormatPr();
        ctFormat.setDefaultRowHeight(15.0);

        CTSheetView ctView = worksheet.addNewSheetViews().addNewSheetView();
        ctView.setWorkbookViewId(0);

        worksheet.addNewDimension().setRef("A1");

        worksheet.addNewSheetData();

        CTPageMargins ctMargins = worksheet.addNewPageMargins();
        ctMargins.setBottom(0.75);
        ctMargins.setFooter(0.3);
        ctMargins.setHeader(0.3);
        ctMargins.setLeft(0.7);
        ctMargins.setRight(0.7);
View Full Code Here

    }

    return new XSSFCellStyle(idx, styleXfId, this, theme);
  }
  public int putStyle(XSSFCellStyle style) {
    CTXf mainXF = style.getCoreXf();

    if(! xfs.contains(mainXF)) {
      xfs.add(mainXF);
    }
    return xfs.indexOf(mainXF);
View Full Code Here

    fills.add(new XSSFCellFill(ctFill[1]));

    CTBorder ctBorder = createDefaultBorder();
    borders.add(new XSSFCellBorder(ctBorder));

    CTXf styleXf = createDefaultXf();
    styleXfs.add(styleXf);
    CTXf xf = createDefaultXf();
    xf.setXfId(0);
    xfs.add(xf);
  }
View Full Code Here

    xf.setXfId(0);
    xfs.add(xf);
  }

  private static CTXf createDefaultXf() {
    CTXf ctXf = CTXf.Factory.newInstance();
    ctXf.setNumFmtId(0);
    ctXf.setFontId(0);
    ctXf.setFillId(0);
    ctXf.setBorderId(0);
    return ctXf;
  }
View Full Code Here

    this.dxfs.add(dxf);
    return this.dxfs.size();
  }

  public XSSFCellStyle createCellStyle() {
    CTXf xf = CTXf.Factory.newInstance();
    xf.setNumFmtId(0);
    xf.setFontId(0);
    xf.setFillId(0);
    xf.setBorderId(0);
    xf.setXfId(0);
    int xfSize = styleXfs.size();
    int indexXf = putCellXf(xf);
    return new XSSFCellStyle(indexXf - 1, xfSize - 1, this, theme);
  }
View Full Code Here

     * the references to fills and borders remain.
     *
     * @return a copy of this style
     */
    public Object clone(){
        CTXf xf = (CTXf)_cellXf.copy();

        int xfSize = _stylesSource._getStyleXfsSize();
        int indexXf = _stylesSource.putCellXf(xf);
        return new XSSFCellStyle(indexXf-1, xfSize-1, _stylesSource, _theme);
    }
View Full Code Here

                final String msg = String.format( "column [%d] is null. Will be ignored ", col );
                log.warn( msg);
                continue;
            }

            final CTXmlColumnPr colPr = tableCol.getXmlColumnPr();

            assert colPr!=null;
            if( colPr==null ) {
                final String msg = String.format( "column pr for column [%d] is null. Will be ignored", col );
                log.warn( msg);
                continue;
            }

            final String xpath = colPr.getXpath();

            assert xpath!=null;
            if( xpath==null ) {
                final String msg = String.format( "xpath attribute for column [%d] is null. Will be ignored", col );
                log.warn( msg);
                continue;
            }

            // PERFORM AN XPATH QUERY
            final String xpathQuery = String.format( "$this%s", xpath );

            XmlObject[] bindValues = xmlSourceObject.selectPath(xpathQuery);

            assert bindValues!=null;
            assert bindValues.length > 0;
            if( bindValues==null ) {
                final String msg = String.format( "no values match for xpath query [%s] for column [%d]. Column will be ignored", xpathQuery, col );
                log.warn( msg);
                continue;
            }


            // FILL SHEET
            int rowNum = endCell.getRow();
           
            int cellType = -1;
            XSSFCellStyle cellStyle = null;

            for( XmlObject value : bindValues ) {

                XSSFRow row = sheet.getRow(rowNum);

                if( row == null ) {
                    row = sheet.createRow(rowNum);
                }

                assert row!=null;
                if( row==null ) {
                    final String msg = String.format( "detected problem to get/create row [%d]. Will be ignored!", rowNum );
                    log.warn( msg);
                    continue;
                }

                final int cellNum = startCell.getCol() + col;

                XSSFCell cell = row.getCell( cellNum, Row.CREATE_NULL_AS_BLANK  );

                assert cell!=null;
                if( cell==null ) {
                    final String msg = String.format( "detected problem to get cell [%d,%d]. Will be ignored!", rowNum, cellNum );
                    log.warn( msg);
                    continue;
                }

                if( cellType!=-1 && cellStyle!=null ) {
                  cell.setCellStyle(cellStyle);
                  cell.setCellType(cellType);
                }
                else {
                  cellStyle = cell.getCellStyle();
                  cellType = cell.getCellType();
                }

                setCellValue( cell, value, colPr.getXmlDataType() );
                //cell.setCellValue( ((SimpleValue)value).getStringValue() );

                ++rowNum;
            }
        }
View Full Code Here

  
   * @param password the password string you wish convert to an {@link STUnsignedShortHex}
   * @return {@link STUnsignedShortHex} that contains Excel hashed password in Hex format
   */
  private STUnsignedShortHex stringToExcelPassword(String password) {
    STUnsignedShortHex hexPassword = STUnsignedShortHex.Factory.newInstance();
    hexPassword.setStringValue(String.valueOf(HexDump.shortToHex(PasswordRecord.hashPassword(password))).substring(2));
    return hexPassword;
  }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlColumnPr

Copyright © 2018 www.massapicom. 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.