/// <summary>
		/// The constructor for the record.
		/// </summary>
		/// <param name="biff">The GenericBiff record that should contain the correct type and data for the LABELSST record.</param>
		/// <param name="sst">A reference to the shared string table for the workbook.</param>
		/// <exception cref="InvalidRecordIdException">
		/// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
		/// </exception>
		public LabelSstRecord(GenericBiff biff, SstRecord sst)
		{
			if(biff.Id == (ushort)RecordType.LabelSst)
			{
				BinaryReader reader = new BinaryReader(biff.GetDataStream());

				ReadRowColXf(reader);
				_sstIndex = reader.ReadUInt32();		
				_value = sst.Strings[_sstIndex];
			}
			else
				throw new InvalidRecordIdException(biff.Id, RecordType.LabelSst);
		}
Exemple #2
0
        /// <summary>
        /// The constructor for the record.
        /// </summary>
        /// <param name="biff">The GenericBiff record that should contain the correct type and data for the LABELSST record.</param>
        /// <param name="sst">A reference to the shared string table for the workbook.</param>
        /// <exception cref="InvalidRecordIdException">
        /// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
        /// </exception>
        public LabelSstRecord(GenericBiff biff, SstRecord sst)
        {
            if (biff.Id == (ushort)RecordType.LabelSst)
            {
                BinaryReader reader = new BinaryReader(biff.GetDataStream());

                ReadRowColXf(reader);
                _sstIndex = reader.ReadUInt32();
                _value    = sst.Strings[_sstIndex];
            }
            else
            {
                throw new InvalidRecordIdException(biff.Id, RecordType.LabelSst);
            }
        }
        private Biff GetCorrectRecord(GenericBiff record, Stream stream, SstRecord sst)
        {
            Biff ret = record;
            switch (record.Id)
            {
                case (ushort)RecordType.Bof:
                    BofRecord bof = new BofRecord(record);
                    if (bof.Version < 0x0600)
                        throw new Exception("Versions below Excel 97/2000 are currently not supported.");

                    ret = bof;
                    break;
                case (ushort)RecordType.Boundsheet:
                    ret = new BoundSheetRecord(record);
                    break;
                case (ushort)RecordType.Index:
                    ret = new IndexRecord(record);
                    break;
                case (ushort)RecordType.DbCell:
                    ret = new DbCellRecord(record);
                    break;
                case (ushort)RecordType.Row:
                    ret = new RowRecord(record);
                    break;
                case (ushort)RecordType.Continue:
                    ret = new ContinueRecord(record);
                    break;
                case (ushort)RecordType.Blank:
                    ret = new BlankRecord(record);
                    break;
                case (ushort)RecordType.BoolErr:
                    ret = new BoolErrRecord(record);
                    break;
                case (ushort)RecordType.Formula:
                    ret = new FormulaRecord(record, stream);
                    break;
                case (ushort)RecordType.Label:
                    ret = new LabelRecord(record);
                    break;
                case (ushort)RecordType.LabelSst:
                    ret = new LabelSstRecord(record, sst);
                    break;
                case (ushort)RecordType.MulBlank:
                    ret = new MulBlankRecord(record);
                    break;
                case (ushort)RecordType.MulRk:
                    ret = new MulRkRecord(record);
                    break;
                case (ushort)RecordType.String:
                    ret = new StringValueRecord(record);
                    break;
                case (ushort)RecordType.Xf:
                    ret = new XfRecord(record);
                    break;
                case (ushort)RecordType.Rk:
                    ret = new RkRecord(record);
                    break;
                case (ushort)RecordType.Number:
                    ret = new NumberRecord(record);
                    break;
                case (ushort)RecordType.Array:
                    ret = new ArrayRecord(record);
                    break;
                case (ushort)RecordType.ShrFmla:
                    ret = new SharedFormulaRecord(record);
                    break;
                case (ushort)RecordType.Table:
                    ret = new TableRecord(record);
                    break;
                case (ushort)RecordType.Sst:
                    ret = new SstRecord(record, stream);
                    break;
                case (ushort)RecordType.Eof:
                    ret = new EofRecord(record);
                    break;
                case (ushort)RecordType.Font:
                    ret = new FontRecord(record);
                    break;
                case (ushort)RecordType.Format:
                    ret = new Net.SourceForge.Koogra.Excel.Records.FormatRecord(record);
                    break;
                case (ushort)RecordType.Palette:
                    ret = new PaletteRecord(record);
                    break;
                case (ushort)RecordType.Hyperlink:
                    ret = new HyperLinkRecord(record);
                    break;
            }

            return ret;
        }