mulblankrecord.cs

来自「Excel的操作,其中可以读取及写入Excel 文件」· CS 代码 · 共 106 行

CS
106
字号
using System;

using Microsoft.Fawvw.Components.NExcel.Biff;

namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
	
	/// <summary> Contains an array of Blank, formatted cells</summary>
	class MulBlankRecord:RecordData
	{
		/// <summary> Accessor for the row
		/// 
		/// </summary>
		/// <returns> the row of containing these blank numbers
		/// </returns>
		virtual public int Row
		{
			get
			{
				return row;
			}
			
		}
		/// <summary> The first column containing the blank numbers
		/// 
		/// </summary>
		/// <returns> the first column
		/// </returns>
		virtual public int FirstColumn
		{
			get
			{
				return colFirst;
			}
			
		}
		/// <summary> Accessor for the number of blank values
		/// 
		/// </summary>
		/// <returns> the number of blank values
		/// </returns>
		virtual public int NumberOfColumns
		{
			get
			{
				return numblanks;
			}
			
		}
		/// <summary> The row  containing these numbers</summary>
		private int row;
		/// <summary> The first column these rk number occur on</summary>
		private int colFirst;
		/// <summary> The last column these blank numbers occur on</summary>
		private int colLast;
		/// <summary> The number of blank numbers contained in this record</summary>
		private int numblanks;
		/// <summary> The array of xf indices</summary>
		private int[] xfIndices;
		
		/// <summary> Constructs the blank records from the raw data
		/// 
		/// </summary>
		/// <param name="t">the raw data
		/// </param>
		public MulBlankRecord(Record t):base(t)
		{
			sbyte[] data = getRecord().Data;
			int length = getRecord().Length;
			row = IntegerHelper.getInt(data[0], data[1]);
			colFirst = IntegerHelper.getInt(data[2], data[3]);
			colLast = IntegerHelper.getInt(data[length - 2], data[length - 1]);
			numblanks = colLast - colFirst + 1;
			xfIndices = new int[numblanks];
			
			readBlanks(data);
		}
		
		/// <summary> Reads the blanks from the raw data
		/// 
		/// </summary>
		/// <param name="data">the raw data
		/// </param>
		private void  readBlanks(sbyte[] data)
		{
			int pos = 4;
			//    int blank;
			for (int i = 0; i < numblanks; i++)
			{
				xfIndices[i] = IntegerHelper.getInt(data[pos], data[pos + 1]);
				pos += 2;
			}
		}
		
		/// <summary> Return a specific formatting index</summary>
		/// <param name="index">the cell index in the group
		/// </param>
		/// <returns> the formatting index
		/// </returns>
		public virtual int getXFIndex(int index)
		{
			return xfIndices[index];
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?