123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Runtime.InteropServices;
- using Biff8Excel.Interfaces;
- namespace Biff8Excel.Records
- {
- [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
- struct StructExternSheet
- {
- public ushort tIndex; // for our purposes will always be zero, index to first supbook record
- public ushort tFirstSheet;
- public ushort tLastSheet;
- }
- [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
- struct RecordExternSheet
- {
- public ushort opcode;
- public ushort length;
- public ushort num;
- }
- internal class ExternSheet : IRecords
- {
- RecordExternSheet externsheet;
- StructExternSheet[] structs;
- public ExternSheet()
- {
- externsheet.opcode = 0x17;
- }
- public StructExternSheet[] ExternSheets
- {
- set
- {
- try
- {
- if (value == null)
- externsheet.num = 0;
- else
- externsheet.num = (ushort)value.Length;
- structs = value;
- }
- catch
- {
- throw;
- }
- }
- }
- #region IRecords ³ÉÔ±
- public byte[] GetByte()
- {
- byte[] b;
- ushort length;
- if (externsheet.num == 0)
- return null;
- length = (ushort)(6 + (6 & externsheet.num));
- b = new byte[length];
- externsheet.length = (ushort)(length - 4);
- Globals.GetStructToBytes(externsheet).CopyTo(b, 0);
- int pos = 6;
- for (int i = 0; i < structs.Length; i++, pos += 6)
- {
- Globals.GetStructToBytes(structs[i]).CopyTo(b, pos);
- }
- return b;
- }
- #endregion
- }
- }
|