Package org.apache.poi

Examples of org.apache.poi.POIDataSamples


    /**
     * Tests that we can work with both {@link POIFSFileSystem}
     *  and {@link NPOIFSFileSystem}
     */
    public void testDifferentPOIFS() throws Exception {
       POIDataSamples docTests = POIDataSamples.getDocumentInstance();
      
       // Open the two filesystems
       DirectoryNode[] files = new DirectoryNode[2];
       files[0] = (new POIFSFileSystem(docTests.openResourceAsStream("test2.doc"))).getRoot();
       files[1] = (new NPOIFSFileSystem(docTests.getFile("test2.doc"))).getRoot();
      
       // Open directly
       for(DirectoryNode dir : files) {
          WordExtractor extractor = new WordExtractor(dir, null);
          assertEquals(p_text1_block, extractor.getText());
View Full Code Here


   
    /**
     * Test that we can read files at multiple levels down the tree
     */
    public void testReadMultipleTreeLevels() throws Exception {
       final POIDataSamples _samples = POIDataSamples.getPublisherInstance();
       File sample = _samples.getFile("Sample.pub");
      
       DocumentInputStream stream;
      
       NPOIFSFileSystem npoifs = new NPOIFSFileSystem(sample);
       POIFSFileSystem  opoifs = new POIFSFileSystem(new FileInputStream(sample));
View Full Code Here

   */
  public void setUp() throws Exception {
    hss_empty = HSLFSlideShow.create();
    ss_empty = new SlideShow(hss_empty);

        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();

    hss_one = new HSLFSlideShow(slTests.openResourceAsStream("Single_Coloured_Page.ppt"));
    ss_one = new SlideShow(hss_one);

    hss_two = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
    ss_two = new SlideShow(hss_two);
  }
View Full Code Here

        assertEquals(1, s3.length);
    }


    public void test47261() throws Exception {
        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
        SlideShow ppt = new SlideShow(slTests.openResourceAsStream("47261.ppt"));
        Slide[] slides = ppt.getSlides();
        Document doc = ppt.getDocumentRecord();
        assertNotNull(doc.getSlideSlideListWithText());
        assertEquals(14, ppt.getSlides().length);
        int notesId = slides[0].getSlideRecord().getSlideAtom().getNotesID();
View Full Code Here

     * @exception FileNotFoundException if the file to be read does not exist.
     * @exception IOException if any other I/O exception occurs.
     */
    public void setUp() throws IOException
    {
        POIDataSamples samples = POIDataSamples.getHPSFInstance();
        final File data = samples.getFile(POI_FS);
        poiFiles = Util.readPOIFiles(data);
    }
View Full Code Here

   private File pub;

   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");
      doc6 = wpTests.getFile("Word6.doc");
      doc95 = wpTests.getFile("Word95.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");
     
      POIDataSamples pubTests = POIDataSamples.getPublisherInstance();
      pub = pubTests.getFile("Simple.pub");
     
      POIDataSamples olTests = POIDataSamples.getHSMFInstance();
      msg = olTests.getFile("quick.msg");
      msgEmb = olTests.getFile("attachment_test_msg.msg");
      msgEmbMsg = olTests.getFile("attachment_msg_pdf.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

  private HSLFSlideShow ss;
  // POIFS primed on the test data
  private POIFSFileSystem pfs;

    public TestReWriteSanity() throws Exception {
        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    pfs = new POIFSFileSystem(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
    ss = new HSLFSlideShow(pfs);
    }
View Full Code Here

public final class TestRecordCounts extends TestCase {
  // HSLFSlideShow primed on the test data
  private HSLFSlideShow ss;

  public TestRecordCounts() throws Exception {
        POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
    ss = new HSLFSlideShow(slTests.openResourceAsStream("basic_test_ppt_file.ppt"));
  }
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.