Current filter:
                                You should refresh the page.
                                  • I have several reports which I load the datasource in the Report's BeforePrint event. Some of the reports don't have a datasource set at the report header level but do have it set on a XRPivotGrid or XRTable which is on the detail level. I am exporting several reports together into a single XLSX document. It was requested that the empty reports do not generate tabs in the XLSX output. I tried setting report.ReportPrintOptions.PrintOnEmptyDataSource to false but then nothing printed. I'm guessing its because the datasource is either not set at the header level or because I'm loading the datasource at the BeforePrint event. Below is the code I use to merge up all the reports into one document. Do you have any suggestions on how to add detection on whether the report has data (it currently prints just the header) so that I can skip exporting empty reports?

                                    var firstReport = reports.First(); firstReport.PaperKind = System.Drawing.Printing.PaperKind.Custom; firstReport.PageWidth = 100000000; firstReport.PageHeight = 200000000; //firstReport.ReportPrintOptions.PrintOnEmptyDataSource = false; firstReport.CreateDocument(); foreach (var report in reports.Skip(1)) { report.PaperKind = System.Drawing.Printing.PaperKind.Custom; report.PageWidth = 100000000; report.PageHeight = 200000000; //report.ReportPrintOptions.PrintOnEmptyDataSource = false; report.CreateDocument(); firstReport.Pages.AddRange(report.Pages); } firstReport.ExportOptions.Xlsx.SheetName = "p"; firstReport.ExportOptions.Xlsx.ExportMode = DevExpress.XtraPrinting.XlsxExportMode.SingleFilePageByPage; firstReport.PrintingSystem.ContinuousPageNumbering = true; firstReport.ExportToXlsx(fullPath);
                                • Andrey (DevExpress Support) 09.19.2019

                                  I don't understand your task. For example, a report's DataSource property is not set but the report contains a data source that is assigned to the XRPivorGrid control. The report will be printed if the ReportPrintOptions.PrintOnEmptyDataSource property is set to True. If the data source doesn't contain records, an empty PivotGrid is printed.
                                  So if your task is to not print such a report, the best way is to use the approach illustrated in the Conditionally Suppress Controls help topic. The main idea is to hide all controls if the data source doesn't contain records. Finally, call the XtraReport.CreateDocument method and check out the number of document pages. If it is equal to 0, do not merge this document. If this solution doesn't meet your requirements, provide me with a runnable sample project illustrating the current result and send me a screenshot illustrating the required result.

                                • Andrew Esther1 09.19.2019

                                  Does this example report help? Report has a simple label for a header and a pivotgrid. The report datasource is loaded in the BeforePrint event. Does the ReportPrintOptions.PrintOnEmptyDataSource know to look at the pivotgrid's datasource?

                                  I understand that if the report prints zero pages that would be effective.

                                • Andrey (DevExpress Support) 09.20.2019

                                  I cannot start your project since I don't have your database. I tried to reproduce your actions on my side and there are my results. If the XtraReport.DataSource and XRPivotGrid.DataSource properties are not set, the ReportPrintOptions.PrintOnEmptyDataSource property is set to True and a data source is assigned to Pivot Grid, a report is printed. If the ReportPrintOptions.PrintOnEmptyDataSource property is set to False, a report is not printed.

                                0 Solutions

                                Creation Date Importance Sort by