BoundSheet.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Biff8Excel.Excel
  5. {
  6. public enum Visibility
  7. {
  8. Visible = 0x0,
  9. Hidden = 0x1
  10. }
  11. public class BoundSheet : IDisposable
  12. {
  13. uint m_byteOffset; // Offset in the file stream of this bundlesheet
  14. Biff8Excel.Records.BoundSheet m_boundSheet;
  15. string m_sheetname;
  16. public BoundSheet()
  17. {
  18. m_boundSheet = new Biff8Excel.Records.BoundSheet();
  19. }
  20. /// <summary>
  21. /// 取得或设定Sheet工作表名称
  22. /// </summary>
  23. public string SheetName
  24. {
  25. set
  26. {
  27. m_sheetname = value;
  28. m_boundSheet.StreamName = m_sheetname;
  29. }
  30. get
  31. {
  32. return m_sheetname;
  33. }
  34. }
  35. internal uint SheetOffset
  36. {
  37. set { m_boundSheet.StreamPosition = value; }
  38. }
  39. internal uint StreamOffset
  40. {
  41. set { m_byteOffset = value; }
  42. get { return m_byteOffset; }
  43. }
  44. public Visibility Visible
  45. {
  46. set
  47. {
  48. if (value == 0)
  49. m_boundSheet.Visible = (byte)Visibility.Visible;
  50. else
  51. m_boundSheet.Visible = (byte)Visibility.Hidden;
  52. }
  53. }
  54. internal byte[] WriteRecord
  55. {
  56. get { return m_boundSheet.GetByte(); }
  57. }
  58. #region IDisposable 成员
  59. public void Dispose(bool disposed)
  60. {
  61. if (disposed)
  62. {
  63. m_boundSheet = null;
  64. m_sheetname = null;
  65. }
  66. this.Dispose();
  67. }
  68. public void Dispose()
  69. {
  70. //GC.SuppressFinalize(this);
  71. }
  72. #endregion
  73. }
  74. }