Package org.apache.poi

Examples of org.apache.poi.POIDataSamples


  /**
   * Initialize this test, load up the blank.msg mapi message.
   * @throws Exception
   */
  public TestSimpleFileRead() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
  }
View Full Code Here


  /**
   * Initialize this test, load up the blank.msg mapi message.
   */
  public TestBlankFileRead() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("blank.msg"));
  }
View Full Code Here

   * Initialize this test, load up the messages.
   *
   * @throws Exception
   */
  public TestFixedSizedProperties() throws Exception {
    POIDataSamples samples = POIDataSamples.getHSMFInstance();
    this.mapiMessageSucceeds = new MAPIMessage(
        samples.openResourceAsStream(messageSucceeds));
    this.mapiMessageFails = new MAPIMessage(
        samples.openResourceAsStream(messageFails));   
    this.fsMessageSucceeds = new POIFSFileSystem(new FileInputStream(samples.getFile(messageSucceeds)));
    this.fsMessageFails = new POIFSFileSystem(new FileInputStream(samples.getFile(messageFails)));
  }
View Full Code Here

    * Initialize this test, load up the attachment_test_msg.msg mapi message.
    *
    * @throws Exception
    */
   public TestFileWithAttachmentsRead() throws IOException {
      POIDataSamples samples = POIDataSamples.getHSMFInstance();
      this.twoSimpleAttachments = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
      this.pdfMsgAttachments = new MAPIMessage(samples.openResourceAsStream("attachment_msg_pdf.msg"));
   }
View Full Code Here

  /**
   * Initialize this test, load up the blank.msg mapi message.
   * @throws Exception
   */
  public TestOutlook30FileRead() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
  }
View Full Code Here

*
* @author Yegor Kozlov
*/
public final class TestSound extends TestCase {
  public void testRealFile() throws Exception {
        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();

    SlideShow ppt = new SlideShow(slTests.openResourceAsStream("sound.ppt"));

    // Get the document
    Document doc = ppt.getDocumentRecord();
    SoundCollection soundCollection = null;
    Record[] doc_ch = doc.getChildRecords();
    for (int i = 0; i < doc_ch.length; i++) {
      if (doc_ch[i] instanceof SoundCollection) {
        soundCollection = (SoundCollection) doc_ch[i];
        break;
      }
    }
    if (soundCollection == null) {
      throw new AssertionFailedError("soundCollection must not be null");
    }

    Sound sound = null;
    Record[] sound_ch = soundCollection.getChildRecords();
    int k = 0;
    for (int i = 0; i < sound_ch.length; i++) {
      if (sound_ch[i] instanceof Sound) {
        sound = (Sound) sound_ch[i];
        k++;
      }
    }
    if (sound == null) {
      throw new AssertionFailedError("sound must not be null");
    }
    assertEquals(1, k);

    assertEquals("ringin.wav", sound.getSoundName());
    assertEquals(".WAV", sound.getSoundType());
    assertNotNull(sound.getSoundData());

    byte[] ref_data = slTests.readFile("ringin.wav");
    assertTrue(Arrays.equals(ref_data, sound.getSoundData()));
  }
View Full Code Here

  /**
   * Initialize this test, load up the blank.msg mapi message.
   * @throws Exception
   */
  public TestBasics() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    simple = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
      quick  = new MAPIMessage(samples.openResourceAsStream("quick.msg"));
      outlook30  = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
      attachments = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
      noRecipientAddress = new MAPIMessage(samples.openResourceAsStream("no_recipient_address.msg"));
      unicode = new MAPIMessage(samples.openResourceAsStream("example_received_unicode.msg"));
      cyrillic = new MAPIMessage(samples.openResourceAsStream("cyrillic_message.msg"));
      chinese = new MAPIMessage(samples.openResourceAsStream("chinese-traditional.msg"));
  }
View Full Code Here

  /**
   * Initialize this test, load up the blank.msg mapi message.
   * @throws Exception
   */
  public TestOutlook30FileRead() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    this.mapiMessage = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
  }
View Full Code Here

  /**
   * Initialize this test, load up the blank.msg mapi message.
   * @throws Exception
   */
  public TestBasics() throws IOException {
        POIDataSamples samples = POIDataSamples.getHSMFInstance();
    simple = new MAPIMessage(samples.openResourceAsStream("simple_test_msg.msg"));
      quick  = new MAPIMessage(samples.openResourceAsStream("quick.msg"));
      outlook30  = new MAPIMessage(samples.openResourceAsStream("outlook_30_msg.msg"));
      attachments = new MAPIMessage(samples.openResourceAsStream("attachment_test_msg.msg"));
      noRecipientAddress = new MAPIMessage(samples.openResourceAsStream("no_recipient_address.msg"));
      cyrillic = new MAPIMessage(samples.openResourceAsStream("cyrillic_message.msg"));
  }
View Full Code Here

    String filename2 = "test.doc";
    filename3 = "excel_with_embeded.xls";
    filename4 = "ThreeColHeadFoot.doc";
    filename5 = "HeaderFooterUnicode.doc";
    filename6 = "footnote.doc";
        POIDataSamples docTests = POIDataSamples.getDocumentInstance();
    extractor = new WordExtractor(docTests.openResourceAsStream(filename));
    extractor2 = new WordExtractor(docTests.openResourceAsStream(filename2));

    // Build splat'd out text version
    for(int i=0; i<p_text1.length; i++) {
      p_text1_block += p_text1[i];
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.POIDataSamples

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.