Label.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 RecordLabel
  10. {
  11. public ushort opcode; // 0x0204
  12. public ushort length;
  13. public ushort row;
  14. public ushort col;
  15. public ushort xf; // 0xF;
  16. public ushort TextLength;
  17. }
  18. internal class Label : IRecords
  19. {
  20. RecordLabel label;
  21. public Label()
  22. {
  23. label.opcode = 0x0204;
  24. label.xf = 0xf;
  25. }
  26. public ushort Row
  27. {
  28. set { label.row = value; }
  29. }
  30. public ushort Column
  31. {
  32. set { label.col = value; }
  33. }
  34. public ushort CellStyle
  35. {
  36. set { label.xf = value; }
  37. }
  38. public string LabelCaption
  39. {
  40. set
  41. {
  42. if (value == null)
  43. return;
  44. label.TextLength = (ushort)Globals.GetDefaultBytesLength(value);
  45. label.length = (ushort)(8 + label.TextLength);
  46. }
  47. }
  48. #region IRecords ³ÉÔ±
  49. public byte[] GetByte()
  50. {
  51. return Globals.GetStructToBytes(label);
  52. }
  53. #endregion
  54. }
  55. }