See attachments for all input and output files. Below is a small code snippet that is used to reproduce this case.
Code: Select all
static async Task Main(string[] args)
{
Console.WriteLine(StiVersion.Version);
Console.WriteLine(StiVersion.VersionInfo);
await CreateReport();
Console.WriteLine("Done!");
}
private static async Task CreateReport()
{
StiLicense.Key = _licenseKey;
StiOptions.Export.Pdf.CreatorString = "Stimulsoft";
var template = await File.ReadAllBytesAsync("Report.xml");
var data = XDocument.Parse(await File.ReadAllTextAsync("Data.xml"));
var report = new StiReport();
report.Load(template);
LoadData(report, data.Root);
report.CalculationMode = StiCalculationMode.Interpretation;
await report.RenderAsync();
using var stream = new MemoryStream();
await report.ExportDocumentAsync(StiExportFormat.Pdf, stream, new StiPdfExportSettings
{
ImageCompressionMethod = StiPdfImageCompressionMethod.Flate,
ImageResolutionMode = StiImageResolutionMode.Auto
});
stream.Position = 0;
await using var fileStream = new FileStream("Output.pdf", FileMode.Create, FileAccess.Write);
stream.WriteTo(fileStream);
}
private static void LoadData(StiReport report, XElement xmlData)
{
foreach (StiDataSource reportDataSource in report.DataSources)
{
if (reportDataSource is StiVirtualSource)
{
continue;
}
reportDataSource.Dictionary.Databases.Clear();
if (xmlData != null)
{
report.RegData(reportDataSource.Name, xmlData);
}
}
}