Footer.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.InteropServices;
  5. using Biff8Excel.Interfaces;
  6. namespace Biff8Excel.Records
  7. {
  8. [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
  9. struct RecordFooter
  10. {
  11. public ushort opcode;
  12. public ushort length;
  13. public ushort TextLength;
  14. [MarshalAs(UnmanagedType.U1, SizeConst = 1)] public byte zero;
  15. }
  16. internal class Footer : IRecords
  17. {
  18. RecordFooter footer;
  19. byte[] m_footer;
  20. public Footer()
  21. {
  22. footer.opcode = 0x15;
  23. footer.zero = 0x1;
  24. }
  25. public byte[] Foot
  26. {
  27. set { m_footer = value; }
  28. }
  29. public ushort TextLength
  30. {
  31. set { footer.TextLength = value; }
  32. }
  33. #region IRecords ³ÉÔ±
  34. public byte[] GetByte()
  35. {
  36. byte[] b;
  37. int len = m_footer.Length + 7;
  38. b = new byte[len];
  39. footer.length = (ushort)(len - 4);
  40. //footer.TextLength = (ushort)(len - 7);
  41. Globals.GetStructToBytes(footer).CopyTo(b, 0);
  42. m_footer.CopyTo(b, 7);
  43. return b;
  44. }
  45. #endregion
  46. }
  47. }