Package org.apache.poi.hpbf

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


    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

   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

   * 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

    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)
    );

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

    assertNotNull(es);
    assertNotNull(eds);

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

    // TODO - check the contents
  }

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

    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
    f = new File(dir, "SampleNewsletter.pub");
    doc = new HPBFDocument(
        new FileInputStream(f)
    );

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

    assertNotNull(es);
    assertNotNull(eds);

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

    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)
    );

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);
    for(int i=0; i<19; i++) {
      assertNotNull(qc.getBits()[i]);
    }
    // Last one is blank
View Full Code Here

    assertEquals(2, qc.getBits()[3].getOptA());
  }

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

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    QCTextBit text = (QCTextBit)qc.getBits()[0];
    String t = text.getText();
    assertTrue(t.startsWith("This is some text on the first page"));
View Full Code Here

    assertTrue(t.endsWith("Within doc to page 1\r"));
  }

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

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    assertTrue(qc.getBits()[9] instanceof Type4);
    assertTrue(qc.getBits()[10] instanceof Type4);
    assertTrue(qc.getBits()[12] instanceof Type8);
View Full Code Here

    assertEquals(0x04, plc12.getPlcValB()[1]);
  }

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

    QuillContents qc = doc.getQuillContents();
    assertEquals(20, qc.getBits().length);

    assertTrue(qc.getBits()[10] instanceof Type4);
    assertTrue(qc.getBits()[11] instanceof Type4);
    assertTrue(qc.getBits()[13] instanceof Type0);
View Full Code Here

TOP

Related Classes of org.apache.poi.hpbf.HPBFDocument

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.