/// <summary> /// 文档格式预定义好的,只填写内容 /// </summary> /// <param name="obj"></param> public static void ExportExcel(sdjl_26 obj) { ExcelAccess ex = new ExcelAccess(); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = Application.StartupPath + "\\00记录模板\\送电17防护通知书.xls"; int sz = 30;//一行最多30个 ex.Open(fname); //此处写填充内容代码 ex.ActiveSheet(1); //通知单位 ex.SetCellValue(obj.tzdw, 5, 1); //电压 ex.SetCellValue(obj.lineVol, 6, 7); //线路 ex.SetCellValue(obj.c1, 6, 9); //发现问题 List<string> fxwtList = GetList(obj.fxwt, sz); for (int i = 0; i < fxwtList.Count; i++) { ex.SetCellValue(fxwtList[i], 7+i, 1); if (i > 1) break; } //处理措施 List<string> clcsList = GetList(obj.clcs, sz); for (int i = 0; i < clcsList.Count; i++) { ex.SetCellValue(obj.clcs, 12+i, 1); if (i > 2) break; } ex.ShowExcel(); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(sdjl_26 newobj) { if (parentID == null) return; newobj.ParentID = parentID; //newobj.OrgName = parentObj.OrgName; newobj.CreateDate = DateTime.Now; Ebada.Core.UserBase m_UserBase = MainHelper.ValidateLogin(); newobj.CreateMan = m_UserBase.RealName; }