Package org.apache.poi.poifs.filesystem

Examples of org.apache.poi.poifs.filesystem.POIFSFileSystem.createDocumentInputStream()


    public void testOK() throws Exception {
        InputStream is = HSSFTestDataSamples.openSampleFileStream("Simple.xls");
        POIFSFileSystem fs = new POIFSFileSystem(is);

        //set POIFS properties before constructing HSSFWorkbook
        SummaryInformation summary1 = (SummaryInformation)PropertySetFactory.create(fs.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME));
        summary1.setTitle(title);

        fs.getRoot().getEntry(SummaryInformation.DEFAULT_STREAM_NAME).delete();
        fs.createDocument(summary1.toInputStream(), SummaryInformation.DEFAULT_STREAM_NAME);
View Full Code Here


        wb.write(out);
        out.close();

        //read the property
        POIFSFileSystem fs2 = new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
        SummaryInformation summary2 = (SummaryInformation)PropertySetFactory.create(fs2.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME));
        assertEquals(title, summary2.getTitle());

    }
}
View Full Code Here

    HSSFWorkbook hssf = new HSSFWorkbook(fs);
   
    // Now process it through eventusermodel, and
    //  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();
View Full Code Here

        DocumentEntry headerProps =
            (DocumentEntry)filesystem.getRoot().getEntry("WordDocument");

        byte[] mainDocument = new byte[headerProps.getSize()];
        filesystem.createDocumentInputStream("WordDocument").read(mainDocument);

        FileInformationBlock fib = new FileInformationBlock(mainDocument);


        results.add(fib);
View Full Code Here

    doc.readProperties();
    doc.writeProperties(outFS);
   
    // Should now hold them
    assertNotNull(
        outFS.createDocumentInputStream("\005SummaryInformation")
    );
    assertNotNull(
        outFS.createDocumentInputStream("\005DocumentSummaryInformation")
    );
  }
View Full Code Here

    // Should now hold them
    assertNotNull(
        outFS.createDocumentInputStream("\005SummaryInformation")
    );
    assertNotNull(
        outFS.createDocumentInputStream("\005DocumentSummaryInformation")
    );
  }

  public void testWriteReadProperties() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

        new File(filename)));

      DocumentEntry documentProps =
        (DocumentEntry) filesystem.getRoot().getEntry("WordDocument");
      _mainStream = new byte[documentProps.getSize()];
      filesystem.createDocumentInputStream("WordDocument").read(_mainStream);

      // use the fib to determine the name of the table stream.
      _fib = new FileInformationBlock(_mainStream);

      String name = "0Table";
View Full Code Here

      // read in the table stream.
      DocumentEntry tableProps =
        (DocumentEntry) filesystem.getRoot().getEntry(name);
      _tableStream = new byte[tableProps.getSize()];
      filesystem.createDocumentInputStream(name).read(_tableStream);

      _fib.fillVariableFields(_mainStream, _tableStream);
    }
    catch (Throwable t)
    {
View Full Code Here

    DocumentEntry docProps =
      (DocumentEntry)filesystem.getRoot().getEntry("VisioDocument");

    // Grab the document stream
    contents = new byte[docProps.getSize()];
    filesystem.createDocumentInputStream("VisioDocument").read(contents);
  }

  /**
   * Test creating the trailer, but not looking for children
   */
 
View Full Code Here

    {
        POIFSFileSystem fs      =
            new POIFSFileSystem(new FileInputStream(file));
        List            records =
            RecordFactory
                .createRecords(fs.createDocumentInputStream("Workbook"));

        for (int k = 0; k < records.size(); k++)
        {
            Record record = ( Record ) records.get(k);
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.