static void Main(string[] args) { // Provide the page report you want to render. System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\reports\Categories.rdlx"); GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath); // Create an output directory. System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"..\..\ActiveReportsPDF"); outputDirectory.Create(); // Provide settings for your rendering output. GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings(); // Set the rendering extension and render the report. GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension(); GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name)); // Overwrite output file if it already exists outputProvider.OverwriteOutputFile = true; pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting); }
private void viewer_disp() { //ページレポートに接続文字列とクエリ(sql)をセットして表示する GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport(); // レポート定義のファイルをロードします。 rpt.Load(new System.IO.FileInfo("rpt_uriage_denpyou.rdlx")); // 接続文字列を変更します //rpt.Report.DataSources[0].ConnectionProperties.DataProvider = tss.DataSource; rpt.Report.DataSources[0].ConnectionProperties.ConnectString = tss.GetConnectionString(); // 変更するSQL文を定義します String tmpQuery = "select * from tss_uriage_denpyou_trn"; // SQL文を変更します rpt.Report.DataSets[0].Query.CommandText = GrapeCity.ActiveReports.Expressions.ExpressionInfo.Parse(tmpQuery, GrapeCity.ActiveReports.Expressions.ExpressionResultType.String); GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(rpt); viewer1.LoadDocument(pageDocument); //viewer1.LoadDocument("rpt_uriage_denpyou.rdlx"); }
private void viewer_disp() { //ページレポートに接続文字列とクエリ(sql)をセットして表示する GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport(); // レポート定義のファイルをロードします。 rpt.Load(new System.IO.FileInfo("rpt_uriage_denpyou.rdlx")); // 接続文字列を変更します //rpt.Report.DataSources[0].ConnectionProperties.DataProvider = tss.DataSource; rpt.Report.DataSources[0].ConnectionProperties.ConnectString = tss.GetConnectionString(); // 変更するSQL文を定義します String tmpQuery = "select * from tss_uriage_denpyou_trn"; // SQL文を変更します rpt.Report.DataSets[0].Query.CommandText = GrapeCity.ActiveReports.Expressions.ExpressionInfo.Parse(tmpQuery,GrapeCity.ActiveReports.Expressions.ExpressionResultType.String); GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(rpt); viewer1.LoadDocument(pageDocument); //viewer1.LoadDocument("rpt_uriage_denpyou.rdlx"); }