Examples of HSSFRequest


Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

  public void process() throws IOException {
    MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
    formatListener = new FormatTrackingHSSFListener(listener);

    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();

    if(outputFormulaValues) {
      request.addListenerForAllRecords(formatListener);
    } else {
      workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
      request.addListenerForAllRecords(workbookBuildingListener);
    }

    factory.processWorkbookEvents(request, fs);
  }
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

            // 创建 org.apache.poi.poifs.filesystem.Filesystem
            POIFSFileSystem poifs = new POIFSFileSystem(bis);
            // 从输入流 得到 Workbook(excel 部分)流
            dis = poifs.createDocumentInputStream("Workbook");
            // 构造 HSSFRequest
            HSSFRequest req = new HSSFRequest();

            // 添加监听器
            req.addListenerForAllRecords(new Excel2003ImportListener(proxy, dataList, batchSize));
            //  创建事件工厂
            HSSFEventFactory factory = new HSSFEventFactory();
            // 根据文档输入流处理事件
            factory.processEvents(req, dis);
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

  }

  public void testAbortingBasics() throws Exception {
    AbortableCountingListener l = new AbortableCountingListener(1000);

    HSSFRequest req = new HSSFRequest();
    req.addListenerForAllRecords(l);

    HSSFEventFactory f = new HSSFEventFactory();

    assertEquals(0, l.countSeen);
    assertEquals(null, l.lastRecordSeen);
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest


  public void testAbortStops() throws Exception {
    AbortableCountingListener l = new AbortableCountingListener(1);

    HSSFRequest req = new HSSFRequest();
    req.addListenerForAllRecords(l);

    HSSFEventFactory f = new HSSFEventFactory();

    assertEquals(0, l.countSeen);
    assertEquals(null, l.lastRecordSeen);
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

  public void process() throws IOException {
    MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
    formatListener = new FormatTrackingHSSFListener(listener);

    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();

    if(outputFormulaValues) {
      request.addListenerForAllRecords(formatListener);
    } else {
      workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
      request.addListenerForAllRecords(workbookBuildingListener);
    }

    factory.processWorkbookEvents(request, fs);
  }
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

        // create a new org.apache.poi.poifs.filesystem.Filesystem
        POIFSFileSystem poifs = new POIFSFileSystem(fin);
        // get the Workbook (excel part) stream in a InputStream
        InputStream din = poifs.createDocumentInputStream("Workbook");
        // construct out HSSFRequest object
        HSSFRequest req = new HSSFRequest();
        // lazy listen for ALL records with the listener shown above
        req.addListenerForAllRecords(new EventExample());
        // create our event factory
        HSSFEventFactory factory = new HSSFEventFactory();
        // process our events based on the document input stream
        factory.processEvents(req, din);
        // once all the events are processed close our file input stream
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

  public void process() throws IOException {
    MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
    formatListener = new FormatTrackingHSSFListener(listener);

    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();

    if(outputFormulaValues) {
      request.addListenerForAllRecords(formatListener);
    } else {
      workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
      request.addListenerForAllRecords(workbookBuildingListener);
    }

    factory.processWorkbookEvents(request, fs);
  }
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

   * Initiates the processing of the XLS file to CSV
   */
  public void process() throws IOException {
    MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();
    request.addListenerForAllRecords(listener);

    factory.processWorkbookEvents(request, fs);
  }
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

   * Initiates the processing of the XLS file to CSV
   */
  public void process() throws IOException {
    MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();
    request.addListenerForAllRecords(listener);
   
    factory.processWorkbookEvents(request, fs);
  }
View Full Code Here

Examples of org.apache.poi.hssf.eventusermodel.HSSFRequest

                //create a new org.apache.poi.poifs.filesystem.Filesystem
                final POIFSFileSystem poifs = new POIFSFileSystem(source);
                //get the Workbook (excel part) stream in a InputStream
                final InputStream din = poifs.createDocumentInputStream("Workbook");
                //construct out HSSFRequest object
                final HSSFRequest req = new HSSFRequest();
                //lazy listen for ALL records with the listener shown above
                req.addListenerForAllRecords(this);
                //create our event factory
                final HSSFEventFactory factory = new HSSFEventFactory();
                //process our events based on the document input stream
                factory.processEvents(req, din);
                //close our document input stream (don't want to leak these!)
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.