Examples of Workbook


Examples of org.apache.poi.ss.usermodel.Workbook

import org.apache.metamodel.excel.ZeroBasedRowIterator;

public class ZeroBasedRowIteratorTest extends TestCase {

  public void testHasNext() throws Exception {
    Workbook workbook = WorkbookFactory.create(new FileInputStream(
        "src/test/resources/xls_single_cell_sheet.xls"));
    Sheet sheet = workbook.getSheetAt(0);

    // POI's row numbers are 0-based also - the last cell in the sheet is
    // actually A6.
    assertEquals(5, sheet.getLastRowNum());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Workbook

    assertTrue(xlsx.exists());
    assertTrue(txt.exists());
  }
 
  public void testCreateNative() throws Exception {
    Workbook wb;
   
    // POIFS -> hssf
    wb = WorkbookFactory.create(
        new POIFSFileSystem(new FileInputStream(xls))
    );
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Workbook

   * Creates the appropriate kind of Workbook, but
   *  checking the mime magic at the start of the
   *  InputStream, then creating what's required.
   */
  public void testCreateGeneric() throws Exception {
    Workbook wb;
   
    // InputStream -> either
    wb = WorkbookFactory.create(
        new FileInputStream(xls)
    );
View Full Code Here

Examples of org.apache.poi.ss.usermodel.Workbook

    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
    public static <R extends Workbook> R writeOutAndReadBack(R wb) {
      Workbook result;
    try {
        if (wb instanceof HSSFWorkbook) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream(8192);
                wb.write(baos);
                InputStream is = new ByteArrayInputStream(baos.toByteArray());
View Full Code Here

Examples of org.openoffice.xmerge.converter.xml.sxc.pexcel.records.Workbook

     */
    protected String getWorkbookName(ConvertData cd)
        throws IOException {

        Enumeration e = cd.getDocumentEnumeration();
    Workbook wb = (Workbook) e.nextElement();

    String workbookName = wb.getName();
        return workbookName;
    }
View Full Code Here

Examples of org.zkoss.poi.ss.usermodel.Workbook

   */
  public static Range range(Worksheet sheet, String reference) {
    AreaReference ref = getAreaReference(sheet, reference);
    if (ref == null) {
      //try NamedRange
      final Workbook wb = sheet.getWorkbook();
        final Name range = wb.getName(reference);
        if (range != null) {
          ref = getAreaReference(sheet, range.getRefersToFormula());
        } else {
          throw new IllegalArgumentException("Cannot find the named range '" + reference + "'");
        }
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.