reporting-docs/embedding-reports/generate-reports-locally.md

46 строки
4.8 KiB
Markdown
Исходник Постоянная ссылка Обычный вид История

Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
---
title: Generating Reports Locally
page_title: Generating Reports Programmatically
description: "Learn how to locally generate reports by using the embedded report engine when working with Telerik Reporting."
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
slug: telerikreporting/using-reports-in-applications/call-the-report-engine-via-apis/embedded-report-engine
previous_url: /using-reports-in-applications/call-the-report-engine-via-apis/embedded-report-engine, /programmatic-exporting-report
tags: telerik, reporting, embedding, reports, embedded, engine, generate, locally
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
published: True
position: 4
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
---
# Generating Reports Locally with Code
Telerik Reporting allows you to use the embedded report engine and generate your reports locally.
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
## Requirements
To export a report, you can use the __[RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_)__ method of the [ReportProcessor](/api/Telerik.Reporting.Processing.ReportProcessor) class. This method converts the contents of the report to a byte array in the specified format, which you can then use with other classes such as [MemoryStream](https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream?view=net-7.0) or [FileStream](https://learn.microsoft.com/en-us/dotnet/api/system.io.filestream?view=net-7.0).
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
The [RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_) method has two overloads, the first is used when rendering a single stream, the second when rendering multiple streams. The available extensions used as first argument of the [RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_) method are listed in the [Export Formats]({%slug telerikreporting/using-reports-in-applications/export-and-configure/export-formats%}) article.
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
## Exporting a report to a single document format
Some formats (MHTML, PDF, XLS(X), RTF, DOCX, PPTX, CSV) produce a single document which is handled by the first overload of the [RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_):
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
{{source=CodeSnippets\CS\API\Telerik\Reporting\Processing\ReportProcessorSnippets.cs region=Export_Single_Stream_Snippet}}
{{source=CodeSnippets\VB\API\Telerik\Reporting\Processing\ReportProcessorSnippets.vb region=Export_Single_Stream_Snippet}}
>note When you export programmatically to __XPS__, you should use a separate STA thread which is required by the underlying WPF UI elements that we use to create the XAML representation of the report.
Reporting md test (#294) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction * angular articles fixed * web designer articles edited * Html5 Viewer articles edited manually Co-authored-by: Kaloyan Pavlov <kpavlov@progress.com>
2022-01-19 22:42:49 +03:00
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
## Exporting a report to a multi document format
Some formats produce multiple files, for example HTML outputs all pages and related resources (images) in separate streams. In order to render a report in a non-single document format (HTML and IMAGE except TIFF) one should use the second [RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_Telerik_Reporting_Processing_CreateStream_System_String__) overload that accepts a [CreateStream](/api/Telerik.Reporting.Processing.CreateStream) callback.
> When exporting a [ReportBook]({%slug telerikreporting/designing-reports/report-book/overview%}) with the ReportProcessor in TIFF format you have to use the multi document format.
For this example we're going to render to JPEG, but you can render a report in all graphic formats that GDI+ supports natively - this includes BMP, GIF, JPEG, PNG, TIFF and metafile (EMF). The [Windows Forms Application]({%slug telerikreporting/using-reports-in-applications/display-reports-in-applications/windows-forms-application/overview%}) uses internally metafile for rendering the reports for viewing, and TIFF for exporting. The rest of the formats are available only through code using the ReportProcessor.Render method where you should specify "IMAGE" as export format and the additional output format that is the actual graphic format - BMP, GIF, JPEG. Here is an example that renders a report as a JPEG image:
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
{{source=CodeSnippets\CS\API\Telerik\Reporting\Processing\ReportProcessorSnippets.cs region=Export_CreateStream_Callback_Snippet}}
{{source=CodeSnippets\VB\API\Telerik\Reporting\Processing\ReportProcessorSnippets.vb region=Export_CreateStream_Callback_Snippet}}
## See Also
Merge from reporting-MD-test to master (#291) * added config and readme * all MDs added * KB links changed to relative paths slugs don't work for KBs * designing-reports\report-sources edited * minor change * designing-reports\connecting-to-data main edited * designing-reports\connecting-to-data\troubleshooting edited * manually edited report parameters articles * MD articles refurbished * tip/note slugs not working fixed * added index for the api ref * added api ref docfx-tmpl * KBs referenced with slugs in edited articles Also index.md references made relative * Update telerik-reporting-r3-2016---upgrade-issues-with-objectdatasource-component.md * Update use-temporary-tables-in-stored-procedure.md * updated the tool and the MDs * data items - filtering data checked manually * verified datasource components main * templates and styles adapted from wpf * Add files via upload * see also and whitespace handled better * Update how-to-connect-to-a-sql-database.md * Update TodorReadme.txt * tokens values added in config * further improvement in whitespace handling * entitydatasource edited * some more datasource components edited * designing report - connecting to data articles finished * react article added * added test redirects * slug naming and autoredirects improved * main toc and trial banner fixed * react viewer added and tokens replaced * react articles correction * link fixed * react articles fixed to great extent * react articles nested lists and tables fixed * added new release and processing-element * redirects corrected * reporting overview redirect to introduction Co-authored-by: Todor Arabadzhiev <todor_ia@abv.bg> Co-authored-by: Todor Arabadzhiev <todor.arabadzhiev@progress.com>
2022-01-18 14:36:43 +03:00
* [RenderReport](/api/Telerik.Reporting.Processing.ReportProcessor#Telerik_Reporting_Processing_ReportProcessor_RenderReport_System_String_Telerik_Reporting_ReportSource_System_Collections_Hashtable_)