Argument Out of Range exporting to PDF from Preview
Hi,
I'm using VS2002 with VB Net. I have a report master-detail with 2 pages. The report is perfectly with following code:
Report.Load(RutaTemporal)
' Set connection string
Report.Dictionary.Connections(0).ConnectionString = DAL.CnSQL
DSCabecera = Report.GetDataSource("TblCabecera")
DSDetalle = Report.GetDataSource("TblDetalle")
DSCabecera.Enabled = True
DSDetalle.Enabled = True
Report.Prepare()
Report.ShowPrepared()
The report is correctly shown, with the 2 pages expected.
In the "Preview", I select "Save --> Adobe Acrobat" and I select a file in the "Download" folder. When I accept, I get following message:
FastReport .NET v2023.2.17
El índice estaba fuera del intervalo. Debe ser un valor no negativo e inferior al tamaño de la colección.
Nombre del parámetro: index
en System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
en System.Collections.Generic.List`1.set_Item(Int32 index, T value)
en FastReport.Export.Pdf.PDFExport.WriteFont(ExportTTFFont pdfFont)
en FastReport.Export.Pdf.PDFExport.AddPDFFooter()
en FastReport.Export.Pdf.PDFExport.Finish()
en FastReport.Export.ExportBase.Export(Report report, Stream stream)
en FastReport.Export.ExportBase.Export(Report report, String fileName)
en FastReport.Export.ExportBase.Export(Report report, List`1 pages)
en FastReport.Preview.PreviewControl.Export_Click(Object sender, EventArgs e)
Furthermore, I can see on top "Exporting page 1 of 2".
I've checked in the Report and I didn't see anything unusual (obviously it shoud be, but I don't see). Any idea about how to proceed?
Best regards,
Venancio Lasquibar
Comments
Hi,
I found the reason. In one of the datasets used, some rows had "NULL" values for some columns,although that values weren't shown in the report.
I've modified the dataset to coalesce the NULL values, and the error disappeared.
Best regards,
I uncovered the rationale. Although the report did not display the values, one of the datasets included rows with "NULL" values for certain columns.
After merging the NULL values in the dataset, the error went away