use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestPictures method testFastSaved2.
@Test
public void testFastSaved2() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("o_kurs.doc");
// just check that we do not throw Exception
doc.getPicturesTable().getAllPictures();
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestPictures method testFastSaved.
@Test
public void testFastSaved() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("rasp.doc");
// just check that we do not throw Exception
doc.getPicturesTable().getAllPictures();
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestPictures method testTwoImages.
/**
* two jpegs
*/
@Test
public void testTwoImages() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("two_images.doc");
List<Picture> pics = doc.getPicturesTable().getAllPictures();
assertNotNull(pics);
assertEquals(pics.size(), 2);
for (int i = 0; i < pics.size(); i++) {
Picture pic = pics.get(i);
assertNotNull(pic.suggestFileExtension());
assertNotNull(pic.suggestFullFileName());
}
Picture picA = pics.get(0);
Picture picB = pics.get(1);
assertEquals("jpg", picA.suggestFileExtension());
assertEquals("png", picB.suggestFileExtension());
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class TestBugs method testBug51890.
/**
* [FIXED] Bug 51902 - Picture.fillRawImageContent -
* ArrayIndexOutOfBoundsException
*/
@Test
public void testBug51890() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug51890.doc");
for (Picture picture : doc.getPicturesTable().getAllPictures()) {
PictureType pictureType = picture.suggestPictureType();
logger.log(POILogger.DEBUG, "Picture at offset " + picture.getStartOffset() + " has type " + pictureType);
}
}
use of org.apache.poi.hwpf.HWPFDocument in project poi by apache.
the class HWPFLister method dumpStyles.
private void dumpStyles() {
if (_doc instanceof HWPFOldDocument) {
System.out.println("Word 95 not supported so far");
return;
}
HWPFDocument hwpfDocument = (HWPFDocument) _doc;
for (int s = 0; s < hwpfDocument.getStyleSheet().numStyles(); s++) {
StyleDescription styleDescription = hwpfDocument.getStyleSheet().getStyleDescription(s);
if (styleDescription == null)
continue;
System.out.println("=== Style #" + s + " '" + styleDescription.getName() + "' ===");
System.out.println(styleDescription);
if (styleDescription.getPAPX() != null)
dumpSprms(new SprmIterator(styleDescription.getPAPX(), 2), "Style's PAP SPRM: ");
if (styleDescription.getCHPX() != null)
dumpSprms(new SprmIterator(styleDescription.getCHPX(), 0), "Style's CHP SPRM: ");
}
}
Aggregations