123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using Biff8Excel.Interface;
- namespace Biff8Excel.Excel
- {
- /// <summary>
- /// Òѱ»ExcelCellLink´úÌæ
- /// </summary>
- public class ExcelRow : IDisposable
- {
- ushort m_iRowBlock;
- //Private arrCells(255) As ExcelCell ''' Array of column cells
- ExcelCell[] arrCells = new ExcelCell[256]; //Array of column cells
- ExcelCellStyle m_cellStyle;
- Biff8Excel.Records.Row m_row;
- ushort m_firstCol;
- ushort m_lastCol;
- ushort m_rowNumber;
- bool bfirstCol;
- bool blastCol;
- ushort m_sheetNumber;
- ushort m_styleIndex;
- int m_streamPosition;
- bool m_hidden;
- internal ExcelCell this[int index]
- {
- get
- {
- if (index == -1) return null;
- return arrCells[index];
- }
- }
- internal ushort FirstUsedCol
- {
- get { return m_firstCol; }
- }
- internal ushort LastUsedCol
- {
- get { return m_lastCol; }
- }
- internal ushort sheetNumber
- {
- set { m_sheetNumber = value; }
- }
- internal void AddCell(ushort iColumn, ExcelCell oCell)
- {
- arrCells[iColumn] = oCell; // add it to the column array
- }
- internal void SetFirstLastCol(ushort iColumn)
- {
- if (!bfirstCol)
- {
- m_firstCol = iColumn;
- bfirstCol = true;
- }
- else if (iColumn < m_firstCol)
- m_firstCol = iColumn;
- if (!blastCol)
- {
- m_lastCol = iColumn;
- blastCol = true;
- }
- else if (iColumn > m_lastCol)
- m_lastCol = (ushort)(iColumn + 1);
- }
- internal byte[] WriteRecord()
- {
- return m_row.GetByte();
- }
- public ExcelCellStyle Style
- {
- // used when retrieving value of a property, on the right side of an assignment.
- // Syntax: Debug.Print X.RowNumber
- get { return m_cellStyle; }
- }
- internal ushort rowNumber
- {
- // used when assigning a value to the property, on the left side of an assignment.
- // Syntax: X.RowNumber = 5
- set
- {
- m_rowNumber = value;
- m_row.RowNumber = (ushort)m_rowNumber;
- }
- // used when retrieving value of a property, on the right side of an assignment.
- // Syntax: Debug.Print X.RowNumber
- get { return (ushort)(m_rowNumber + 1); } //zero based idexing
- }
- internal ushort StyleIndex
- {
- // used when assigning a value to the property, on the left side of an assignment.
- // Syntax: X.RowNumber = 5
- set
- {
- m_styleIndex = value;
- m_row.ExtendedFormatIndex = value;
- }
- // used when assigning a value to the property, on the left side of an assignment.
- // Syntax: X.RowNumber = 5
- get { return m_styleIndex; }
- }
- public ushort Height
- {
- //'used when assigning a value to the property, on the left side of an assignment.
- //'Syntax: X.RowNumber = 5
- set { m_row.HeightInPoints = value; }
- get { return m_row.HeightInPoints; } //zero based indexing
- }
- public bool Hidden
- {
- //'used when assigning a value to the property, on the left side of an assignment.
- //'Syntax: X.RowNumber = 5
- set
- {
- m_hidden = value;
- m_row.Hidden = value; //zero based indexing
- }
- //'used when assigning a value to the property, on the left side of an assignment.
- //'Syntax: X.RowNumber = 5
- get { return m_hidden; } //zero based indexing
- }
- internal ushort RowBlock
- {
- get { return m_iRowBlock; }
- set { m_iRowBlock = value; }
- }
- internal bool AdditionalSpaceAbove
- {
- set { m_row.AdditionalSpaceAbove = value; }
- }
- internal bool AdditionalSpaceBelow
- {
- set { m_row.AdditionalSpaceBelow = value; }
- }
- internal int StreamPosition
- {
- set { m_streamPosition = value; }
- get { return m_streamPosition; }
- }
- public ExcelRow()
- {
- m_row = new Biff8Excel.Records.Row();
- m_cellStyle = new ExcelCellStyle();
- // default style
- m_cellStyle.Init();
- bfirstCol = false;
- blastCol = false;
- }
- #region IDisposable ³ÉÔ±
- public void Dispose()
- {
- m_row = null;
- m_cellStyle = null;
- }
- #endregion
- }
- }
|