internal override void Execute(ExcelFile Workbook, TWaitingCoords Coords, TBand Band) { int t, l, b, r; GetBounds(Coords, out t, out l, out b, out r); int fr = Math.Min(t, b); int fc = Math.Min(l, r); int lr = Math.Max(t, b); int lc = Math.Max(l, r); TValueAndXF val = new TValueAndXF(); val.Workbook = Workbook; XFDef.Evaluate(0, 0, 0, 0, val); TConfigFormat fmt = FormatList.GetValue(FlxConvert.ToString(val.Value)); if (fmt.ApplyFmt == null) { Workbook.SetCellFormat(fr, fc, lr, lc, fmt.XF); } else { Workbook.SetCellFormat(fr, fc, lr, lc, Workbook.GetFormat(fmt.XF), fmt.ApplyFmt, fmt.ExteriorBorders); } }
internal override object Evaluate(TParsedTokenList FTokenList, TWorkbookInfo wi, TBaseAggregate f, TCalcState STotal, TCalcStack CalcStack) { TValueAndXF val = new TValueAndXF(); val.FullDataSetColumnIndex = wi.FullDataSetIndex; val.Workbook = wi.Xls; val.DebugStack = wi.DebugStack; Data.Evaluate(wi.Row, wi.Col, wi.RowOfs, wi.ColOfs, val); return(ConvertToAllowedObject(val.Value)); }
internal static double Eval(ExcelFile Workbook, TOneCellValue v) { if (v == null) { return(0); } TValueAndXF val = new TValueAndXF(); val.Workbook = Workbook; v.Evaluate(0, 0, 0, 0, val); return(Convert.ToDouble(val.Value)); }
protected void CalcBounds(TOneCellValue aRange) { TValueAndXF val = new TValueAndXF(); val.Workbook = aRange.Workbook; aRange.Evaluate(0, 0, 0, 0, val); TXlsNamedRange XlsRange = val.Workbook.GetNamedRange(FlxConvert.ToString(val.Value), -1, val.Workbook.ActiveSheet); if (XlsRange == null) { XlsRange = val.Workbook.GetNamedRange(FlxConvert.ToString(val.Value), -1, 0); } if (XlsRange != null) { FTop = XlsRange.Top; FLeft = XlsRange.Left; Bottom = XlsRange.Bottom; Right = XlsRange.Right; Sheet1 = XlsRange.SheetIndex; Sheet2 = XlsRange.SheetIndex; RowAbs1 = false; ColAbs1 = false; RowAbs2 = false; ColAbs2 = false; return; } string[] Addresses = FlxConvert.ToString(val.Value).Split(TFormulaMessages.TokenChar(TFormulaToken.fmRangeSep)); if (Addresses == null || (Addresses.Length != 2 && Addresses.Length != 1)) { FlxMessages.ThrowException(FlxErr.ErrInvalidRef, FlxConvert.ToString(val.Value)); } TCellAddress FirstCell = new TCellAddress(Addresses[0]); if (FirstCell.Sheet == null || FirstCell.Sheet.Length == 0) { Sheet1 = -1; } else { Sheet1 = aRange.Workbook.GetSheetIndex(FirstCell.Sheet); } FTop = FirstCell.Row; FLeft = FirstCell.Col; RowAbs1 = FirstCell.RowAbsolute; ColAbs1 = FirstCell.ColAbsolute; if (Addresses.Length > 1) { FirstCell = new TCellAddress(Addresses[1]); } if (FirstCell.Sheet == null || FirstCell.Sheet.Length == 0) { Sheet2 = Sheet1; } else { Sheet2 = aRange.Workbook.GetSheetIndex(FirstCell.Sheet); } Bottom = FirstCell.Row; Right = FirstCell.Col; RowAbs2 = FirstCell.RowAbsolute; ColAbs2 = FirstCell.ColAbsolute; }