Package org.apache.poi.xssf.usermodel

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


    static Workbook createEmptyWorkbookFor(String path) {
        if (isHssf(path)) {
            return new HSSFWorkbook();
        } else if (isXssf(path)) {
            return new XSSFWorkbook();
        } else {
            return new HSSFWorkbook();
        }
    }
View Full Code Here


     * @see org.apache.poi.xssf.extractor.XSSFExcelExtractor#getText()
     */
    @Override
    protected void buildXHTML(XHTMLContentHandler xhtml) throws SAXException,
            XmlException, IOException {
        XSSFWorkbook document = (XSSFWorkbook) extractor.getDocument();

        for (int i = 0; i < document.getNumberOfSheets(); i++) {
            xhtml.startElement("div");
            XSSFSheet sheet = (XSSFSheet) document.getSheetAt(i);
            xhtml.element("h1", document.getSheetName(i));

            // Header(s), if present
            extractHeaderFooter(sheet.getFirstHeader(), xhtml);
            extractHeaderFooter(sheet.getOddHeader(), xhtml);
            extractHeaderFooter(sheet.getEvenHeader(), xhtml);
View Full Code Here

  public void testExcel() throws Exception {
    File f = new File(dirname, "ExcelWithAttachments.xlsx");
    assertTrue(f.exists());
   
    POIXMLDocument doc = new XSSFWorkbook(OPCPackage.open(f.toString()));
    test(doc, 4);
  }
View Full Code Here

 
  public void testGetFromMainExtractor() throws Exception {
    OPCPackage pkg = OPCPackage.open(
        (new File(dirname, "ExcelWithAttachments.xlsx")).toString()
    );
    XSSFWorkbook wb = new XSSFWorkbook(pkg);

    XSSFExcelExtractor ext = new XSSFExcelExtractor(wb);
    POIXMLPropertiesTextExtractor textExt = ext.getMetadataTextExtractor();
   
    // Check basics
View Full Code Here

  public void testCore() throws Exception {
    OPCPackage pkg = OPCPackage.open(
        (new File(dirname, "ExcelWithAttachments.xlsx")).toString()
    );
    XSSFWorkbook wb = new XSSFWorkbook(pkg);
   
    POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(wb);
    ext.getText();
   
    // Now check
View Full Code Here

 
  public void testExtended() throws Exception {
    OPCPackage pkg = OPCPackage.open(
        (new File(dirname, "ExcelWithAttachments.xlsx")).toString()
    );
    XSSFWorkbook wb = new XSSFWorkbook(pkg);
   
    POIXMLPropertiesTextExtractor ext = new POIXMLPropertiesTextExtractor(wb);
    ext.getText();
   
    // Now check
View Full Code Here

public class XSSFTestDataSamples {
  public static final XSSFWorkbook openSampleWorkbook(String sampleName) {
    InputStream is = HSSFTestDataSamples.openSampleFileStream(sampleName);
    try {
      OPCPackage pkg = OPCPackage.open(is);
      return new XSSFWorkbook(pkg);
    } catch (InvalidFormatException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
View Full Code Here

                tmp.deleteOnExit();
                FileOutputStream out = new FileOutputStream(tmp);
                wb.write(out);
                out.close();
                OPCPackage pkg = OPCPackage.open(tmp.getAbsolutePath());
          result = new XSSFWorkbook(pkg);
        } else {
          throw new RuntimeException("Unexpected workbook type ("
              + wb.getClass().getName() + ")");
        }
    } catch (InvalidFormatException e) {
View Full Code Here

        return XSSFTestDataSamples.writeOutAndReadBack((XSSFWorkbook)original);
    }

    public XSSFWorkbook createWorkbook(){
        return new XSSFWorkbook();
    }
View Full Code Here

  private boolean formulasNotResults = false;
  private boolean includeCellComments = false;
  private boolean includeHeadersFooters = true;
 
  public XSSFExcelExtractor(String path) throws XmlException, OpenXML4JException, IOException {
    this(new XSSFWorkbook(path));
  }
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.