//private static BindingFlags s_flag = BindingFlags.Instance | BindingFlags.Public; //private static Document doc = new Document(FileManage.GetReportModelFolderPath()); public static string SaveReport(Report_param report) { try { Document doc = new Document(FileManage.GetReportModelFolderPath()); //使用报告模板 doc.Properties.FormFieldShading = true; //清除表单域阴影 //--------------------------- try { foreach (PropertyInfo p in report.ReportParam.GetType().GetProperties()) { if (p.Name == "targetRects") { List <TargetRect> targets = p.GetValue(report.ReportParam) as List <TargetRect>; foreach (TargetRect item in targets) { RepalceTargetAreaElement(doc, "TopMaxTemperature", item.id, item.TopMaxTemperature); RepalceTargetAreaElement(doc, "BottomMaxTemp", item.id, item.BottomMaxTemp); RepalceTargetAreaElement(doc, "PictureDesc", item.id, item.PictureDesc); RepalceTargetAreaElement(doc, "Reference", item.id, item.Reference); RepalcePicture(doc, item, item.fileName); //插图 } } else { RepalceBaseInfoElement(doc, p.Name, report.ReportParam); // 替换基本信息 } } } catch (Exception ex) { throw ex; } string reprotname = FileManage.GenerateFileName(null) + ReportFormat; string save_path = Path.Combine(FileManage.GetReportSaveFolderPath(), reprotname); doc.SaveToFile(save_path, FileFormat.Doc); return(save_path); } catch (Exception ex) { throw ex; } }