org.apache.poi.hssf.record.NoteRecord Java Examples
The following examples show how to use
org.apache.poi.hssf.record.NoteRecord.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HSSFPatriarch.java From lams with GNU General Public License v2.0 | 6 votes |
/** * check if any shapes contain wrong data * At now(13.08.2010) check if patriarch contains 2 or more comments with same coordinates */ protected void preSerialize(){ Map<Integer, NoteRecord> tailRecords = _boundAggregate.getTailRecords(); /** * contains coordinates of comments we iterate over */ Set<String> coordinates = new HashSet<String>(tailRecords.size()); for(NoteRecord rec : tailRecords.values()){ String noteRef = new CellReference(rec.getRow(), rec.getColumn()).formatAsString(); // A1-style notation if(coordinates.contains(noteRef )){ throw new IllegalStateException("found multiple cell comments for cell " + noteRef ); } else { coordinates.add(noteRef); } } }
Example #2
Source File: NoteRecordHandler.java From easyexcel with Apache License 2.0 | 5 votes |
@Override public void processRecord(XlsReadContext xlsReadContext, Record record) { NoteRecord nr = (NoteRecord)record; String text = xlsReadContext.xlsReadSheetHolder().getObjectCacheMap().get(nr.getShapeId()); CellExtra cellExtra = new CellExtra(CellExtraTypeEnum.COMMENT, text, nr.getRow(), nr.getColumn()); xlsReadContext.xlsReadSheetHolder().setCellExtra(cellExtra); xlsReadContext.analysisEventProcessor().extra(xlsReadContext); }
Example #3
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 5 votes |
private HSSFComment(HSSFShape parent, HSSFAnchor anchor, NoteRecord note) { super(parent, anchor); _note = note; //default color for comments setFillColor(0x08000050); //by default comments are hidden setVisible(false); setAuthor(""); CommonObjectDataSubRecord cod = (CommonObjectDataSubRecord) getObjRecord().getSubRecords().get(0); cod.setObjectType(CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT); }
Example #4
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 5 votes |
@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); }
Example #5
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 4 votes |
public HSSFComment(EscherContainerRecord spContainer, ObjRecord objRecord, TextObjectRecord textObjectRecord, NoteRecord note) { super(spContainer, objRecord, textObjectRecord); _note = note; }
Example #6
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 4 votes |
protected HSSFComment(NoteRecord note, TextObjectRecord txo) { this(null, new HSSFClientAnchor(), note); }
Example #7
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 4 votes |
private static NoteRecord createNoteRecord() { NoteRecord note = new NoteRecord(); note.setFlags(NoteRecord.NOTE_HIDDEN); note.setAuthor(""); return note; }
Example #8
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Sets whether this comment is visible. * * @param visible <code>true</code> if the comment is visible, <code>false</code> otherwise */ @Override public void setVisible(boolean visible) { _note.setFlags(visible ? NoteRecord.NOTE_VISIBLE : NoteRecord.NOTE_HIDDEN); setHidden(!visible); }
Example #9
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Returns the underlying Note record */ protected NoteRecord getNoteRecord() { return _note; }
Example #10
Source File: EventBasedExcelExtractor.java From lams with GNU General Public License v2.0 | 4 votes |
public void processRecord(Record record) { String thisText = null; int thisRow = -1; switch(record.getSid()) { case BoundSheetRecord.sid: BoundSheetRecord sr = (BoundSheetRecord)record; sheetNames.add(sr.getSheetname()); break; case BOFRecord.sid: BOFRecord bof = (BOFRecord)record; if(bof.getType() == BOFRecord.TYPE_WORKSHEET) { sheetNum++; rowNum = -1; if(_includeSheetNames) { if(_text.length() > 0) _text.append("\n"); _text.append(sheetNames.get(sheetNum)); } } break; case SSTRecord.sid: sstRecord = (SSTRecord)record; break; case FormulaRecord.sid: FormulaRecord frec = (FormulaRecord) record; thisRow = frec.getRow(); if(_formulasNotResults) { thisText = HSSFFormulaParser.toFormulaString((HSSFWorkbook)null, frec.getParsedExpression()); } else { if(frec.hasCachedResultString()) { // Formula result is a string // This is stored in the next record outputNextStringValue = true; nextRow = frec.getRow(); } else { thisText = _ft.formatNumberDateCell(frec); } } break; case StringRecord.sid: if(outputNextStringValue) { // String for formula StringRecord srec = (StringRecord)record; thisText = srec.getString(); thisRow = nextRow; outputNextStringValue = false; } break; case LabelRecord.sid: LabelRecord lrec = (LabelRecord) record; thisRow = lrec.getRow(); thisText = lrec.getValue(); break; case LabelSSTRecord.sid: LabelSSTRecord lsrec = (LabelSSTRecord) record; thisRow = lsrec.getRow(); if(sstRecord == null) { throw new IllegalStateException("No SST record found"); } thisText = sstRecord.getString(lsrec.getSSTIndex()).toString(); break; case NoteRecord.sid: NoteRecord nrec = (NoteRecord) record; thisRow = nrec.getRow(); // TODO: Find object to match nrec.getShapeId() break; case NumberRecord.sid: NumberRecord numrec = (NumberRecord) record; thisRow = numrec.getRow(); thisText = _ft.formatNumberDateCell(numrec); break; default: break; } if(thisText != null) { if(thisRow != rowNum) { rowNum = thisRow; if(_text.length() > 0) _text.append("\n"); } else { _text.append("\t"); } _text.append(thisText); } }
Example #11
Source File: HSSFComment.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Returns whether this comment is visible. * * @return <code>true</code> if the comment is visible, <code>false</code> otherwise */ @Override public boolean isVisible() { return _note.getFlags() == NoteRecord.NOTE_VISIBLE; }