private int getFormattingDataLength() { if (_text.length() < 1) { // important - no formatting data if text is empty return 0; } return (_text.numFormattingRuns() + 1) * FORMAT_RUN_ENCODED_SIZE; }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("[TXO]\n"); sb.append(" .options = ").append(HexDump.shortToHex(field_1_options)).append("\n"); sb.append(" .isHorizontal = ").append(getHorizontalTextAlignment()).append('\n'); sb.append(" .isVertical = ").append(getVerticalTextAlignment()).append('\n'); sb.append(" .textLocked = ").append(isTextLocked()).append('\n'); sb.append(" .textOrientation= ").append(HexDump.shortToHex(getTextOrientation())).append("\n"); sb.append(" .reserved4 = ").append(HexDump.shortToHex(field_3_reserved4)).append("\n"); sb.append(" .reserved5 = ").append(HexDump.shortToHex(field_4_reserved5)).append("\n"); sb.append(" .reserved6 = ").append(HexDump.shortToHex(field_5_reserved6)).append("\n"); sb.append(" .textLength = ").append(HexDump.shortToHex(_text.length())).append("\n"); sb.append(" .reserved7 = ").append(HexDump.intToHex(field_8_reserved7)).append("\n"); sb.append(" .string = ").append(_text).append('\n'); for (int i = 0; i < _text.numFormattingRuns(); i++) { sb.append(" .textrun = ").append(_text.getFontOfFormattingRun(i)).append('\n'); } sb.append("[/TXO]\n"); return sb.toString(); }
if (startIndex < 0 || endIndex > length()) throw new IllegalArgumentException("Start and end index not in range."); if (startIndex == endIndex) if (endIndex != length()) { currentFont = this.getFontAtIndex(endIndex); if (endIndex != length()) _string.addFormatRun(new UnicodeString.FormatRun((short)endIndex, currentFont));
private static void processFontRuns(RecordInputStream in, HSSFRichTextString str, int formattingRunDataLength) { if (formattingRunDataLength % FORMAT_RUN_ENCODED_SIZE != 0) { throw new RecordFormatException("Bad format run data length " + formattingRunDataLength + ")"); } int nRuns = formattingRunDataLength / FORMAT_RUN_ENCODED_SIZE; for (int i = 0; i < nRuns; i++) { short index = in.readShort(); short iFont = in.readShort(); in.readInt(); // skip reserved. str.applyFont(index, str.length(), iFont); } }
private static void writeFormatData(ContinuableRecordOutput out , HSSFRichTextString str) { int nRuns = str.numFormattingRuns(); for (int i = 0; i < nRuns; i++) { out.writeShort(str.getIndexOfFormattingRun(i)); int fontIndex = str.getFontOfFormattingRun(i); out.writeShort(fontIndex == HSSFRichTextString.NO_FONT ? 0 : fontIndex); out.writeInt(0); // skip reserved } out.writeShort(str.length()); out.writeShort(0); out.writeInt(0); // skip reserved }
case STRING: HSSFRichTextString str = cell.getRichStringCellValue(); if(str != null && str.length() > 0) { text.append(str);
private void serializeTXORecord(ContinuableRecordOutput out) { out.writeShort(field_1_options); out.writeShort(field_2_textOrientation); out.writeShort(field_3_reserved4); out.writeShort(field_4_reserved5); out.writeShort(field_5_reserved6); out.writeShort(_text.length()); out.writeShort(getFormattingDataLength()); out.writeInt(field_8_reserved7); if (_linkRefPtg != null) { int formulaSize = _linkRefPtg.getSize(); out.writeShort(formulaSize); out.writeInt(_unknownPreFormulaInt); _linkRefPtg.write(out); if (_unknownPostFormulaByte != null) { out.writeByte(_unknownPostFormulaByte.byteValue()); } } }
private int getFormattingDataLength() { if (_text.length() < 1) { // important - no formatting data if text is empty return 0; } return (_text.numFormattingRuns() + 1) * FORMAT_RUN_ENCODED_SIZE; }
private int getFormattingDataLength() { if (_text.length() < 1) { // important - no formatting data if text is empty return 0; } return (_text.numFormattingRuns() + 1) * FORMAT_RUN_ENCODED_SIZE; }
private int getFormattingDataLength() { if (_text.length() < 1) { // important - no formatting data if text is empty return 0; } return (_text.numFormattingRuns() + 1) * FORMAT_RUN_ENCODED_SIZE; }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("[TXO]\n"); sb.append(" .options = ").append(HexDump.shortToHex(field_1_options)).append("\n"); sb.append(" .isHorizontal = ").append(getHorizontalTextAlignment()).append('\n'); sb.append(" .isVertical = ").append(getVerticalTextAlignment()).append('\n'); sb.append(" .textLocked = ").append(isTextLocked()).append('\n'); sb.append(" .textOrientation= ").append(HexDump.shortToHex(getTextOrientation())).append("\n"); sb.append(" .reserved4 = ").append(HexDump.shortToHex(field_3_reserved4)).append("\n"); sb.append(" .reserved5 = ").append(HexDump.shortToHex(field_4_reserved5)).append("\n"); sb.append(" .reserved6 = ").append(HexDump.shortToHex(field_5_reserved6)).append("\n"); sb.append(" .textLength = ").append(HexDump.shortToHex(_text.length())).append("\n"); sb.append(" .reserved7 = ").append(HexDump.intToHex(field_8_reserved7)).append("\n"); sb.append(" .string = ").append(_text).append('\n'); for (int i = 0; i < _text.numFormattingRuns(); i++) { sb.append(" .textrun = ").append(_text.getFontOfFormattingRun(i)).append('\n'); } sb.append("[/TXO]\n"); return sb.toString(); }
private static void processFontRuns(RecordInputStream in, HSSFRichTextString str, int formattingRunDataLength) { if (formattingRunDataLength % FORMAT_RUN_ENCODED_SIZE != 0) { throw new RecordFormatException("Bad format run data length " + formattingRunDataLength + ")"); } int nRuns = formattingRunDataLength / FORMAT_RUN_ENCODED_SIZE; for (int i = 0; i < nRuns; i++) { short index = in.readShort(); short iFont = in.readShort(); in.readInt(); // skip reserved. str.applyFont(index, str.length(), iFont); } }
private static void processFontRuns(RecordInputStream in, HSSFRichTextString str, int formattingRunDataLength) { if (formattingRunDataLength % FORMAT_RUN_ENCODED_SIZE != 0) { throw new RecordFormatException("Bad format run data length " + formattingRunDataLength + ")"); } int nRuns = formattingRunDataLength / FORMAT_RUN_ENCODED_SIZE; for (int i = 0; i < nRuns; i++) { short index = in.readShort(); short iFont = in.readShort(); in.readInt(); // skip reserved. str.applyFont(index, str.length(), iFont); } }
private static void processFontRuns(RecordInputStream in, HSSFRichTextString str, int formattingRunDataLength) { if (formattingRunDataLength % FORMAT_RUN_ENCODED_SIZE != 0) { throw new RecordFormatException("Bad format run data length " + formattingRunDataLength + ")"); } int nRuns = formattingRunDataLength / FORMAT_RUN_ENCODED_SIZE; for (int i = 0; i < nRuns; i++) { short index = in.readShort(); short iFont = in.readShort(); in.readInt(); // skip reserved. str.applyFont(index, str.length(), iFont); } }
private static void writeFormatData(ContinuableRecordOutput out , HSSFRichTextString str) { int nRuns = str.numFormattingRuns(); for (int i = 0; i < nRuns; i++) { out.writeShort(str.getIndexOfFormattingRun(i)); int fontIndex = str.getFontOfFormattingRun(i); out.writeShort(fontIndex == str.NO_FONT ? 0 : fontIndex); out.writeInt(0); // skip reserved } out.writeShort(str.length()); out.writeShort(0); out.writeInt(0); // skip reserved }
private static void writeFormatData(ContinuableRecordOutput out , HSSFRichTextString str) { int nRuns = str.numFormattingRuns(); for (int i = 0; i < nRuns; i++) { out.writeShort(str.getIndexOfFormattingRun(i)); int fontIndex = str.getFontOfFormattingRun(i); out.writeShort(fontIndex == str.NO_FONT ? 0 : fontIndex); out.writeInt(0); // skip reserved } out.writeShort(str.length()); out.writeShort(0); out.writeInt(0); // skip reserved }
private static void writeFormatData(ContinuableRecordOutput out , HSSFRichTextString str) { int nRuns = str.numFormattingRuns(); for (int i = 0; i < nRuns; i++) { out.writeShort(str.getIndexOfFormattingRun(i)); int fontIndex = str.getFontOfFormattingRun(i); out.writeShort(fontIndex == HSSFRichTextString.NO_FONT ? 0 : fontIndex); out.writeInt(0); // skip reserved } out.writeShort(str.length()); out.writeShort(0); out.writeInt(0); // skip reserved }
private void serializeTXORecord(ContinuableRecordOutput out) { out.writeShort(field_1_options); out.writeShort(field_2_textOrientation); out.writeShort(field_3_reserved4); out.writeShort(field_4_reserved5); out.writeShort(field_5_reserved6); out.writeShort(_text.length()); out.writeShort(getFormattingDataLength()); out.writeInt(field_8_reserved7); if (_linkRefPtg != null) { int formulaSize = _linkRefPtg.getSize(); out.writeShort(formulaSize); out.writeInt(_unknownPreFormulaInt); _linkRefPtg.write(out); if (_unknownPostFormulaByte != null) { out.writeByte(_unknownPostFormulaByte.byteValue()); } } }
private void serializeTXORecord(ContinuableRecordOutput out) { out.writeShort(field_1_options); out.writeShort(field_2_textOrientation); out.writeShort(field_3_reserved4); out.writeShort(field_4_reserved5); out.writeShort(field_5_reserved6); out.writeShort(_text.length()); out.writeShort(getFormattingDataLength()); out.writeInt(field_8_reserved7); if (_linkRefPtg != null) { int formulaSize = _linkRefPtg.getSize(); out.writeShort(formulaSize); out.writeInt(_unknownPreFormulaInt); _linkRefPtg.write(out); if (_unknownPostFormulaByte != null) { out.writeByte(_unknownPostFormulaByte.byteValue()); } } }
private void serializeTXORecord(ContinuableRecordOutput out) { out.writeShort(field_1_options); out.writeShort(field_2_textOrientation); out.writeShort(field_3_reserved4); out.writeShort(field_4_reserved5); out.writeShort(field_5_reserved6); out.writeShort(_text.length()); out.writeShort(getFormattingDataLength()); out.writeInt(field_8_reserved7); if (_linkRefPtg != null) { int formulaSize = _linkRefPtg.getSize(); out.writeShort(formulaSize); out.writeInt(_unknownPreFormulaInt); _linkRefPtg.write(out); if (_unknownPostFormulaByte != null) { out.writeByte(_unknownPostFormulaByte.byteValue()); } } }