/// <summary> /// Initializes a new instance of the <see cref="FormulaRecordAggregate"/> class. /// </summary> /// <param name="formulaRec">The formula rec.</param> /// <param name="stringRec">The string rec.</param> /// <param name="svm">The SVM.</param> public FormulaRecordAggregate(FormulaRecord formulaRec, StringRecord stringRec, SharedValueManager svm) { if (svm == null) { throw new ArgumentException("sfm must not be null"); } if (formulaRec.HasCachedResultString) { if (stringRec == null) { throw new RecordFormatException("Formula record flag is set but String record was not found"); } _stringRecord = stringRec; } else { // Usually stringRec is null here (in agreement with what the formula rec says). // In the case where an extra StringRecord is erroneously present, Excel (2007) // ignores it (see bug 46213). _stringRecord = null; } _formulaRecord = formulaRec; _sharedValueManager = svm; if (formulaRec.IsSharedFormula) { CellReference firstCell = formulaRec.Formula.ExpReference; if (firstCell == null) { HandleMissingSharedFormulaRecord(formulaRec); } else { _sharedFormulaRecord = svm.LinkSharedFormulaRecord(firstCell, this); } } }
public override Object Clone() { StringRecord rec = new StringRecord(); rec._is16bitUnicode = this._is16bitUnicode; rec._text = this._text; return rec; }
/// <summary> /// Sets the cached error result. /// </summary> /// <param name="errorCode">The error code.</param> public void SetCachedErrorResult(int errorCode) { _stringRecord = null; _formulaRecord.SetCachedResultErrorCode(errorCode); }
/// <summary> /// Sets the cached boolean result. /// </summary> /// <param name="value">if set to <c>true</c> [value].</param> public void SetCachedBooleanResult(bool value) { _stringRecord = null; _formulaRecord.SetCachedResultBoolean(value); }
/// <summary> /// Sets the cached string result. /// </summary> /// <param name="value">The value.</param> public void SetCachedStringResult(String value) { // Save the string into a String Record, creating one if required if (_stringRecord == null) { _stringRecord = new StringRecord(); } _stringRecord.String=(value); if (value.Length < 1) { _formulaRecord.SetCachedResultTypeEmptyString(); } else { _formulaRecord.SetCachedResultTypeString(); } }
public void SetCachedDoubleResult(double value) { _stringRecord = null; _formulaRecord.Value = value; }