Package org.apache.poi.xssf.usermodel

Examples of org.apache.poi.xssf.usermodel.XSSFWorkbook


    assertEquals(1, st._getStyleXfsSize());
    assertEquals(0, st._getNumberFormatSize());
  }

  public void testCreateSaveLoad() {
    XSSFWorkbook wb = new XSSFWorkbook();
    StylesTable st = wb.getStylesSource();

    assertNotNull(st.getCTStylesheet());
    assertEquals(1, st._getXfsSize());
    assertEquals(1, st._getStyleXfsSize());
    assertEquals(0, st._getNumberFormatSize());
View Full Code Here


       
        assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb));
  }

  public void testLoadExisting() {
    XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook(testFile);
    assertNotNull(workbook.getStylesSource());

    StylesTable st = workbook.getStylesSource();

    doTestExisting(st);
       
        assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(workbook));
  }
View Full Code Here

       
        assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(workbook));
  }

  public void testLoadSaveLoad() {
    XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook(testFile);
    assertNotNull(workbook.getStylesSource());

    StylesTable st = workbook.getStylesSource();
    doTestExisting(st);

    st = XSSFTestDataSamples.writeOutAndReadBack(workbook).getStylesSource();
    doTestExisting(st);
  }
View Full Code Here

    assertEquals("yyyy/mm/dd", st.getStyleAt(3).getDataFormatString());
  }

  public void testPopulateNew() {
    XSSFWorkbook wb = new XSSFWorkbook();
    StylesTable st = wb.getStylesSource();

    assertNotNull(st.getCTStylesheet());
    assertEquals(1, st._getXfsSize());
    assertEquals(1, st._getStyleXfsSize());
    assertEquals(0, st._getNumberFormatSize());
View Full Code Here

       
        assertNotNull(XSSFTestDataSamples.writeOutAndReadBack(wb));
  }

  public void testPopulateExisting() {
    XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook(testFile);
    assertNotNull(workbook.getStylesSource());

    StylesTable st = workbook.getStylesSource();
    assertEquals(11, st._getXfsSize());
    assertEquals(1, st._getStyleXfsSize());
    assertEquals(8, st._getNumberFormatSize());

    int nf1 = st.putNumberFormat("YYYY-mm-dd");
View Full Code Here

    /**
     * Updated named ranges
     */
    public void updateNamedRanges(FormulaShifter shifter) {
        XSSFWorkbook wb = sheet.getWorkbook();
        XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb);
        for (int i = 0; i < wb.getNumberOfNames(); i++) {
            XSSFName name = wb.getNameAt(i);
            String formula = name.getRefersToFormula();
            int sheetIndex = name.getSheetIndex();

            Ptg[] ptgs = FormulaParser.parse(formula, fpb, FormulaType.NAMEDRANGE, sheetIndex);
            if (shifter.adjustFormula(ptgs, sheetIndex)) {
View Full Code Here

    public void updateFormulas(FormulaShifter shifter) {
        //update formulas on the parent sheet
        updateSheetFormulas(sheet, shifter);

        //update formulas on other sheets
        XSSFWorkbook wb = sheet.getWorkbook();
        for (XSSFSheet sh : wb) {
            if (sheet == sh) continue;
            updateSheetFormulas(sh, shifter);
        }
    }
View Full Code Here

     * @return the shifted formula if the formula was changed,
     *         <code>null</code> if the formula wasn't modified
     */
    private static String shiftFormula(XSSFRow row, String formula, FormulaShifter shifter) {
        XSSFSheet sheet = row.getSheet();
        XSSFWorkbook wb = sheet.getWorkbook();
        int sheetIndex = wb.getSheetIndex(sheet);
        XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb);
       
        try {
            Ptg[] ptgs = FormulaParser.parse(formula, fpb, FormulaType.CELL, sheetIndex);
            String shiftedFmla = null;
View Full Code Here

            return formula;
        }
    }

    public void updateConditionalFormatting(FormulaShifter shifter) {
        XSSFWorkbook wb = sheet.getWorkbook();
        int sheetIndex = wb.getSheetIndex(sheet);


        XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(wb);
        List<CTConditionalFormatting> cfList = sheet.getCTWorksheet().getConditionalFormattingList();
        for(int j = 0; j< cfList.size(); j++){
View Full Code Here

        String filename = config.getFileName();
        InputStream ins = config.getInStream();
        Workbook wb = null;
        try {
            if (filename.endsWith(".xlsx")) {
                wb = new XSSFWorkbook(ins);
            } else {
                POIFSFileSystem fs = new POIFSFileSystem(ins);
                wb = new HSSFWorkbook(fs);
            }
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.poi.xssf.usermodel.XSSFWorkbook

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.