G
goo
Guest
Cool ! I will check it out… //Geir Otto Fra: Bill Wood [mailto:bounce-wood@community.progress.com] Sendt: 4. februar 2015 15:06 Til: TU.OE.Development@community.progress.com Emne: RE: [Technical Users - OE Development] Telerik CsvDataSource - how do I find it? RE: Telerik CsvDataSource - how do I find it? Reply by Bill Wood (I was able to get a quick turnaround on the answer -- I am repeating it 'verbatim', and it is not ABL-ready code -- so I hope you can translate.....) Hi goo, You have a report definition that is in trdx format. Your requirement is to change the definition at runtime a little bit in some way. In order to do that you need to first load the report definition as a report instance – an instance of the Telerik.reporting.Report class. Then you may use the Telerik.Reporting API to to tweak the report and then pass it as an InstanceReportSource to the report viewer. Sample 1 See the code below as an example how to deserialize the report trdx definition (note that all code samples are written in CSharp) (source: http://www.telerik.com/help/reporting/programmatic-xml-serialization.html ): System.Xml.XmlReaderSettings settings = new System.Xml.XmlReaderSettings(); settings.IgnoreWhitespace = true; using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create("Report1.xml", settings)) { Telerik.Reporting.XmlSerialization.ReportXmlSerializer xmlSerializer = new Telerik.Reporting.XmlSerialization.ReportXmlSerializer(); Telerik.Reporting.Report report = (Telerik.Reporting.Report) xmlSerializer.Deserialize(xmlReader); } Sample 2 Now that you have the report instance use the reporting API to modify the data source ( http://www.telerik.com/help/reporting/p_telerik_reporting_csvdatasource_source.html ): var csvDataSource = (CsvDataSource)report.DataSource; csvDataSource.Source = new Uri(“C:\Users\Temp\slettme.csv”) Sample 3 Then pass the modified report instance to the report viewer control and refresh the rendered report: Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource(); // Assigning the Report object to the InstanceReportSource instanceReportSource.ReportDocument = report; this.reportViewer1.ReportSource = instanceReportSource; this.reportViewer1.Refreshreport(); Hope that helps. There is another approach which will require much easier modification of the csv path – in the definition to change the path to the csv to be an expression like = Parameters.CsvPath And add such report parameter to the report definition. Then in the viewer setup code you may use UriReportSource with parameter value. See http://www.telerik.com/help/reporting/report-sources-viewers.html Stop receiving emails on this subject. Flag this post as spam/abuse. No virus found in this message. Checked by AVG - www.avg.com Version: 2015.0.5646 / Virus Database: 4273/9047 - Release Date: 02/02/15
Continue reading...
Continue reading...