internal static void SetCellFromString(ExcelFile Workbook, int r, int c, string p, string[] DateFormats) { if (Workbook.VirtualMode) { int XF = FlxConsts.DefaultFormatId; CellValue cv = new CellValue(Workbook.ActiveSheet, r, c, Workbook.ConvertString(new TRichString(p), ref XF, DateFormats), -1); if (cv.Value is DateTime) { cv.Value = TExcelTypes.ConvertToAllowedObject(cv.Value, Workbook.OptionsDates1904); } cv.XF = XF; Workbook.OnVirtualCellRead(Workbook, new VirtualCellReadEventArgs(cv)); } else { Workbook.SetCellFromString(r, c, p, DateFormats); } }
internal static readonly TCellComparer Instance = new TCellComparer(); //STATIC* #region IComparer Members public int Compare(object x, object y) { x = TExcelTypes.ConvertToAllowedObject(x, TBaseParsedToken.Dates1904); y = TExcelTypes.ConvertToAllowedObject(y, TBaseParsedToken.Dates1904); //null values go always at the bottom. (in ascending or descending order) if (x == null) { if (y == null) { return(0); } return(1); } if (y == null) { return(-1); } if (x is TFlxFormulaErrorValue) { if (y is TFlxFormulaErrorValue) { return(((int)x).CompareTo((int)y)); } return(1); } if (y is TFlxFormulaErrorValue) { return(-1); } object Result = TBaseParsedToken.CompareValues(x, y); if (Result is int) { return((int)Result); } return(0); }
internal TSearchOrReplace(bool aDates1904, object aSearchItem, bool aCaseInsensitive, bool aSearchInFormulas, bool aWholeCellContents) { SearchItem = TExcelTypes.ConvertToAllowedObject(aSearchItem, aDates1904); SearchStr = aSearchItem as String; FCaseInsensitive = aCaseInsensitive; if (aCaseInsensitive) { FStringComparison = StringComparison.CurrentCultureIgnoreCase; } else { FStringComparison = StringComparison.CurrentCulture; } FSearchInFormulas = aSearchInFormulas; FWholeCellContents = aWholeCellContents; if (SearchItem != null) { SearchToStr = aSearchItem.ToString(); UpperSearchItem = SearchToStr.ToUpper(CultureInfo.CurrentCulture); } }