//public CellUpdate(Int32 row, Int32 col, String WS, CellStyleExt cext) //{ // this.Row = row; // this.Col = col; // this.Worksheet = WS; // this.Cext = cext; //} public CellUpdate(Int32 row, Int32 col, String WS, String val, Enums.CellChangeType type, String changeAuthor, DateTime changeTime) { this.Row = row; this.Col = col; this.Worksheet = WS; this.val = val; this.TypeEnum = type; this.changeTime = changeTime; this.changeAuthor = changeAuthor; UpdateWSBounds(); }
public static CellUpdate Create(DataRow dr) { try { Int32 iRow = Int32.Parse(dr["Excel_Row"].ToString()); Int32 iCol = Int32.Parse(dr["Excel_Column"].ToString()); String iWorksheet = dr["Worksheet"].ToString(); String ival = dr["Cell_Value"].ToString(); String iType = dr["Change_Type"].ToString(); String iChangeAuthor = dr["Change_Author"].ToString(); DateTime iChangeTime = (DateTime)dr["Change_Time"]; Enums.CellChangeType type = (iType == "Value" ? Enums.CellChangeType.Value : iType == "Comment" ? Enums.CellChangeType.Comment : Enums.CellChangeType.Value); return(new CellUpdate(iRow, iCol, iWorksheet, ival, type, iChangeAuthor, iChangeTime)); } catch (Exception ex) { GlobalFunctions.ErrorLog(ex); throw; } }
public CellUpdate(Excel.Range cell, Enums.CellChangeType type) { Excel.Comment comment = null; try { Row = cell.Row; Col = cell.Column; Worksheet = cell.Worksheet.Name.ToUpper(); this.TypeEnum = type; switch (TypeEnum) { case Enums.CellChangeType.Value: val = cell.Formula == null ? "" : cell.Formula.ToString(); break; case Enums.CellChangeType.Comment: comment = cell.Comment; val = comment == null ? "" : comment.Text(); break; } UpdateWSBounds(); } catch (Exception ex) { GlobalFunctions.ErrorLog(ex); throw; } finally { if (comment != null) { Marshal.ReleaseComObject(comment); } } }