/// <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");
            }
            bool hasStringRec = stringRec != null;
            bool hasCachedStringFlag = formulaRec.HasCachedResultString;
            if (hasStringRec != hasCachedStringFlag)
            {
                throw new RecordFormatException("String record was "
                        + (hasStringRec ? "" : "not ") + " supplied but formula record flag is "
                        + (hasCachedStringFlag ? "" : "not ") + " set");
            }

            if (formulaRec.IsSharedFormula)
            {
                svm.ConvertSharedFormulaRecord(formulaRec);
            }
            _formulaRecord = formulaRec;
            _sharedValueManager = svm;
            _stringRecord = stringRec;
        }
Ejemplo n.º 2
0
 public void Construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh)
 {
     if (rec is FormulaRecord)
     {
         FormulaRecord formulaRec = (FormulaRecord)rec;
         if (formulaRec.IsSharedFormula)
         {
             sfh.ConvertSharedFormulaRecord(formulaRec);
         }
         // read optional cached text value
         StringRecord cachedText=null;
         Type nextClass = rs.PeekNextClass();
         if (nextClass == typeof(StringRecord))
         {
             cachedText = (StringRecord)rs.GetNext();
         }
         else
         {
             cachedText = null;
         }
         InsertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh));
     }
     else
     {
         InsertCell(rec);
     }
 }