Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            TfrxReportClass report;

            report = new TfrxReportClass();
            report.ReportOptions.ConnectionName = @"Database=database1;Data Source=127.0.0.1;User Id=root;Password="******"C:/Users/Asus/Desktop/1.fr3");
            // report.DesignReport(); редактирование отчета
            report.ShowReport();
            report.PrintOptions.PageNumbers = "";
            report.ExportToPDF("export1.txt", true, true, true, true, "", "");
        }
Exemplo n.º 2
0
        /// <summary>
        /// 导出报表数据
        /// </summary>
        /// <param name="report">报表实例</param>
        /// <returns></returns>
        public string ExportToFile(TfrxReportClass report)
        {
            string fileName = Path.GetTempPath() + @"\_rpt" + DateTime.Now.ToString("yyyyMMddhhmmss") + "_" + Loginer.CurrentUser.Account;

            if (ExportType.PDF == _exportType)//PDF
            {
                fileName = fileName + ".pdf";
                report.ExportToPDF(fileName, false, false, false);
            }
            else if (ExportType.XLS == _exportType)//XLS
            {
                fileName = fileName + ".xls";
                report.ExportToXLS(fileName, true, false, false, false, true);
            }
            else if (ExportType.HTML == _exportType)//HTML
            {
                fileName = fileName + ".html";
                report.ExportToHTML(fileName, true, true, false, false, true, true);
            }

            return(fileName);
        }