Java源码示例:org.apache.poi.hssf.record.ObjRecord
示例1
@Override
protected ObjRecord createObjRecord() {
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.setObjectType(OBJECT_TYPE_COMMENT);
c.setLocked(true);
c.setPrintable(true);
c.setAutofill(false);
c.setAutoline(true);
NoteStructureSubRecord u = new NoteStructureSubRecord();
EndSubRecord e = new EndSubRecord();
obj.addSubRecord(c);
obj.addSubRecord(u);
obj.addSubRecord(e);
return obj;
}
示例2
/**
* @return <code>true</code> if the specified record ID terminates a sequence of Row block records
* It is assumed that at least one row or cell value record has been found prior to the current
* record
*/
public static boolean isEndOfRowBlock(int sid) {
switch(sid) {
case ViewDefinitionRecord.sid:
// should have been prefixed with DrawingRecord (0x00EC), but bug 46280 seems to allow this
case DrawingRecord.sid:
case DrawingSelectionRecord.sid:
case ObjRecord.sid:
case TextObjectRecord.sid:
case ColumnInfoRecord.sid: // See Bugzilla 53984
case GutsRecord.sid: // see Bugzilla 50426
case WindowOneRecord.sid:
// should really be part of workbook stream, but some apps seem to put this before WINDOW2
case WindowTwoRecord.sid:
return true;
case DVALRecord.sid:
return true;
case EOFRecord.sid:
// WINDOW2 should always be present, so shouldn't have got this far
throw new RuntimeException("Found EOFRecord before WindowTwoRecord was encountered");
}
return PageSettingsBlock.isComponentRecord(sid);
}
示例3
/**
* @return <code>true</code> if the specified record ID terminates a sequence of Row block records
* It is assumed that at least one row or cell value record has been found prior to the current
* record
*/
static boolean isEndOfRowBlock(int sid) {
switch(sid) {
case ViewDefinitionRecord.sid:
// should have been prefixed with DrawingRecord (0x00EC), but bug 46280 seems to allow this
case DrawingRecord.sid:
case DrawingSelectionRecord.sid:
case ObjRecord.sid:
case TextObjectRecord.sid:
case ColumnInfoRecord.sid: // See Bugzilla 53984
case GutsRecord.sid: // see Bugzilla 50426
case WindowOneRecord.sid:
// should really be part of workbook stream, but some apps seem to put this before WINDOW2
case WindowTwoRecord.sid:
return true;
case DVALRecord.sid:
return true;
case EOFRecord.sid:
// WINDOW2 should always be present, so shouldn't have got this far
throw new RuntimeException("Found EOFRecord before WindowTwoRecord was encountered");
}
return PageSettingsBlock.isComponentRecord(sid);
}
示例4
@Override
public void processRecord(XlsReadContext xlsReadContext, Record record) {
ObjRecord or = (ObjRecord)record;
for (SubRecord subRecord : or.getSubRecords()) {
if (subRecord instanceof CommonObjectDataSubRecord) {
CommonObjectDataSubRecord codsr = (CommonObjectDataSubRecord)subRecord;
if (CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT == codsr.getObjectType()) {
xlsReadContext.xlsReadSheetHolder().setTempObjectIndex(codsr.getObjectId());
}
break;
}
}
}
示例5
@Override
protected HSSFShape cloneShape() {
TextObjectRecord txo = (TextObjectRecord) getTextObjectRecord().cloneViaReserialise();
EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());
ObjRecord obj = (ObjRecord) getObjRecord().cloneViaReserialise();
NoteRecord note = (NoteRecord) getNoteRecord().cloneViaReserialise();
return new HSSFComment(spContainer, obj, txo, note);
}
示例6
@Override
protected ObjRecord createObjRecord() {
ObjRecord obj = new ObjRecord();
CommonObjectDataSubRecord c = new CommonObjectDataSubRecord();
c.setLocked(true);
c.setPrintable(true);
c.setAutofill(true);
c.setAutoline(true);
EndSubRecord e = new EndSubRecord();
obj.addSubRecord(c);
obj.addSubRecord(e);
return obj;
}
示例7
private static boolean isEmbeddedObject(ObjRecord obj) {
for (SubRecord sub : obj.getSubRecords()) {
if (sub instanceof EmbeddedObjectRefSubRecord) {
return true;
}
}
return false;
}
示例8
@Override
protected HSSFShape cloneShape() {
EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());
ObjRecord obj = (ObjRecord) getObjRecord().cloneViaReserialise();
return new HSSFPicture(spContainer, obj);
}
示例9
/**
* creates shapes from existing file
* @param spContainer
* @param objRecord
*/
public HSSFShape(EscherContainerRecord spContainer, ObjRecord objRecord) {
this._escherContainer = spContainer;
this._objRecord = objRecord;
this._optRecord = spContainer.getChildById(EscherOptRecord.RECORD_ID);
this.anchor = HSSFAnchor.createAnchorFromEscher(spContainer);
}
示例10
public HSSFComment(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord, NoteRecord note) {
super(spContainer, objRecord, textObjectRecord);
_note = note;
}
示例11
public HSSFSimpleShape(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord) {
super(spContainer, objRecord);
this._textObjectRecord = textObjectRecord;
}
示例12
public HSSFSimpleShape(EscherContainerRecord spContainer, ObjRecord objRecord) {
super(spContainer, objRecord);
}
示例13
public HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord) {
super(spContainer, objRecord);
}
示例14
protected ObjRecord getObjRecord() {
return _objRecord;
}
示例15
protected abstract ObjRecord createObjRecord();