123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Collections;
- namespace Biff8Excel.Excel
- {
- /// <summary>
- /// 每一行所有有内容ExcelCell的链
- /// key 为列号从零开始1,2,3,4无数据跳过
- /// </summary>
- public class ExcelCellLinkDictionary : SortedList<ushort,ExcelCell> // BaseTwoLinkList<ExcelCell>
- {
- //ushort m_iRowBlock;
- //ushort m_sheetNumber;
- ushort m_styleIndex;
- //int m_streamPosition;
- bool m_hidden;
- Biff8Excel.Records.Row m_row;
- ExcelCellStyle m_cellStyle;
- //ushort m_rowNumber;
- internal bool AdditionalSpaceAbove
- {
- set { m_row.AdditionalSpaceAbove = value; }
- }
- internal bool AdditionalSpaceBelow
- {
- set { m_row.AdditionalSpaceBelow = value; }
- }
- public ExcelCellLinkDictionary(ExcelWorkbook pWorkbook)
- : base()
- {
- m_row = new Biff8Excel.Records.Row();
- //m_cellStyle = new ExcelCellStyle(pWorkbook);
- m_cellStyle = pWorkbook.CreateStyle();
- // default style
- //m_cellStyle.Init();
- m_cellStyle.RowsInit();
- this.StyleIndex = m_cellStyle.GetXFIndex();
- }
- 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 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 = value;
- }
- // 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
- }
- ExcelCell oc;
- internal void SetCell(ushort Column, ExcelCell ocell)
- {
- if (this.TryGetValue(Column, out oc))
- oc = ocell;
- else
- this.AddCell(Column, ocell);
- }
- internal void AddCell(ushort Column, ExcelCell ocell)
- {
- this.Add(Column, ocell);
- }
- //internal ushort sheetNumber
- //{
- // set { m_sheetNumber = value; }
- //}
- //internal int StreamPosition
- //{
- // //set { m_streamPosition = value; }
- // //get { return m_streamPosition; }
- //}
- public ExcelCellStyle Style
- {
- // used when retrieving value of a property, on the right side of an assignment.
- // Syntax: Debug.Print X.RowNumber
- internal get { return m_cellStyle; }
- set
- {
- m_cellStyle = value;
- this.StyleIndex = value.GetXFIndex();
- }
- }
- 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; }
- }
- internal byte[] WriteRecord()
- {
- return m_row.GetByte();
- }
- }
- }
|