/// <summary> /// Function to invoke EndEdit() method of specific row index of spread sheet. /// </summary> /// <param name="sheetView"></param> /// <param name="viewRowIndex"></param> /// <returns>If can't end edit return false. Otherwise return true.</returns> public static bool SpreadSheetRowEndEdit(SheetView sheetView, int viewRowIndex) { int rowIndex = sheetView.GetModelRowFromViewRow(viewRowIndex); if (rowIndex == -1) { return(false); } DefaultSheetDataModel defaultSheetDataModel = (DefaultSheetDataModel)sheetView.Models.Data; if (defaultSheetDataModel == null) { return(false); } int dataIndex = defaultSheetDataModel.GetDataRowFromModelRow(rowIndex); if (dataIndex == -1) { return(false); } DataRowView dr = defaultSheetDataModel.GetDataRow(dataIndex); if (dr == null) { return(false); } dr.EndEdit(); return(true); }
/// <summary> /// Get data row from specific view row index. /// </summary> /// <param name="sheetView"></param> /// <param name="viewRowIndex"></param> /// <returns>Return null if can't found data row.</returns> public static DataRowView SpreadGetDataRowFromRowIndex(SheetView sheetView, int viewRowIndex) { int rowIndex = sheetView.GetModelRowFromViewRow(viewRowIndex); if (rowIndex == -1) { return(null); } DefaultSheetDataModel defaultSheetDataModel = (DefaultSheetDataModel)sheetView.Models.Data; if (defaultSheetDataModel == null) { return(null); } int dataIndex = defaultSheetDataModel.GetDataRowFromModelRow(rowIndex); if (dataIndex == -1) { return(null); } DataRowView dr = defaultSheetDataModel.GetDataRow(dataIndex); return(dr); }