⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dateformularecord.cs

📁 Excel的操作,其中可以读取及写入Excel 文件
💻 CS
字号:
using System;

using Microsoft.Fawvw.Components.NExcel.ExcelUtils;
using Microsoft.Fawvw.Components.NExcel.Biff;
using Microsoft.Fawvw.Components.NExcel.Biff.Formula;

namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
	
	/// <summary> A date formula's last calculated value</summary>
	class DateFormulaRecord:DateRecord, DateCell, FormulaData, DateFormulaCell
	{
		/// <summary> Returns the cell type
		/// 
		/// </summary>
		/// <returns> The cell type
		/// </returns>
		override public CellType Type
		{
			get
			{
				return CellType.DATE_FORMULA;
			}
			
		}
		/// <summary> Gets the formula as an excel string
		/// 
		/// </summary>
		/// <returns> the formula as an excel string
		/// </returns>
		/// <exception cref=""> FormulaException
		/// </exception>
		virtual public string Formula
		{
			get
			{
				// Note that the standard information was lopped off by the NumberFormula
				// record when creating this formula
				if ((System.Object) formulaString == null)
				{
					sbyte[] tokens = new sbyte[data.Length - 16];
					Array.Copy(data, 16, tokens, 0, tokens.Length);
					FormulaParser fp = new FormulaParser(tokens, this, externalSheet, nameTable, Sheet.Workbook.Settings);
					fp.parse();
					formulaString = fp.Formula;
				}
				
				return formulaString;
			}
			
		}
		/// <summary> Dummy implementation in order to adhere to the NumberCell interface
		/// 
		/// </summary>
		/// <returns> NULL
		/// </returns>
		virtual public NumberFormatInfo NumberFormat
		{
			get
			{
				return null;
			}
			
		}
		/// <summary> The last calculated value of the formula</summary>
		private double Value;
		
		/// <summary> The formula as an excel string</summary>
		private string formulaString;
		
		/// <summary> A handle to the class needed to access external sheets</summary>
		private ExternalSheet externalSheet;
		
		/// <summary> A handle to the name table</summary>
		private WorkbookMethods nameTable;
		
		/// <summary> The raw data</summary>
		private sbyte[] data;
		
		/// <summary> Constructs this object from the raw data
		/// 
		/// </summary>
		/// <param name="t">the basic number formula record
		/// </param>
		/// <param name="fr">the formatting records
		/// </param>
		/// <param name="es">the external sheet
		/// </param>
		/// <param name="nt">the name table
		/// </param>
		/// <param name="nf">flag indicating whether the 1904 date system is in use
		/// </param>
		/// <param name="si">the sheet
		/// </param>
		public DateFormulaRecord(NumberFormulaRecord t, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, bool nf, SheetImpl si):base(t, t.XFIndex, fr, nf, si)
		{
			
			externalSheet = es;
			nameTable = nt;
			data = t.getFormulaData();
		}
		
		/// <summary> Gets the raw bytes for the formula.  This will include the
		/// parsed tokens array.  Used when copying spreadsheets
		/// 
		/// </summary>
		/// <returns> the raw record data
		/// </returns>
		public virtual sbyte[] getFormulaData()
		{
			// Data is already the formula data, so don't do any more manipulation
			return data;
		}
		
		/// <summary> Interface method which returns the value
		/// 
		/// </summary>
		/// <returns> the last calculated value of the formula
		/// </returns>
		public virtual double getValue()
		{
			return Value;
		}
	}
}

⌨️ 快捷键说明

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