public ExcelCells(IGxError errAccess, object ef, int row, int col, int height, int width) { this.errAccess = errAccess; object cells = GxExcelUtils.GetPropValue(GxExcelUtils.GetPropValue(GxExcelUtils.GetPropValue(ef, "Worksheets"), "ActiveWorksheet"), "Cells"); cr = GxExcelUtils.Invoke(cells, "GetSubrangeAbsolute", new Object[] { row, col, row + height, col + width }); GxExcelUtils.SetPropValue(cr, "Merged", true); }
public ExcelCells(IGxError errAccess, ExcelDocument document, object workBook, object selectedSheet, int rowPos, int colPos, int height, int width, bool readOnly) { doc = document; m_errAccess = errAccess; pWidth = width; pHeight = height; cntCells = 0; pColPos = colPos; pSelectedSheet = (ExcelWorksheet)selectedSheet; this.readOnly = readOnly; try { pCellsRange = getExcelCell(rowPos, pColPos, pColPos + (pWidth - 1), rowPos + (pHeight - 1)); pCells = new ExcelRange[width * height + 1]; string address = pCellsRange.Address; int startRow = pCellsRange.Start.Row; int endRow = pCellsRange.End.Row; int startCol = pCellsRange.Start.Column; int endCol = pCellsRange.End.Column; for (int i = startRow; i <= endRow; i++) { for (int j = startCol; j <= endCol; j++) { cntCells++; pCells[cntCells] = pCellsRange[i, j]; } } pCellsRange.Address = address; } catch (Exception e) { GXLogging.Error(log, "ExcelCells error", e); m_errAccess.setErrDes("Invalid cell coordinates"); m_errAccess.setErrCod((short)8); } }
public ExcelCells(IGxError errAccess, ExcelDocument doc, object workBook, object selectedSheet, int rowPos, int colPos, int height, int width) : this(errAccess, doc, workBook, selectedSheet, rowPos, colPos, height, width, false) { }