Package org.apache.poi.hssf.eventusermodel

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


    AbortableCountingListener l = new AbortableCountingListener(1000);
   
    HSSFRequest req = new HSSFRequest();
    req.addListenerForAllRecords(l);
   
    HSSFEventFactory f = new HSSFEventFactory();
   
    assertEquals(0, l.seen);
    assertEquals(null, l.lastseen);
   
    POIFSFileSystem fs = new POIFSFileSystem(new ByteArrayInputStream(
        getTestDataProvider().getTestDataFileContent("SimpleWithColours.xls")
    ));
    short res = f.abortableProcessWorkbookEvents(req, fs);
   
    assertEquals(0, res);
    assertEquals(175, l.seen);
    assertEquals(EOFRecord.sid, l.lastseen.getSid());
  }
View Full Code Here

    AbortableCountingListener l = new AbortableCountingListener(1);
   
    HSSFRequest req = new HSSFRequest();
    req.addListenerForAllRecords(l);
   
    HSSFEventFactory f = new HSSFEventFactory();
   
    assertEquals(0, l.seen);
    assertEquals(null, l.lastseen);
   
    POIFSFileSystem fs = new POIFSFileSystem(new ByteArrayInputStream(
        getTestDataProvider().getTestDataFileContent("SimpleWithColours.xls")
    ));
    short res = f.abortableProcessWorkbookEvents(req, fs);
   
    assertEquals(1234, res);
    assertEquals(1, l.seen);
    assertEquals(BOFRecord.sid, l.lastseen.getSid());
  }
View Full Code Here

            hssfRequest.addListener(listener, HyperlinkRecord.sid);
        }

        // Create event factory and process Workbook (fire events)
        DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
        HSSFEventFactory eventFactory = new HSSFEventFactory();

        eventFactory.processEvents(hssfRequest, documentInputStream);
        listener.throwStoredException();
    }
View Full Code Here

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

                hssfRequest.addListener(formatListener, DrawingGroupRecord.sid);
            }

            // Create event factory and process Workbook (fire events)
            DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
            HSSFEventFactory eventFactory = new HSSFEventFactory();
            try {
                eventFactory.processEvents(hssfRequest, documentInputStream);
            } catch (org.apache.poi.EncryptedDocumentException e) {
                throw new EncryptedDocumentException(e);
            }
           
            // Output any extra text that came after all the sheets
View Full Code Here

            hssfRequest.addListener(listener, HyperlinkRecord.sid);
        }

        // Create event factory and process Workbook (fire events)
        DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
        HSSFEventFactory eventFactory = new HSSFEventFactory();

        eventFactory.processEvents(hssfRequest, documentInputStream);
        listener.throwStoredException();
    }
View Full Code Here

    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

            public void processRecord(Record rec)
            {
                System.out.println(rec.toString());
            }
        });
        HSSFEventFactory factory = new HSSFEventFactory();

        factory.processEvents(req, din);
    }
View Full Code Here

    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

TOP

Related Classes of org.apache.poi.hssf.eventusermodel.HSSFEventFactory

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.