errorrecord.cs

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

CS
75
字号
using System;

using Microsoft.Fawvw.Components.NExcel.Biff;

namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
	
	/// <summary> A cell containing an error code.  This will usually be the result
	/// of some error during the calculation of a formula
	/// </summary>
	class ErrorRecord:CellValue, ErrorCell
	{
		/// <summary> Interface method which gets the error code for this cell.  If this cell
		/// does not represent an error, then it returns 0.  Always use the
		/// method isError() to  determine this prior to calling this method
		/// 
		/// </summary>
		/// <returns> the error code if this cell contains an error, 0 otherwise
		/// </returns>
		virtual public int ErrorCode
		{
			get
			{
				return errorCode;
			}
			
		}
		/// <summary> Returns the numerical value as a string
		/// 
		/// </summary>
		/// <returns> The numerical value of the formula as a string
		/// </returns>
		virtual public string Contents
		{
			get
			{
				return "ERROR " + errorCode;
			}
			
		}
		/// <summary> Returns the cell type
		/// 
		/// </summary>
		/// <returns> The cell type
		/// </returns>
		virtual public CellType Type
		{
			get
			{
				return CellType.ERROR;
			}
			
		}
		/// <summary> The error code if this cell evaluates to an error, otherwise zer0</summary>
		private int errorCode;
		
		/// <summary> Constructs this object
		/// 
		/// </summary>
		/// <param name="t">the raw data
		/// </param>
		/// <param name="fr">the formatting records
		/// </param>
		/// <param name="si">the sheet
		/// </param>
		public ErrorRecord(Record t, FormattingRecords fr, SheetImpl si):base(t, fr, si)
		{
			
			sbyte[] data = getRecord().Data;
			
			errorCode = data[6];
		}
	}
}

⌨️ 快捷键说明

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