public static List <Kernel.Ui.Office.RangeItem> getRangeItem(String Range) { if (!Range.Contains(RANGE_SEPARATOR)) { return(null); } String range = Range.ToUpper().Trim(); bool canContinue = range.Length >= 4; if (!canContinue) { return(null); } canContinue = Regex.Matches(Range, RANGE_SEPARATOR, RegexOptions.IgnoreCase).Count < 2; if (!canContinue) { return(null); } String[] rangeTab = range.Trim().Split(RANGE_SEPARATOR.ToCharArray()[0]); canContinue = rangeTab.Length >= 1 && rangeTab.Length <= 3; if (!canContinue) { return(null); } int length = rangeTab.Length - 1; // rangeTab = length > 0 ? new String[] { rangeTab[length - 1] + rangeTab[length] } : new String[] { rangeTab[length] }; List <Kernel.Ui.Office.RangeItem> RangeItems = new List <Ui.Office.RangeItem>(); for (int i = 0; i <= rangeTab.Length - 1; i++) { Point?coords = getCoords(rangeTab[i]); if (coords == null) { return(null); } Kernel.Ui.Office.RangeItem rangeItem = new Ui.Office.RangeItem((int)coords.Value.X, (int)coords.Value.X, (int)coords.Value.Y, (int)coords.Value.Y); RangeItems.Add(rangeItem); } return(RangeItems); }
public static Resultat getListCell(int startLine, int endLine, int startCol, int endCol, int pageSize = 500) { List <Kernel.Ui.Office.Cell> liste = new List <Ui.Office.Cell>(0); Resultat rest = new Resultat(); Kernel.Ui.Office.RangeItem rangeCount = new Ui.Office.RangeItem(startLine, endLine, startCol, endCol); int reste = rangeCount.CellCount % pageSize; int pageCount = (rangeCount.CellCount / pageSize) + (reste > 0 ? 1 : 0); int count = 0; int l = 0; int c = 0; for (l = startLine; l <= endLine; l++) { for (c = startCol; c <= endCol; c++) { Kernel.Ui.Office.Cell cell = new Kernel.Ui.Office.Cell(l, c); liste.Add(cell); count++; if (count == pageSize) { startLine = l + 1; startCol = c + 1; rest.liste = liste; rest.row1 = l + 1; rest.row2 = endLine; rest.Col1 = c + 1; rest.Col2 = endCol; return(rest); } } } rest.liste = liste; rest.row1 = l + 1; rest.row2 = endLine; rest.Col1 = c + 1; rest.Col2 = endCol; return(rest); }
public static Kernel.Ui.Office.RangeItem getCount(String range) { List <Point> borne = getCellsCoord(range); List <Kernel.Ui.Office.Cell> listCel = new List <Ui.Office.Cell>(0); startLine = (int)borne[0].Y; endLine = startLine; startCol = (int)borne[0].X; endCol = startCol; try { endLine = (int)borne[1].Y; endCol = (int)borne[1].X; } catch (Exception) { } Kernel.Ui.Office.RangeItem rangeCount = new Ui.Office.RangeItem(startLine, endLine, startCol, endCol); return(rangeCount); }