Package org.apache.poi.hpsf

Examples of org.apache.poi.hpsf.Section


            SummaryInformation.DEFAULT_STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Assert.assertTrue(psa[0].isSummaryInformation());

        final Section s = (Section) (psa[0].getSections().get(0));
        Object p1 = s.getProperty(PropertyIDMap.PID_AUTHOR);
        Object p2 = s.getProperty(PropertyIDMap.PID_TITLE);
        Assert.assertEquals(AUTHOR, p1);
        Assert.assertEquals(TITLE, p2);
    }
View Full Code Here


                }
            },
            STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Section s = (Section) (psa[0].getSections().get(0));
        assertEquals(s.getFormatID(), formatID);
        Object p = s.getProperty(2);
        Assert.assertEquals(SECTION1, p);
        s = (Section) (psa[0].getSections().get(1));
        p = s.getProperty(2);
        Assert.assertEquals(SECTION2, p);
    }
View Full Code Here

            out.close();
            byte[] bytes = out.toByteArray();

            PropertySet psr = new PropertySet(bytes);
            assertTrue(psr.isSummaryInformation());
            Section sr = (Section) psr.getSections().get(0);
            String title = (String) sr.getProperty(PropertyIDMap.PID_TITLE);
            assertEquals(TITLE, title);
        }
        catch (WritingNotSupportedException e)
        {
            t = e;
View Full Code Here

        byte[] b = poiFile.getBytes();
        PropertySet ps =
            PropertySetFactory.create(new ByteArrayInputStream(b));
        Assert.assertTrue(ps.isDocumentSummaryInformation());
        Assert.assertEquals(ps.getSectionCount(), 2);
        Section s = (Section) ps.getSections().get(1);
        Assert.assertEquals(s.getProperty(1),
                            new Integer(Constants.CP_UTF16));
        Assert.assertEquals(s.getProperty(2),
                            new Integer(-96070278));
        Assert.assertEquals(s.getProperty(3),
                            "MCon_Info zu Office bei Schreiner");
        Assert.assertEquals(s.getProperty(4),
                            "petrovitsch@schreiner-online.de");
        Assert.assertEquals(s.getProperty(5),
                            "Petrovitsch, Wilhelm");
    }
View Full Code Here

    {
        final SummaryInformation si = (SummaryInformation)
            PropertySetFactory.create(new ByteArrayInputStream
                (poiFiles[0].getBytes()));
        final List sections = si.getSections();
        final Section s = (Section) sections.get(0);
        Assert.assertTrue(org.apache.poi.hpsf.Util.equal
            (s.getFormatID().getBytes(), SectionIDMap.SUMMARY_INFORMATION_ID));
        Assert.assertNotNull(s.getProperties());
        Assert.assertEquals(17, s.getPropertyCount());
        Assert.assertEquals("Titel", s.getProperty(2));
        Assert.assertEquals(1748, s.getSize());
    }
View Full Code Here

    {
        final StringBuffer b = new StringBuffer();
        int count = 1;
        for (Iterator i = sections.iterator(); i.hasNext();)
        {
            Section s = (Section) i.next();
            String d = toString(s, "Section " + count++);
            b.append(d);
        }
        return b.toString();
    }
View Full Code Here

    {
        final StringBuffer b = new StringBuffer();
        int count = 1;
        for (Iterator i = sections.iterator(); i.hasNext();)
        {
            Section s = (Section) i.next();
            String d = toString(s, "Section " + count++);
            b.append(d);
        }
        return b.toString();
    }
View Full Code Here

            List sections = ps.getSections();
            int nr = 0;
            for (Iterator i = sections.iterator(); i.hasNext();)
            {
                /* Print a single section: */
                Section sec = (Section) i.next();
                out("   Section " + nr++ + ":");
                String s = hex(sec.getFormatID().getBytes());
                s = s.substring(0, s.length() - 1);
                out("      Format ID: " + s);

                /* Print the number of properties in this section. */
                int propertyCount = sec.getPropertyCount();
                out("      No. of properties: " + propertyCount);

                /* Print the properties: */
                Property[] properties = sec.getProperties();
                for (int i2 = 0; i2 < properties.length; i2++)
                {
                    /* Print a single property: */
                    Property p = properties[i2];
                    long id = p.getID();
View Full Code Here

            SummaryInformation.DEFAULT_STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Assert.assertTrue(psa[0].isSummaryInformation());

        final Section s = (Section) (psa[0].getSections().get(0));
        Object p1 = s.getProperty(PropertyIDMap.PID_AUTHOR);
        Object p2 = s.getProperty(PropertyIDMap.PID_TITLE);
        Assert.assertEquals(AUTHOR, p1);
        Assert.assertEquals(TITLE, p2);
    }
View Full Code Here

                }
            },
            STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Section s = (Section) (psa[0].getSections().get(0));
        assertEquals(s.getFormatID(), formatID);
        Object p = s.getProperty(2);
        Assert.assertEquals(SECTION1, p);
        s = (Section) (psa[0].getSections().get(1));
        p = s.getProperty(2);
        Assert.assertEquals(SECTION2, p);
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hpsf.Section

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.