Exporting a Report from Code
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.A report can be rendered and saved to any supported format straight from a WPF application — PDF, Word, Excel, text or image.
Render, then export. Prepare the document, then write it to a stream in the chosen format:
How it works. The prepared report is format-agnostic, so a single
Render, then export. Prepare the document, then write it to a stream in the chosen format:
var report = new StiReport();
report.Load(@"Reports\TwoSimpleLists.mrt");
report.Render();
var stream = new MemoryStream();
report.ExportDocument(StiExportFormat.Pdf, stream); // Word2007, Excel2007, Text, ImagePng, ...Render()— builds the document pages in memory; required before exporting.ExportDocument(StiExportFormat, stream)— writes the result; theStiExportFormatenum picks PDF, Word, Excel, text, image and more.
How it works. The prepared report is format-agnostic, so a single
Render() can be exported to as many formats as you need without rebuilding it.