void ucpJ_14aqgj1_FocusedRowChanged(object sender, sdjl_aqgj obj) { ucpJ_14aqgjsy1.ParentID = ""; ucpJ_14aqgjsy1.PSObj = null; ucpJ_14aqgjsy1.PSObj = obj; }
/// <summary> /// 文档格式预定义好的,只填写内容 /// </summary> /// <param name="obj"></param> public static void ExportExcel(sdjl_aqgj obj,IList<sdjl_14aqgjsy> objlist) { //lgm ExcelAccess ex = new ExcelAccess(); SaveFileDialog saveFileDialog1 = new SaveFileDialog(); string fname = Application.StartupPath + "\\00记录模板\\送电13电力安全工具试验记录.xls"; ex.Open(fname); //计算页码 int pagecout = Ecommon.GetPagecount(objlist.Count, 17); //复制空模板并重命名 for (int m = 1; m < pagecout; m++) { ex.CopySheet(1, m); ex.ReNameWorkSheet(m + 1, "Sheet" + (m + 1)); } for (int p = 0; p < pagecout; p++) { ex.ActiveSheet(p + 1); for (int i = 0; i < 17; i++) { if (p * 17 + i >= objlist.Count) { break; } sdjl_14aqgjsy tempobj = objlist[p * 17 + i]; //时间 ex.SetCellValue(tempobj.rq.Year.ToString(), 8 + i, 1); ex.SetCellValue(tempobj.rq.Month.ToString(), 8 + i, 2); ex.SetCellValue(tempobj.rq.Day.ToString(), 8 + i, 3); // ex.SetCellValue(tempobj.jr, 8 + i, 4); //送检人 //ex.SetCellValue(tempobj.sjr, 8 + i, 5); //实验人 ex.SetCellValue(tempobj.syr, 8 + i, 5); //安监签字 ex.SetCellValue(tempobj.ajqz, 8 + i, 6); //下次实验日期 ex.SetCellValue(tempobj.xcsyrq.Year.ToString(), 8 + i, 7); ex.SetCellValue(tempobj.xcsyrq.Month.ToString(), 8 + i, 8); ex.SetCellValue(tempobj.xcsyrq.Day.ToString(), 8 + i, 9); } } ex.ActiveSheet(1); ex.SetCellValue(obj.sbName, 5, 1); if (obj.sbCode.Contains(obj.sbName)) { ex.SetCellValue(obj.sbCode, 5, 4); } else { ex.SetCellValue(obj.sbCode, 5, 4); } ex.SetCellValue(obj.syzq.ToString()+"年", 5, 5); ex.SetCellValue(obj.syxm, 5, 6); ex.ActiveSheet(1); ex.ShowExcel(); }
/// <summary> /// 新建对象设置Key值 /// </summary> /// <param name="newobj"></param> void gridViewOperation_CreatingObjectEvent(sdjl_aqgj newobj) { if (parentID == null) return; newobj.OrgID = parentID; //newobj.OrgCode = parentID; //newobj.OrgName = parentObj.OrgName; //newobj.CreateDate = DateTime.Now; //newobj.CreateMan = MainHelper.LoginName; }