Examples of HPBFDocument


Examples of org.apache.poi.hpbf.HPBFDocument

    assertEquals("http://poi.apache.org/", hlBit.getHyperlink(0));

  }

  public void testHyperlinkDifferentVersions() throws Exception {
    HPBFDocument doc;
    QuillContents qc;
    Type12 hlBitA;
    Type12 hlBitB;

    // Latest version
    doc = new HPBFDocument(
                _samples.openResourceAsStream("Sample.pub")
    );
    qc = doc.getQuillContents();

    hlBitA = (Type12)qc.getBits()[14];
    assertEquals(2, hlBitA.getNumberOfPLCs());
    assertEquals(2, hlBitA.getNumberOfHyperlinks());

    assertEquals(25, hlBitA.getTextStartAt(0));
    assertEquals(72, hlBitA.getTextStartAt(1));
    assertEquals(87, hlBitA.getAllTextEndAt());
    assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
    assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));

    hlBitB = (Type12)qc.getBits()[15];
    assertEquals(3, hlBitB.getNumberOfPLCs());
    assertEquals(3, hlBitB.getNumberOfHyperlinks());

    assertEquals(27, hlBitB.getTextStartAt(0));
    assertEquals(37, hlBitB.getTextStartAt(1));
    assertEquals(54, hlBitB.getTextStartAt(2));
    assertEquals(75, hlBitB.getAllTextEndAt());
    assertEquals("", hlBitB.getHyperlink(0));
    assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
    assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));

    // 2000 version
    doc = new HPBFDocument(
                _samples.openResourceAsStream("Sample2000.pub")
    );
    qc = doc.getQuillContents();

    hlBitA = (Type12)qc.getBits()[13];
    assertEquals(2, hlBitA.getNumberOfPLCs());
    assertEquals(2, hlBitA.getNumberOfHyperlinks());

    assertEquals(25, hlBitA.getTextStartAt(0));
    assertEquals(72, hlBitA.getTextStartAt(1));
    assertEquals(87, hlBitA.getAllTextEndAt());
    assertEquals("http://poi.apache.org/", hlBitA.getHyperlink(0));
    assertEquals("C:\\Documents and Settings\\Nick\\My Documents\\Booleans.xlsx", hlBitA.getHyperlink(1));

    hlBitB = (Type12)qc.getBits()[14];
    assertEquals(3, hlBitB.getNumberOfPLCs());
    assertEquals(3, hlBitB.getNumberOfHyperlinks());

    assertEquals(27, hlBitB.getTextStartAt(0));
    assertEquals(37, hlBitB.getTextStartAt(1));
    assertEquals(54, hlBitB.getTextStartAt(2));
    assertEquals(75, hlBitB.getAllTextEndAt());
    assertEquals("", hlBitB.getHyperlink(0));
    assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(1));
    assertEquals("mailto:dev@poi.apache.org?subject=HPBF", hlBitB.getHyperlink(2));

    // 98 version
    doc = new HPBFDocument(
                _samples.openResourceAsStream("Sample98.pub")
    );
    qc = doc.getQuillContents();

    hlBitA = (Type12)qc.getBits()[13];
    assertEquals(2, hlBitA.getNumberOfPLCs());
    assertEquals(2, hlBitA.getNumberOfHyperlinks());
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

public final class TestEscherParts extends TestCase {
    private static final POIDataSamples _samples = POIDataSamples.getPublisherInstance();

  public void testBasics() throws Exception {
    HPBFDocument doc = new HPBFDocument(
        _samples.openResourceAsStream("Sample.pub")
    );

    EscherStm es = doc.getEscherStm();
    EscherDelayStm eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(13, es.getEscherRecords().length);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    // TODO - check the contents
  }

  public void testComplex() throws Exception {
    HPBFDocument doc = new HPBFDocument(
                _samples.openResourceAsStream("SampleBrochure.pub")
    );

    EscherStm es = doc.getEscherStm();
    EscherDelayStm eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(30, es.getEscherRecords().length);
    assertEquals(19, eds.getEscherRecords().length);

    // TODO - check contents


    // Now do another complex file
    doc = new HPBFDocument(
                _samples.openResourceAsStream("SampleNewsletter.pub")
    );

    es = doc.getEscherStm();
    eds = doc.getEscherDelayStm();

    assertNotNull(es);
    assertNotNull(eds);

    assertEquals(51, es.getEscherRecords().length);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

  public PLCDumper(HPBFDocument hpbfDoc) {
    doc = hpbfDoc;
    qc = doc.getQuillContents();
  }
  public PLCDumper(POIFSFileSystem fs) throws IOException {
    this(new HPBFDocument(fs));
  }
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

  public PublisherTextExtractor(HPBFDocument doc) {
    super(doc);
    this.doc = doc;
  }
   public PublisherTextExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
      this(new HPBFDocument(dir, fs));
   }
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

  }
   public PublisherTextExtractor(DirectoryNode dir, POIFSFileSystem fs) throws IOException {
      this(new HPBFDocument(dir, fs));
   }
  public PublisherTextExtractor(POIFSFileSystem fs) throws IOException {
    this(new HPBFDocument(fs));
  }
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    dir = System.getProperty("HPBF.testdata.path");
  }

  public void testBasics() throws Exception {
    File f = new File(dir, "Sample.pub");
    HPBFDocument doc = new HPBFDocument(
        new FileInputStream(f)
    );

    PublisherTextExtractor ext =
      new PublisherTextExtractor(doc);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

    ext.getText();
  }
 
  public void testContents() throws Exception {
    File f = new File(dir, "Sample.pub");
    HPBFDocument doc = new HPBFDocument(
        new FileInputStream(f)
    );

    PublisherTextExtractor ext =
      new PublisherTextExtractor(doc);
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

   2000 and Publisher 2007. Check they all agree.
   * @throws Exception
   */
  public void testMultipleVersions() throws Exception {
    File f;
    HPBFDocument doc;
   
    f = new File(dir, "Sample.pub");
    doc = new HPBFDocument(
        new FileInputStream(f)
    );
    String s2007 = (new PublisherTextExtractor(doc)).getText();
   
    f = new File(dir, "Sample2000.pub");
    doc = new HPBFDocument(
        new FileInputStream(f)
    );
    String s2000 = (new PublisherTextExtractor(doc)).getText();
   
    f = new File(dir, "Sample98.pub");
    doc = new HPBFDocument(
        new FileInputStream(f)
    );
    String s98 = (new PublisherTextExtractor(doc)).getText();
   
    // Check they all agree
View Full Code Here

Examples of org.apache.poi.hpbf.HPBFDocument

   * Test that the hyperlink extraction stuff works as well
   *  as we can hope it to.
   */
  public void testWithHyperlinks() throws Exception {
    File f = new File(dir, "LinkAt10.pub");
    HPBFDocument doc = new HPBFDocument(
        new FileInputStream(f)
    );

    PublisherTextExtractor ext =
      new PublisherTextExtractor(doc);
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.