Package org.apache.poi.poifs.filesystem

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


  // Update our cached copy of the bytes that make up the PPT stream
  _docstream = baos.toByteArray();

  // Write the PPT stream into the POIFS layer
  ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  outFS.createDocument(bais,"PowerPoint Document");


  // Update and write out the Current User atom
  int oldLastUserEditAtomPos = (int)currentUser.getCurrentEditOffset();
  Integer newLastUserEditAtomPos = (Integer)oldToNewPositions.get(new Integer(oldLastUserEditAtomPos));
View Full Code Here


  if (_pictures != null) {
    ByteArrayOutputStream pict = new ByteArrayOutputStream();
    for (int i = 0; i < _pictures.length; i++ ) {
      _pictures[i].write(pict);
    }
    outFS.createDocument(
        new ByteArrayInputStream(pict.toByteArray()), "Pictures"
    );
  }

  // Send the POIFSFileSystem object out to the underlying stream
View Full Code Here

        {
            final ByteArrayOutputStream psStream = new ByteArrayOutputStream();
            ps.write(psStream);
            psStream.close();
            final byte[] streamData = psStream.toByteArray();
            poiFs.createDocument(new ByteArrayInputStream(streamData),
                                 SummaryInformation.DEFAULT_STREAM_NAME);
            poiFs.writeFilesystem(out);
            out.close();
            Assert.fail("Should have thrown a NoFormatIDException.");
        }
View Full Code Here

        final ByteArrayOutputStream psStream = new ByteArrayOutputStream();
        ps.write(psStream);
        psStream.close();
        final byte[] streamData = psStream.toByteArray();
        poiFs.createDocument(new ByteArrayInputStream(streamData),
                             SummaryInformation.DEFAULT_STREAM_NAME);
        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
 
View Full Code Here

        p.setType(Variant.VT_LPWSTR);
        p.setValue(AUTHOR);
        si.setProperty(p);
        si.setProperty(PropertyIDMap.PID_TITLE, Variant.VT_LPSTR, TITLE);
   
        poiFs.createDocument(ps.toInputStream(),
                             SummaryInformation.DEFAULT_STREAM_NAME);
        poiFs.writeFilesystem(out);
        out.close();
   
        /* Read the POIFS: */
 
View Full Code Here

        final MutableSection s2 = new MutableSection();
        s2.setFormatID(formatID);
        s2.setProperty(2, SECTION2);
        ps.addSection(s2);

        poiFs.createDocument(ps.toInputStream(), STREAM_NAME);
        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
View Full Code Here

                final ByteArrayOutputStream psStream =
                    new ByteArrayOutputStream();
                psOut.write(psStream);
                psStream.close();
                final byte[] streamData = psStream.toByteArray();
                poiFs.createDocument(new ByteArrayInputStream(streamData),
                                     psf1[i].getName());
                poiFs.writeFilesystem(out);
            }
            out.close();
View Full Code Here

            s.setDictionary(m);
            s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
            int codepage = Constants.CP_UNICODE;
            s.setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
                          new Integer(codepage));
            poiFs.createDocument(ps1.toInputStream(), "Test");
            poiFs.writeFilesystem(out);
            out.close();

            /* Read back: */
            final POIFile[] psf = Util.readPropertySets(copy);
View Full Code Here

            s.setDictionary(m);
            s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[0]);
            int codepage = 12345;
            s.setProperty(PropertyIDMap.PID_CODEPAGE, Variant.VT_I2,
                          new Integer(codepage));
            poiFs.createDocument(ps1.toInputStream(), "Test");
            poiFs.writeFilesystem(out);
            out.close();
            fail("This testcase did not detect the invalid codepage value.");
        }
        catch (IllegalPropertySetDataException ex)
View Full Code Here

            throws IOException
    {
        byte[] bytes = getBytes();
        POIFSFileSystem fs = new POIFSFileSystem();
     
        fs.createDocument(new ByteArrayInputStream(bytes), "Workbook");

        if (preserveNodes) {
            List excepts = new ArrayList(1);
            excepts.add("Workbook");
            copyNodes(this.poifs,fs,excepts);
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.