private void PrintAll(int type_flg) { if (treeView1.SelectedNode == null) { TXMessageBoxExtensions.Info("请选择你要打印的内容"); return; } DataTable dt = new DataTable(); dt.Columns.Add("title", typeof(string)); dt.Columns.Add("filed", typeof(string)); IList <MDL.T_CellAndEFile> cellList = null; if (type_flg == 0) { CreateCellTemp(ref dt, treeView1.SelectedNode); if (dt.Rows.Count == 0) { TXMessageBoxExtensions.Info("无任何文件可以打印"); return; } delPrintPDF del = new delPrintPDF(Printcells); frmPrintCell frm = new frmPrintCell(dt.DefaultView, del, true); frm.ShowDialog(); } else { cellList = treesData.GetNodeChildren(treeView1.SelectedNode.Name, Globals.ProjectNO, Globals.ProjectPath, type_flg); if (cellList != null && cellList.Count > 0) { foreach (MDL.T_CellAndEFile cellAndEFile_mdl in cellList) { if (!MyCommon.CheckFillSuffix(cellAndEFile_mdl.filepath, ".cll")) { continue; } dt.Rows.Add(new object[] { cellAndEFile_mdl.title, Globals.ProjectPath + "\\" + cellAndEFile_mdl.filepath }); } if (dt.Rows.Count == 0) { TXMessageBoxExtensions.Info("无任何文件可以打印"); return; } delPrintPDF del = new delPrintPDF(Printcells); frmPrintCell frm = new frmPrintCell(dt.DefaultView, del, true); frm.ShowDialog(); } else { TXMessageBoxExtensions.Info("无任何文件可以打印"); } } }
private void CreateCellTemp(ref DataTable dt, TreeNode node) { //查找模板表 如果有记录就添加过来 如果没有就不添加 显示空 IList <MDL.T_CellFileTemplate> EFTemplate_List = (new BLL.T_CellFileTemplate_BLL()).FindByFileID(node.Name); if (EFTemplate_List != null && EFTemplate_List.Count > 0) { foreach (MDL.T_CellFileTemplate c_template in EFTemplate_List) { if (!MyCommon.CheckFillSuffix(c_template.filepath, ".cll")) { continue; } dt.Rows.Add(new object[] { c_template.title, Application.StartupPath + "\\Template" + c_template.filepath }); } } foreach (TreeNode node_temp in node.Nodes) { CreateCellTemp(ref dt, node_temp); } }