use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestBugs method testCommonCrawlRegression.
@Test
public void testCommonCrawlRegression() throws IOException {
HWPFDocument document = HWPFTestDataSamples.openSampleFile("ca.kwsymphony.www_education_School_Concert_Seat_Booking_Form_2011-12.doc");
document.close();
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestLists method testUnorderedLists.
public void testUnorderedLists() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Lists.doc");
Range r = doc.getRange();
assertEquals(40, r.numParagraphs());
// Normal bullet points
assertEquals("This document has different lists in it for testing\r", r.getParagraph(1).text());
assertEquals("Unordered list 1\r", r.getParagraph(2).text());
assertEquals("UL 2\r", r.getParagraph(3).text());
assertEquals("UL 3\r", r.getParagraph(4).text());
assertEquals("Next up is an ordered list:\r", r.getParagraph(5).text());
assertEquals(9, r.getParagraph(1).getLvl());
assertEquals(9, r.getParagraph(2).getLvl());
assertEquals(9, r.getParagraph(3).getLvl());
assertEquals(9, r.getParagraph(4).getLvl());
assertEquals(9, r.getParagraph(5).getLvl());
assertEquals(0, r.getParagraph(1).getIlvl());
assertEquals(0, r.getParagraph(2).getIlvl());
assertEquals(0, r.getParagraph(3).getIlvl());
assertEquals(0, r.getParagraph(4).getIlvl());
assertEquals(0, r.getParagraph(5).getIlvl());
// Tick bullets
assertEquals("Now for an un-ordered list with a different bullet style:\r", r.getParagraph(9).text());
assertEquals("Tick 1\r", r.getParagraph(10).text());
assertEquals("Tick 2\r", r.getParagraph(11).text());
assertEquals("Multi-level un-ordered list:\r", r.getParagraph(12).text());
assertEquals(9, r.getParagraph(9).getLvl());
assertEquals(9, r.getParagraph(10).getLvl());
assertEquals(9, r.getParagraph(11).getLvl());
assertEquals(9, r.getParagraph(12).getLvl());
assertEquals(0, r.getParagraph(9).getIlvl());
assertEquals(0, r.getParagraph(10).getIlvl());
assertEquals(0, r.getParagraph(11).getIlvl());
assertEquals(0, r.getParagraph(12).getIlvl());
// TODO Test for tick not bullet
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestBugs method test41898.
/**
* [RESOLVED INVALID] 41898 - Word 2003 pictures cannot be extracted
*/
@Test
public void test41898() throws IOException {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug41898.doc");
List<Picture> pics = doc.getPicturesTable().getAllPictures();
assertNotNull(pics);
assertEquals(1, pics.size());
Picture pic = pics.get(0);
assertNotNull(pic.suggestFileExtension());
assertNotNull(pic.suggestFullFileName());
assertNotNull(pic.getContent());
assertNotNull(pic.getRawContent());
/*
* This is a file with empty EMF image, but present Office Drawing
* --sergey
*/
final Collection<OfficeDrawing> officeDrawings = doc.getOfficeDrawingsMain().getOfficeDrawings();
assertNotNull(officeDrawings);
assertEquals(1, officeDrawings.size());
OfficeDrawing officeDrawing = officeDrawings.iterator().next();
assertNotNull(officeDrawing);
assertEquals(1044, officeDrawing.getShapeId());
doc.close();
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestWordToTextConverter method testBug52311.
public void testBug52311() throws Exception {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug52311.doc");
String result = WordToTextConverter.getText(doc);
assertTrue(result.contains("2.1\tHeader 2.1"));
assertTrue(result.contains("2.2\tHeader 2.2"));
assertTrue(result.contains("2.3\tHeader 2.3"));
assertTrue(result.contains("2.3.1\tHeader 2.3.1"));
assertTrue(result.contains("2.99\tHeader 2.99"));
assertTrue(result.contains("2.99.1\tHeader 2.99.1"));
assertTrue(result.contains("2.100\tHeader 2.100"));
assertTrue(result.contains("2.101\tHeader 2.101"));
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestWordToTextConverter method testBug53380_3.
public void testBug53380_3() throws Exception {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug53380_3.doc");
WordToTextConverter.getText(doc);
}
Aggregations