You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LabelSSTRecord.java 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.record;
  16. import org.apache.poi.util.HexDump;
  17. import org.apache.poi.util.LittleEndianOutput;
  18. /**
  19. * Title: Label SST Record<P>
  20. * Description: Refers to a string in the shared string table and is a column
  21. * value. <P>
  22. * REFERENCE: PG 325 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
  23. * @author Andrew C. Oliver (acoliver at apache dot org)
  24. * @author Jason Height (jheight at chariot dot net dot au)
  25. */
  26. public final class LabelSSTRecord extends CellRecord {
  27. public final static short sid = 0xfd;
  28. private int field_4_sst_index;
  29. public LabelSSTRecord() {
  30. // fields uninitialised
  31. }
  32. public LabelSSTRecord(RecordInputStream in) {
  33. super(in);
  34. field_4_sst_index = in.readInt();
  35. }
  36. /**
  37. * set the index to the string in the SSTRecord
  38. *
  39. * @param index - of string in the SST Table
  40. * @see org.apache.poi.hssf.record.SSTRecord
  41. */
  42. public void setSSTIndex(int index) {
  43. field_4_sst_index = index;
  44. }
  45. /**
  46. * get the index to the string in the SSTRecord
  47. *
  48. * @return index of string in the SST Table
  49. * @see org.apache.poi.hssf.record.SSTRecord
  50. */
  51. public int getSSTIndex() {
  52. return field_4_sst_index;
  53. }
  54. @Override
  55. protected String getRecordName() {
  56. return "LABELSST";
  57. }
  58. @Override
  59. protected void appendValueText(StringBuilder sb) {
  60. sb.append(" .sstIndex = ");
  61. sb.append(HexDump.shortToHex(getXFIndex()));
  62. }
  63. @Override
  64. protected void serializeValue(LittleEndianOutput out) {
  65. out.writeInt(getSSTIndex());
  66. }
  67. @Override
  68. protected int getValueDataSize() {
  69. return 4;
  70. }
  71. public short getSid() {
  72. return sid;
  73. }
  74. public Object clone() {
  75. LabelSSTRecord rec = new LabelSSTRecord();
  76. copyBaseFields(rec);
  77. rec.field_4_sst_index = field_4_sst_index;
  78. return rec;
  79. }
  80. }