Package org.apache.poi

Examples of org.apache.poi.POIDataSamples


  /**
   * 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"));
      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

  private File vsd;

  protected void setUp() throws Exception {
    super.setUp();
   
        POIDataSamples ssTests = POIDataSamples.getSpreadSheetInstance();
        xls = ssTests.getFile("SampleSS.xls");
    xlsx = ssTests.getFile("SampleSS.xlsx");
        xltx = ssTests.getFile("test.xltx");
        xlsEmb = ssTests.getFile("excel_with_embeded.xls");

        POIDataSamples wpTests = POIDataSamples.getDocumentInstance();
    doc = wpTests.getFile("SampleDoc.doc");
    docx = wpTests.getFile("SampleDoc.docx");
        dotx = wpTests.getFile("test.dotx");
        docEmb = wpTests.getFile("word_with_embeded.doc");

        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    ppt = slTests.getFile("SampleShow.ppt");
    pptx = slTests.getFile("SampleShow.pptx");
        txt = slTests.getFile("SampleShow.txt");

        POIDataSamples dgTests = POIDataSamples.getDiagramInstance();
    vsd = dgTests.getFile("Test_Visio-Some_Random_Text.vsd");
  }
View Full Code Here

    public void testReadDocumentSummaryInformation()
            throws FileNotFoundException, IOException,
            NoPropertySetStreamException, MarkUnsupportedException,
            UnexpectedPropertySetTypeException
    {
        POIDataSamples _samples = POIDataSamples.getHPSFInstance();
        final File dataDir = _samples.getFile("");
        final File[] docs = dataDir.listFiles(new FileFilter()
        {
            public boolean accept(final File file)
            {
                return file.isFile() && file.getName().startsWith("Test");
View Full Code Here

     */
    public void testWriteWellKnown() throws IOException,
            NoPropertySetStreamException, MarkUnsupportedException,
            UnexpectedPropertySetTypeException, WritingNotSupportedException
    {
        POIDataSamples _samples = POIDataSamples.getHPSFInstance();
        final File dataDir = _samples.getFile("");
        final File doc1 = new File(dataDir, POI_FS);

        /* Read a test document <em>doc1</em> into a POI filesystem. */
        POIFSFileSystem poifs = new POIFSFileSystem(new FileInputStream(doc1));
        DirectoryEntry dir = poifs.getRoot();
View Full Code Here

                    cp.getValue();
                }
            }
        };

        POIDataSamples _samples = POIDataSamples.getHPSFInstance();
        final File dataDir = _samples.getFile("");
        final File[] docs = dataDir.listFiles(new FileFilter()
        {
            public boolean accept(final File file)
            {
                return file.isFile() && file.getName().startsWith("Test");
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

  private POIFSFileSystem pfsB;
  private POIFSFileSystem pfsC;

    public void setUp() throws Exception {

        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
       
    pfsA = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
    hssA = new HSLFSlideShow(pfsA);

        pfsB = new POIFSFileSystem(slTests.openResourceAsStream("ParagraphStylesShorterThanCharStyles.ppt"));
    hssB = new HSLFSlideShow(pfsB);

        pfsC = new POIFSFileSystem(slTests.openResourceAsStream("WithMacros.ppt"));
    hssC = new HSLFSlideShow(pfsC);
    }
View Full Code Here

import org.apache.poi.hsmf.datatypes.MAPIProperty;
import org.apache.poi.util.LittleEndian;

public class TestBugs extends TestCase {
    public void test52400ReadSimpleTNEF() throws Exception {
        POIDataSamples samples = POIDataSamples.getHMEFInstance();
        String testFile = "bug52400-winmail-simple.dat";
        HMEFMessage tnefDat    = new HMEFMessage(samples.openResourceAsStream(testFile));
        MAPIAttribute bodyHtml = tnefDat.getMessageMAPIAttribute(MAPIProperty.BODY_HTML);
        String bodyStr = new String(bodyHtml.getData(), getEncoding(tnefDat));
        assertTrue(bodyStr.contains("This is the message body."));
    }
View Full Code Here

        String bodyStr = new String(bodyHtml.getData(), getEncoding(tnefDat));
        assertTrue(bodyStr.contains("This is the message body."));
    }
   
    public void test52400ReadAttachedTNEF() throws Exception {
        POIDataSamples samples = POIDataSamples.getHMEFInstance();
        String testFile = "bug52400-winmail-with-attachments.dat";
        HMEFMessage tnefDat    = new HMEFMessage(samples.openResourceAsStream(testFile));
        MAPIAttribute bodyHtml = tnefDat.getMessageMAPIAttribute(MAPIProperty.BODY_HTML);
        String bodyStr = new String(bodyHtml.getData(), getEncoding(tnefDat));
        assertTrue(bodyStr.contains("There are also two attachments."));
        assertEquals(2, tnefDat.getAttachments().size());
    }
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.