📄 basesharedformularecord.cs
字号:
using System;
using Microsoft.Fawvw.Components.NExcel.Biff;
using Microsoft.Fawvw.Components.NExcel.Biff.Formula;
namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
/// <summary> A base class for shared formula records</summary>
public abstract class BaseSharedFormulaRecord:CellValue, FormulaData
{
/// <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
{
if ((System.Object) formulaString == null)
{
FormulaParser fp = new FormulaParser(tokens, this, externalSheet, nameTable, Sheet.Workbook.Settings);
fp.parse();
formulaString = fp.Formula;
}
return formulaString;
}
}
/// <summary> Access for the external sheet
///
/// </summary>
/// <returns> the external sheet
/// </returns>
virtual protected internal ExternalSheet ExternalSheet
{
get
{
return externalSheet;
}
}
/// <summary> Access for the name table
///
/// </summary>
/// <returns> the name table
/// </returns>
virtual protected internal WorkbookMethods NameTable
{
get
{
return nameTable;
}
}
virtual public sbyte[] getFormulaData()
{
return null;
}
/// <summary> Accessor for the position of the next record
///
/// </summary>
/// <returns> the position of the next record
/// </returns>
virtual internal int FilePos
{
get
{
return filePos;
}
}
/// <summary> The formula as an excel string</summary>
private string formulaString;
/// <summary> The position of the next record in the file. Used when looking for
/// for subsequent records eg. a string value
/// </summary>
private int filePos;
/// <summary> A handle to the formatting records</summary>
new private FormattingRecords formattingRecords;
/// <summary> The array of parsed tokens</summary>
private sbyte[] tokens;
/// <summary> The external sheet</summary>
private ExternalSheet externalSheet;
/// <summary> The name table</summary>
private WorkbookMethods nameTable;
/// <summary> Constructs this number
///
/// </summary>
/// <param name="t">the 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="si">the sheet
/// </param>
/// <param name="pos">the position of the next record in the file
/// </param>
public BaseSharedFormulaRecord(Record t, FormattingRecords fr, ExternalSheet es, WorkbookMethods nt, SheetImpl si, int pos):base(t, fr, si)
{
externalSheet = es;
nameTable = nt;
filePos = pos;
}
/// <summary> Called by the shared formula record to set the tokens for
/// this formula
///
/// </summary>
/// <param name="t">the tokens
/// </param>
internal virtual void setTokens(sbyte[] t)
{
tokens = t;
}
/// <summary> Accessor for the tokens which make up this formula
///
/// </summary>
/// <returns> the tokens
/// </returns>
protected internal sbyte[] getTokens()
{
return tokens;
}
/// <summary> In case the shared formula is not added for any reason, we need
/// to expose the raw record data , in order to try again
///
/// </summary>
/// <returns> the record data from the base class
/// </returns>
public override Record getRecord()
{
return base.getRecord();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -