/** * Constructs a Name record and Sets its fields appropriately. * * @param in the RecordInputstream to Read the record from */ public NameRecord(RecordInputStream ris) { byte[] remainder = ris.ReadAllContinuedRemainder(); ILittleEndianInput in1 = new LittleEndianByteArrayInputStream(remainder); field_1_option_flag = in1.ReadShort(); field_2_keyboard_shortcut = (byte)in1.ReadByte(); int field_3_length_name_text = in1.ReadByte(); int field_4_length_name_definition = in1.ReadShort(); field_5_externSheetIndex_plus1 = in1.ReadShort(); field_6_sheetNumber = in1.ReadUShort(); int field_7_length_custom_menu = in1.ReadUByte(); int field_8_length_description_text = in1.ReadUByte(); int field_9_length_help_topic_text = in1.ReadUByte(); int field_10_length_status_bar_text = in1.ReadUByte(); //store the name in byte form if it's a built-in name field_11_nameIsMultibyte = (in1.ReadByte() != 0); if (IsBuiltInName) { field_12_built_in_code = (byte)in1.ReadByte(); } else { if (field_11_nameIsMultibyte) { field_12_name_text = StringUtil.ReadUnicodeLE(in1, field_3_length_name_text); } else { field_12_name_text = StringUtil.ReadCompressedUnicode(in1, field_3_length_name_text); } } int nBytesAvailable = in1.Available() - (field_7_length_custom_menu + field_8_length_description_text + field_9_length_help_topic_text + field_10_length_status_bar_text); field_13_name_definition = SSFormula.Formula.Read(field_4_length_name_definition, in1, nBytesAvailable); //Who says that this can only ever be compressed unicode??? field_14_custom_menu_text = StringUtil.ReadCompressedUnicode(in1, field_7_length_custom_menu); field_15_description_text = StringUtil.ReadCompressedUnicode(in1, field_8_length_description_text); field_16_help_topic_text = StringUtil.ReadCompressedUnicode(in1, field_9_length_help_topic_text); field_17_status_bar_text = StringUtil.ReadCompressedUnicode(in1, field_10_length_status_bar_text); }
private static Ptg ReadRefPtg(byte[] formulaRawBytes) { ILittleEndianInput in1 = new LittleEndianByteArrayInputStream(formulaRawBytes); byte ptgSid = (byte)in1.ReadByte(); switch (ptgSid) { case AreaPtg.sid: return new AreaPtg(in1); case Area3DPtg.sid: return new Area3DPtg(in1); case RefPtg.sid: return new RefPtg(in1); case Ref3DPtg.sid: return new Ref3DPtg(in1); } return null; }