public static void GenerRptWithXml(Entity en, string cyclostyfilename) { string temp = Web.WebUser.No + DateTime.Now.ToString("yyyyMMddhhmmss") + ".Doc"; BP.Rpt.Rtf rpt = new BP.Rpt.Rtf(); rpt.LoadCyclostyle(cyclostyfilename, temp); rpt.DataEns.AddEntity(en); rpt.MakeDocument(); string url = System.Web.HttpContext.Current.Request.ApplicationPath + "Temp/" + rpt.FileName; PubClass.OpenWordDoc(url, rpt.FileName); }
/// <summary> /// 产生一个报表 /// </summary> /// <param name="ens">要产生报表的集合</param> /// <param name="cyclostyfilename">参数文件名称。</param> public static string GenerRptByPeng(Entity en) { string temp = Web.WebUser.No + DateTime.Now.ToString("yyyyMMddhhmmss") + ".Doc"; BP.Rpt.Rtf rpt = new BP.Rpt.Rtf(); string BillTemplatePath = SystemConfig.GetConfigXmlEns("BillTemplatePath", en.GetNewEntities.ToString()); if (BillTemplatePath == null) { throw new Exception("生成单据出现错误:您没有在ConfigEns.xml设置他的单据模板位置。"); } rpt.LoadCyclostyle(BillTemplatePath, temp); rpt.DataEns.AddEntity(en); rpt.MakeDocument(); string url = System.Web.HttpContext.Current.Request.ApplicationPath + "Temp/" + rpt.FileName; PubClass.OpenWordDoc(url, rpt.FileName); return(url); }