Package org.apache.poi.xssf.usermodel

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


        wb.dispose();

        //Test escaping of Unicode control characters
        wb = new SXSSFWorkbook();
        wb.createSheet("S1").createRow(0).createCell(0).setCellValue("value\u0019");
        XSSFWorkbook xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
        Cell cell = xssfWorkbook.getSheet("S1").getRow(0).getCell(0);
        assertEquals("value?", cell.getStringCellValue());

        wb.dispose();

    }
View Full Code Here


                Cell cell3 = row.createCell(2);
                cell3.setCellValue(j);
            }
        }

        XSSFWorkbook xwb = (XSSFWorkbook)SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
        for(int i = 0; i < sheetNum; i++){
            Sheet sh = xwb.getSheetAt(i);
            assertEquals("sheet" + i, sh.getSheetName());
            for(int j = 0; j < rowNum; j++){
                Row row = sh.getRow(j);
                assertNotNull("row[" + j + "]", row);
                Cell cell1 = row.getCell(0);
View Full Code Here

    // currently writing the same sheet multiple times is not supported...
  public void DISABLEDtestBug53515() throws Exception {
    Workbook wb = new SXSSFWorkbook(10);
    populateWorkbook(wb);
    saveTwice(wb);
    wb = new XSSFWorkbook();
    populateWorkbook(wb);
    saveTwice(wb);
  }
View Full Code Here

*/
public final class TestXSSFExportToXML extends TestCase {

  public void testExportToXML() throws Exception {

    XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("CustomXMLMappings.xlsx");

    for (POIXMLDocumentPart p : wb.getRelations()) {

      if (!(p instanceof MapInfo)) {
        continue;
      }
      MapInfo mapInfo = (MapInfo) p;
View Full Code Here

    }
  }

  public void testExportToXMLInverseOrder() throws Exception {

    XSSFWorkbook wb = XSSFTestDataSamples
        .openSampleWorkbook("CustomXmlMappings-inverse-order.xlsx");

    MapInfo mapInfo = null;

    for (POIXMLDocumentPart p : wb.getRelations()) {

      if (!(p instanceof MapInfo)) {
        continue;
      }
      mapInfo = (MapInfo) p;
View Full Code Here

    }
  }

  public void testXPathOrdering() {

    XSSFWorkbook wb = XSSFTestDataSamples
        .openSampleWorkbook("CustomXmlMappings-inverse-order.xlsx");

    MapInfo mapInfo = null;

    for (POIXMLDocumentPart p : wb.getRelations()) {

      if (p instanceof MapInfo) {
        mapInfo = (MapInfo) p;

        XSSFMap map = mapInfo.getXSSFMapById(1);
View Full Code Here

    }
  }

  public void testMultiTable() throws Exception {

    XSSFWorkbook wb = XSSFTestDataSamples
        .openSampleWorkbook("CustomXMLMappings-complex-type.xlsx");

    for (POIXMLDocumentPart p : wb.getRelations()) {

      if (p instanceof MapInfo) {
        MapInfo mapInfo = (MapInfo) p;

        XSSFMap map = mapInfo.getXSSFMapById(2);
View Full Code Here

    }
  }

    public void test55850ComplexXmlExport() throws Exception {

        XSSFWorkbook wb = XSSFTestDataSamples
                .openSampleWorkbook("55850.xlsx");

        for (POIXMLDocumentPart p : wb.getRelations()) {

            if (!(p instanceof MapInfo)) {
                continue;
            }
            MapInfo mapInfo = (MapInfo) p;
View Full Code Here

        assertEquals("???<>\t\n\u00a0 &\"POI\'\u2122", wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue());

    }

    public void testEncodingbeloAscii(){
        Workbook xwb = new XSSFWorkbook();
        Cell xCell = xwb.createSheet().createRow(0).createCell(0);

        Workbook swb = SXSSFITestDataProvider.instance.createWorkbook();
        Cell sCell = swb.createSheet().createRow(0).createCell(0);

        StringBuffer sb = new StringBuffer();
        // test all possible characters
        for(int i = 0; i < Character.MAX_VALUE; i++) sb.append((char)i) ;

        String str = sb.toString();

        xCell.setCellValue(str);
        assertEquals(str, xCell.getStringCellValue());
        sCell.setCellValue(str);
        assertEquals(str, sCell.getStringCellValue());

        xwb = XSSFITestDataProvider.instance.writeOutAndReadBack(xwb);
        swb = SXSSFITestDataProvider.instance.writeOutAndReadBack(swb);
        xCell = xwb.getSheetAt(0).createRow(0).createCell(0);
        sCell = swb.getSheetAt(0).createRow(0).createCell(0);

        assertEquals(xCell.getStringCellValue(), sCell.getStringCellValue());

    }
View Full Code Here

            Cell sCell = swb.createSheet().createRow(0).createCell(0);
            sCell.setCellValue(str);
            assertEquals(sCell.getStringCellValue(), str);

            // read back as XSSF and check that xml:spaces="preserve" is set
            XSSFWorkbook xwb = (XSSFWorkbook)SXSSFITestDataProvider.instance.writeOutAndReadBack(swb);
            XSSFCell xCell = xwb.getSheetAt(0).getRow(0).getCell(0);

            CTRst is = xCell.getCTCell().getIs();
            XmlCursor c = is.newCursor();
            c.toNextToken();
            String t = c.getAttributeText(new QName("http://www.w3.org/XML/1998/namespace", "space"));
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.