Examples of HSSFEventFactory


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

    TextListener tl = new TextListener();
    FormatTrackingHSSFListener ft = new FormatTrackingHSSFListener(tl);
    tl._ft = ft;

    // Register and process
    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();
    request.addListenerForAllRecords(ft);

    factory.processWorkbookEvents(request, _dir);

    return tl;
  }
View Full Code Here

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

    //  look out for the title records
    ChartTitleFormatRecordGrabber grabber = new ChartTitleFormatRecordGrabber();
    InputStream din = fs.createDocumentInputStream("Workbook");
    HSSFRequest req = new HSSFRequest();
    req.addListenerForAllRecords(grabber);
    HSSFEventFactory factory = new HSSFEventFactory();
    factory.processEvents(req, din);
    din.close();
   
    // Should've found one
    assertEquals(1, grabber.chartTitleFormatRecords.size());
    // And it should be of something interesting
View Full Code Here

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

    TextListener tl = new TextListener();
    FormatTrackingHSSFListener ft = new FormatTrackingHSSFListener(tl);
    tl.ft = ft;

    // Register and process
    HSSFEventFactory factory = new HSSFEventFactory();
    HSSFRequest request = new HSSFRequest();
    request.addListenerForAllRecords(ft);

    factory.processWorkbookEvents(request, fs);

    return tl;
  }
View Full Code Here

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

   */
  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.HSSFEventFactory

            HSSFRequest req = new HSSFRequest();

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


            //把最后剩下的不足batchSize大小
            if (dataList.size() > 0) {
                proxy.doBatchSave(dataList);
View Full Code Here

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

    AbortableCountingListener l = new AbortableCountingListener(1000);

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

    HSSFEventFactory f = new HSSFEventFactory();

    assertEquals(0, l.countSeen);
    assertEquals(null, l.lastRecordSeen);

    POIFSFileSystem fs = openSample();
    short res = f.abortableProcessWorkbookEvents(req, fs);

    assertEquals(0, res);
    assertEquals(175, l.countSeen);
    assertEquals(EOFRecord.sid, l.lastRecordSeen.getSid());
  }
View Full Code Here

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

    AbortableCountingListener l = new AbortableCountingListener(1);

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

    HSSFEventFactory f = new HSSFEventFactory();

    assertEquals(0, l.countSeen);
    assertEquals(null, l.lastRecordSeen);

    POIFSFileSystem fs = openSample();
    short res = f.abortableProcessWorkbookEvents(req, fs);

    assertEquals(1234, res);
    assertEquals(1, l.countSeen);
    assertEquals(BOFRecord.sid, l.lastRecordSeen.getSid());
  }
View Full Code Here

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

   */
  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.HSSFEventFactory

        // 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
        fin.close();
        // and our document input stream (don't want to leak these!)
        din.close();
        System.out.println("done.");
View Full Code Here

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

   */
  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
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.