Hello,
is it possible to set a CrossTab to a fixed width​? The first column (underneath the corner) and the last column (the total column) should also get a fixed width but all columns between them should became the same width wich is calculated by "<remaining space> divided by <number-of-columns>".
I know it could be possible that the content of the columns is truncated because the columns are getting to small but for this case I would dynamically downsize the font size.
Greetings from Germany,
Tobias
4 Answers, 1 is accepted
The Crosstab item does not provide an auto-size or a fixed width out-of-the-box.
You can create the whole Crosstab item programmatically in your application and set its column widths according to custom logic based on your data. Note that this is not a trivial solution and you will need the help of the Reporting API Reference.
Regards,
Nasko
Telerik
Hello Nasko,
thank you for your reponse. I want to create the Crosstab programmatically but where? I am looking for an event like "data source bound" where I can start analyzing the bound data to create the column widths programmatically.
Regards,
Tobias
Hello Nasko,
I got it! I have to use the ItemDataBinding event of the cross table. At this point I can calculate with the data and manipulate the crosstable definition and all of the child items.
I have attached my result.
Regards,
Tobias
Hello,
it's me again. I though I got it but I get it only to work in the preview in the designer but not if I render the report as PDF. If I programmatically render a report and want to set the bound data from outside I can only use the DataSource property of the Report class. Am I right? I am rendering the report as follows:
01.var reportModel = new MainReportModel()02.{03. Orders = Report1._Orders()04.};05. 06.ObjectDataSource objectDataSource = new ObjectDataSource();07.objectDataSource.DataSource = reportModel;08. 09.var report = new Report1();10.report.DataSource = objectDataSource;11. 12.InstanceReportSource instanceReportSource = new InstanceReportSource();13.instanceReportSource.ReportDocument = report;14. 15.ReportProcessor reportProcessor = new ReportProcessor();16.RenderingResult renderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, null);17. 18.File.WriteAllBytes("test.pdf", renderingResult.DocumentBytes);For design time I added a ObjectDataSource of type Order. So I can use the expression designer for example. For render time I added a binding to my crosstable to bind DataSource to the Orders property of MainReportModel. How can I get the bound order list in the ItemDataBinding event to do my calculation of the column width?
Regards,
Tobias