using System; using System.Collections.Generic; using System.Text; using Biff8Excel.Records; namespace Biff8Excel.Excel { public class MergedCells:IDisposable { Records.MergedCells m_merged; Records.StructMergedCells[] m_arrMergedCells; ushort m_total; internal byte[] WriteRecord() { if (m_total > 0) { Array.Resize(ref m_arrMergedCells, m_total); m_merged.SetMergedCells = m_arrMergedCells; return m_merged.GetByte(); } return null; } internal void AddMergedCells(ushort iFirstRow, ushort iLastRow, ushort iFirstColumn, ushort iLastColumn) { // Zero Based if (iFirstRow > 0) iFirstRow--; if (iLastRow > 0) iLastRow--; if (iFirstColumn > 0) iFirstColumn--; if (iLastColumn > 0) iLastColumn--; if (m_total >= m_arrMergedCells.Length) { Array.Resize(ref m_arrMergedCells, m_arrMergedCells.Length + 10); } m_total++; m_arrMergedCells[m_total - 1].mcFirstCol = iFirstColumn; m_arrMergedCells[m_total - 1].mcFirstRow = iFirstRow; m_arrMergedCells[m_total - 1].mcLastCol = iLastColumn; m_arrMergedCells[m_total - 1].mcLastRow = iLastRow; } internal ushort Total { get { return m_total; } } public MergedCells() { m_merged = new Biff8Excel.Records.MergedCells(); m_arrMergedCells = new StructMergedCells[10]; // make room for 10 in the array } #region IDisposable ³ΙΤ± public void Dispose() { m_merged = null; m_arrMergedCells = null; } #endregion } }