• 万能打印 下载


    万能打印安装程序下载  链接:http://pan.baidu.com/s/1c28OqFe 密码:bt13

    源码下载  链接:http://pan.baidu.com/s/1c2fIb8s 密码:owvl



    public class PrintHelp { /// <summary> /// 加载打印模板文件方法 /// </summary> /// <param name="ReportPath">模板路径,包括文件名</param> /// <param name="ds">数据源</param> /// <param name="SaveFilePath">编辑模板时保存模板的路径,不包括文件名</param> /// <returns></returns> public static XtraReport ReturnXtraReport(string ReportPath, DataSet ds, string SaveFilePath) { if(ds.Tables.Count<1) { DataTable mfdt = new DataTable(); mfdt.TableName = "mfdt"; DataTable tfdt = new DataTable(); tfdt.TableName = "tfdt"; ds.Tables.Add(mfdt); ds.Tables.Add(tfdt); } XtraReport xtra = XtraReport.FromFile(ReportPath, true); ReportDesignTool dt = new ReportDesignTool(xtra); var designFrom = dt.DesignForm; var mdiController = designFrom.DesignMdiController; dt.DesignForm.DesignMdiController.DesignPanelLoaded += (s, args) => { DesignTool.AddToContainer(args.DesignerHost, ds); }; DevExpress.XtraReports.Native.ReportStorageToolBase.DefaultRootDirectory = SaveFilePath; xtra.DataSource = ds; xtra.DataMember = "mfdt"; return xtra; } /// <summary> /// 加载打印模板文件方法 /// </summary> /// <param name="ReportPath">模板路径,包括文件名</param> /// <param name="ds">数据源</param> /// <param name="SaveFilePath">编辑模板时保存模板的路径,不包括文件名</param> /// <returns></returns> public static XtraReport ReturnNewXtraReport( DataSet ds, string SaveFilePath) { XtraReport xtra = new XtraReport(); ReportDesignTool dt = new ReportDesignTool(xtra); var designFrom = dt.DesignForm; var mdiController = designFrom.DesignMdiController; dt.DesignForm.DesignMdiController.DesignPanelLoaded += (s, args) => { DesignTool.AddToContainer(args.DesignerHost, ds); }; DevExpress.XtraReports.Native.ReportStorageToolBase.DefaultRootDirectory = SaveFilePath; xtra.DataSource = ds; return xtra; } /// <summary> /// 返回主表、明细表 /// </summary> /// <param name="filepath">文件完整路径:含文件名</param> /// <param name="mftablename">主表sheet名称</param> /// <param name="tftablename">从表sheet名称</param> /// <param name="FilesName">两表关联字段</param> /// <returns>DataSet</returns> public static DataSet GetDatase(string filepath, string mftablename, string tftablename, string FilesName) { DataTable mfdt = new DataTable(); DataTable tfdt = new DataTable(); DataSet ds = new DataSet(); ExcelHelp ex = new ExcelHelp(); ex.filePath = filepath;// ex.GetExcelConn(); try { //主表 ex.tableName = mftablename; ex.fileName = "*"; mfdt = ex.GetExcelData(); } finally { if (mfdt == null) { mfdt = new DataTable(); } mfdt.TableName = "mfdt"; ds.Tables.Add(mfdt); } // try { // 从表 ex.tableName = tftablename; ex.fileName = "*"; tfdt = ex.GetExcelData(); } finally { if (tfdt == null) { tfdt = new DataTable(); } tfdt.TableName = "tfdt"; ds.Tables.Add(tfdt); } if (tfdt.Rows.Count > 0 && mfdt.Rows.Count > 0) { //给数据集建立主外键关系 DataColumn parentColumn = ds.Tables["mfdt"].Columns[FilesName]; DataColumn childColumn = ds.Tables["tfdt"].Columns[FilesName]; DataRelation R1 = new DataRelation("R1", parentColumn, childColumn); ds.Relations.Add(R1); } return ds; } /// <summary> /// 获取指定sheet表数据 /// </summary> /// <param name="filepath">Excel路径</param> /// <param name="mftablename">sheet表名称</param> /// <param name="Dttablename">将要给获取的Datatable赋表名(自定义)</param> /// <returns>DataTable</returns> public static DataTable GetDatase(string filepath, string mftablename,string Dttablename) { DataTable mfdt = new DataTable(); ExcelHelp ex = new ExcelHelp(); ex.filePath = filepath;// ex.GetExcelConn(); ex.tableName = mftablename; ex.fileName = "*"; mfdt = ex.GetExcelData(); mfdt.TableName = Dttablename; return mfdt; } }

     

     

     编辑模板

     链接:http://pan.baidu.com/s/1c2wCX80 密码:bddv

  • 相关阅读:
    使用proguard导出项目时 报错
    一个有关canvas的Bug
    一点小想法
    C#调用非托管代码(转)
    对3DES加密的运用的一个简单示例(转)
    使用X.509数字证书加密解密实务(二) 使用RSA证书加密敏感数据(转)
    dtree用法(转)
    使用X.509数字证书加密解密实务(一) 证书的获得和管理(转)
    Oracle SQL Loader的详细语法(转)
    使用X.509数字证书加密解密实务(三) 使用RSA证书结合对称加密技术加密长数据(转)
  • 原文地址:https://www.cnblogs.com/lanyubaicl/p/7744286.html
Copyright © 2020-2023  润新知