Jan писал(а):Здравствуйте,
Покажите пожалуйста код, который приводит к такому случаю.
Спасибо.
Код: Выделить всё
var tempFile = new FileInfo(Path.GetTempFileName());
tempFile.Delete();
StiReport masterReport = new StiReport();
PrinterSettings printSettings=null;
foreach (PrintData data in printData)
{
StiReport subReport;
if (File.Exists(tempFile.FullName))
subReport = StiReport.GetReportFromAssembly(tempFile.FullName, true);
else
{
subReport = new StiReport();
subReport.Load(data.fileName);
subReport.Compile(tempFile.FullName);
}
subReport.EngineVersion = StiEngineVersion.EngineV2;
if (!String.IsNullOrEmpty(data.Title))
engine.ReportName = data.Title;
if (data.printerSettings != null)
{
masterReport.PrinterSettings.Collate = data.printerSettings.Collate;
masterReport.PrinterSettings.Copies = data.printerSettings.Copies;
masterReport.PrinterSettings.PrinterName = data.printerSettings.PrinterName;
}
printSettings = data.printerSettings;
subReport.RegData(data.DataSetName, data.DataSetName, data.data);
if (subReport.NeedsCompiling && !subReport.IsCompiled)
subReport.Compile();
subReport.PrinterSettings.ShowDialog = false;
masterReport.SubReports.Add(subReport);
}
if (String.IsNullOrEmpty(printerSettings.PrinterName))
CopyPrinterSettings(masterReport.PrinterSettings, printerSettings);
else
CopyPrinterSettings(printerSettings, masterReport.PrinterSettings);
masterReport.PrinterSettings.ShowDialog = false;
masterReport.Render(false);
if(printSettings == null)
printSettings = new PrinterSettings();
printSettings.DefaultPageSettings.PaperSource = printSettings.PaperSources[1];
var oldPaperSize = StiPrintProvider.PaperSizeForUsing;
StiPrintProvider.PaperSizeForUsing = printSettings.DefaultPageSettings.PaperSize;
StiPrintProvider.SetPaperSource = false;
masterReport.Print(printSettings);
StiPrintProvider.PaperSizeForUsing = oldPaperSize;
StiPrintProvider.SetPaperSource = true;