use of org.apache.poi.ddf.EscherComplexProperty in project poi by apache.
the class TestOfficeDrawings method testWatermark.
/**
* Tests watermark text extraction
*/
public void testWatermark() throws Exception {
HWPFDocument hwpfDocument = HWPFTestDataSamples.openSampleFile("watermark.doc");
OfficeDrawing drawing = hwpfDocument.getOfficeDrawingsHeaders().getOfficeDrawings().iterator().next();
EscherContainerRecord escherContainerRecord = drawing.getOfficeArtSpContainer();
EscherOptRecord officeArtFOPT = escherContainerRecord.getChildById((short) 0xF00B);
EscherComplexProperty gtextUNICODE = (EscherComplexProperty) officeArtFOPT.lookup(0x00c0);
String text = StringUtil.getFromUnicodeLE(gtextUNICODE.getComplexData());
assertEquals("DRAFT CONTRACT\0", text);
}
use of org.apache.poi.ddf.EscherComplexProperty in project poi by apache.
the class HSSFPatriarch method containsChart.
/**
* Does this HSSFPatriarch contain a chart?
* (Technically a reference to a chart, since they
* get stored in a different block of records)
* FIXME - detect chart in all cases (only seems
* to work on some charts so far)
*/
public boolean containsChart() {
// TODO - support charts properly in usermodel
// We're looking for a EscherOptRecord
EscherOptRecord optRecord = (EscherOptRecord) _boundAggregate.findFirstWithId(EscherOptRecord.RECORD_ID);
if (optRecord == null) {
// No opt record, can't have chart
return false;
}
for (Iterator<EscherProperty> it = optRecord.getEscherProperties().iterator(); it.hasNext(); ) {
EscherProperty prop = it.next();
if (prop.getPropertyNumber() == 896 && prop.isComplex()) {
EscherComplexProperty cp = (EscherComplexProperty) prop;
String str = StringUtil.getFromUnicodeLE(cp.getComplexData());
if (str.equals("Chart 1\0")) {
return true;
}
}
}
return false;
}
Aggregations