private void miReports_Click(object sender, EventArgs e) { CreateDataSet(); // Form8 frm = new Form8(); // frm.ShowDialog(); // create report instance Report report = new Report(); // load the existing report report.Load(@"..\..\..\report.frx"); // register the dataset report.RegisterData(FDataSet); // run the report report.Prepare(); // create export instance PDFExport export = new PDFExport(); export.Export(report); // free resources used by report report.Dispose(); }
public ActionResult PrintCitizen(string jsonString) { List <Citizen> Citizens = JsonConvert.DeserializeObject <List <Citizen> >(jsonString); Report report = new Report(); report.Load($"{AppDomain.CurrentDomain.BaseDirectory}Reports\\Citizens.frx"); report.RegisterData(Citizens, "Citizens"); report.Prepare(); //report.Design(); var exportPDF = new PDFExport(); var ms = new MemoryStream { Position = 0 }; exportPDF.Export(report, ms); ms.Flush(); ms.Close(); string destinationFileName = Convert.ToBase64String(ms.ToArray()); ms.Close(); return(Json(destinationFileName)); //return Json(null); }
//导出 void UCReport_ExportEvent(object sender, EventArgs e) { string fileName = GetDefaultStyleFile(); // create report instance FastReport.Report report = new FastReport.Report(); if (!string.IsNullOrEmpty(fileName)) { report.Load(fileName); report.RegisterData(dt, styleObject); } else { Report.FastReportEx reportEx = new Report.FastReportEx(); reportEx.dicSpanRows = dicSpanRows; reportEx.dt = dt; reportEx.styleObject = styleObject; reportEx.styleTitle = styleTitle; report = reportEx.DefaultReport(); } if (report == null) { return; } report.Prepare(); PDFExport export = new PDFExport(); export.Export(report); report.Dispose(); }
private string GenderPDF(string model, DataSet ds) { FastReport.Report report = new FastReport.Report(); report.Load(model); report.RegisterData(ds); report.Prepare(); //report.PreparePhase1(); //report.PreparePhase2(); //初始化输出类 PDFExport export = new PDFExport(); //输出 string path = "E:\\lis\\temp.pdf"; export.Export(report, path); return path; }
internal IActionResult PrintPdf() { using (var pdfExport = new PDFExport()) { pdfExport.OpenAfterExport = false; //pdfExport.EmbeddingFonts = PdfEmbeddingFonts; //pdfExport.TextInCurves = PdfTextInCurves; //pdfExport.Background = PdfBackground; //pdfExport.PrintOptimized = PdfPrintOptimized; //pdfExport.Title = PdfTitle; //pdfExport.Author = PdfAuthor; //pdfExport.Subject = PdfSubject; //pdfExport.Keywords = PdfKeywords; //pdfExport.Creator = PdfCreator; //pdfExport.Producer = PdfProducer; //pdfExport.Outline = PdfOutline; //pdfExport.DisplayDocTitle = PdfDisplayDocTitle; //pdfExport.HideToolbar = PdfHideToolbar; //pdfExport.HideMenubar = PdfHideMenubar; //pdfExport.HideWindowUI = PdfHideWindowUI; //pdfExport.FitWindow = PdfFitWindow; //pdfExport.CenterWindow = PdfCenterWindow; //pdfExport.PrintScaling = PdfPrintScaling; //pdfExport.UserPassword = PdfUserPassword; //pdfExport.OwnerPassword = PdfOwnerPassword; //pdfExport.AllowPrint = PdfAllowPrint; //pdfExport.AllowCopy = PdfAllowCopy; //pdfExport.AllowModify = PdfAllowModify; //pdfExport.AllowAnnotate = PdfAllowAnnotate; //pdfExport.PdfCompliance = PdfA ? PDFExport.PdfStandard.PdfA_2a : PDFExport.PdfStandard.None; pdfExport.ShowPrintDialog = true; pdfExport.ExportMode = PDFExport.ExportType.WebPrint; using (MemoryStream ms = new MemoryStream()) { pdfExport.Export(Report, ms); return(new FileContentResult(ms.ToArray(), "application/pdf")); } } }
public IActionResult Pdf(int report) { string strReport = ReportFiles[report]; Report r = new Report(); if (NorthWind == null) { NorthWind = _context.GetDataSet("NorthWind"); } r.RegisterData(NorthWind, "NorthWind"); r.Load(strReport); r.Prepare(); PDFExport export = new PDFExport(); using (MemoryStream ms = new MemoryStream()) { export.Export(r, ms); ms.Flush(); return(File(ms.ToArray(), "application/pdf", Path.GetFileNameWithoutExtension(strReport) + ".pdf")); } }
private string GenderPDF(string model, DataSet ds) { // using (FastReport.Report report = new FastReport.Report()) { report.Load(model); report.RegisterData(ds); report.Prepare(); //报告准备 //report.PreparePhase1(); //report.PreparePhase2(); //初始化PDF输出类 using (PDFExport export = new PDFExport()) { this.InitPDFExport(export); //输出PDF string fileFullName = GetFileFullName(); export.Export(report, fileFullName); return fileFullName; } } }