This example shows how to render report in the console app. First, use Load() method to load report template, after that, use ExportDocument() method to Export it to PDF:

static void Main(string[] args)
{
	Console.WriteLine("Hello!");

	Console.Write("Loading report and data... ");

	var report = new StiReport();
	report.Load($"{ReportsDirectory}/TwoSimpleLists.mrt");

	Console.WriteLine("OK");
	Console.Write("Rendering and exporting a report... ");

	var exportFilePath = $"{ReportsDirectory}/TwoSimpleLists_{DateTime.Now.ToString("yyyy-dd-MM_HH-mm-ss")}.pdf";
	report.Render(false);
	report.ExportDocument(StiExportFormat.Pdf, exportFilePath);

	Console.WriteLine("OK");
	Console.WriteLine("Exported to:");
	Console.WriteLine(Path.GetFullPath(exportFilePath));
	Console.ReadKey();
}

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Rendering and Exporting a Report in the Console App

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.