Search in sources :

Example 1 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestExtractorFactory method setUp.

@BeforeClass
public static void setUp() throws Exception {
    POIDataSamples ssTests = POIDataSamples.getSpreadSheetInstance();
    xls = getFileAndCheck(ssTests, "SampleSS.xls");
    xlsx = getFileAndCheck(ssTests, "SampleSS.xlsx");
    xlsxStrict = getFileAndCheck(ssTests, "SampleSS.strict.xlsx");
    xltx = getFileAndCheck(ssTests, "test.xltx");
    xlsEmb = getFileAndCheck(ssTests, "excel_with_embeded.xls");
    xlsb = getFileAndCheck(ssTests, "testVarious.xlsb");
    POIDataSamples wpTests = POIDataSamples.getDocumentInstance();
    doc = getFileAndCheck(wpTests, "SampleDoc.doc");
    doc6 = getFileAndCheck(wpTests, "Word6.doc");
    doc95 = getFileAndCheck(wpTests, "Word95.doc");
    docx = getFileAndCheck(wpTests, "SampleDoc.docx");
    dotx = getFileAndCheck(wpTests, "test.dotx");
    docEmb = getFileAndCheck(wpTests, "word_with_embeded.doc");
    docEmbOOXML = getFileAndCheck(wpTests, "word_with_embeded_ooxml.doc");
    POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    ppt = getFileAndCheck(slTests, "SampleShow.ppt");
    pptx = getFileAndCheck(slTests, "SampleShow.pptx");
    txt = getFileAndCheck(slTests, "SampleShow.txt");
    POIDataSamples dgTests = POIDataSamples.getDiagramInstance();
    vsd = getFileAndCheck(dgTests, "Test_Visio-Some_Random_Text.vsd");
    vsdx = getFileAndCheck(dgTests, "test.vsdx");
    POIDataSamples pubTests = POIDataSamples.getPublisherInstance();
    pub = getFileAndCheck(pubTests, "Simple.pub");
    POIDataSamples olTests = POIDataSamples.getHSMFInstance();
    msg = getFileAndCheck(olTests, "quick.msg");
    msgEmb = getFileAndCheck(olTests, "attachment_test_msg.msg");
    msgEmbMsg = getFileAndCheck(olTests, "attachment_msg_pdf.msg");
}
Also used : POIDataSamples(org.apache.poi.POIDataSamples) BeforeClass(org.junit.BeforeClass)

Example 2 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestBugs method test52400ReadAttachedTNEF.

@Test
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());
}
Also used : POIDataSamples(org.apache.poi.POIDataSamples) MAPIAttribute(org.apache.poi.hmef.attribute.MAPIAttribute) Test(org.junit.Test)

Example 3 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestBugs method test52400ReadSimpleTNEF.

@Test
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."));
}
Also used : POIDataSamples(org.apache.poi.POIDataSamples) MAPIAttribute(org.apache.poi.hmef.attribute.MAPIAttribute) Test(org.junit.Test)

Example 4 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestSlideChangeNotes method init.

@Before
public void init() throws Exception {
    POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
    HSLFSlideShowImpl hss = new HSLFSlideShowImpl(_slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
    ss = new HSLFSlideShow(hss);
}
Also used : POIDataSamples(org.apache.poi.POIDataSamples) Before(org.junit.Before)

Example 5 with POIDataSamples

use of org.apache.poi.POIDataSamples in project poi by apache.

the class TestReWriteSanity method setUp.

@Before
public void setUp() throws Exception {
    POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
    ss = new HSLFSlideShowImpl(pfs);
}
Also used : POIFSFileSystem(org.apache.poi.poifs.filesystem.POIFSFileSystem) POIDataSamples(org.apache.poi.POIDataSamples) HSLFSlideShowImpl(org.apache.poi.hslf.usermodel.HSLFSlideShowImpl) Before(org.junit.Before)

Aggregations

POIDataSamples (org.apache.poi.POIDataSamples)27 Test (org.junit.Test)13 File (java.io.File)7 Before (org.junit.Before)7 HSLFSlideShow (org.apache.poi.hslf.usermodel.HSLFSlideShow)4 TempFile (org.apache.poi.util.TempFile)4 HSLFSlideShowImpl (org.apache.poi.hslf.usermodel.HSLFSlideShowImpl)3 POIFSFileSystem (org.apache.poi.poifs.filesystem.POIFSFileSystem)3 BeforeClass (org.junit.BeforeClass)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 MAPIAttribute (org.apache.poi.hmef.attribute.MAPIAttribute)2 BufferedReader (java.io.BufferedReader)1 FileFilter (java.io.FileFilter)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 SimpleDateFormat (java.text.SimpleDateFormat)1