Hi,
I receive the following exception when I try to export the report to PDF:
Infragistics.Reports.Engine.EngineException: An error occurred while exporting the report. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Infragistics.Documents.Reports.Graphics.VirtualGraphics.set_Font(Font value)
at Infragistics.Documents.Reports.Report.Text.Text.ComposeUnits(Text text, Composition composition, IGraphics graphics)
at Infragistics.Documents.Reports.Report.Text.Text.Measure(Composition composition, IGraphics graphics, MeasureMode mode)
at Infragistics.Documents.Reports.Report.Group.Measure(Composition composition, IGraphics graphics, MeasureMode mode)
at Infragistics.Documents.Reports.Report.Site.Measure(Composition composition, IGraphics graphics, MeasureMode mode)
at Infragistics.Documents.Reports.Report.Section.Section.Measure(Projection projection, IGraphics graphics)
at Infragistics.Documents.Reports.Report.Report.Measure()
at Infragistics.Documents.Reports.Report.Report.Publish(Stream stream, FileFormat format)
at Infragistics.Reports.Pdf.PdfDocument.Export(Stream targetStream)
at Infragistics.Reports.Engine.ReportExporter.ExportInternal(IReportItemVisitor reportItemVisitor, IDocument document, Stream targetStream, ExportCallback callback, IReportItemRendererFactory factory, IReportItemVisitorCancelationProvider cancelationProvider)
--- End of inner exception stack trace ---
Exception Message:
Object reference not set to an instance of an object.
Stack Trace:
Am I missing something?
FYI:
Export the report to Excel works fine!
Using Silverlight 11.2.20112.1068
Best regards,
Ingo
Hello ingos,
This is just a follow up on the thread if you have any questions in regards to exporting to pdf using the xamReportViewer control and if you require any further assistance with this thread.
Let me know if you have any questions with this matter. Thank you.
hi Duane Hoyt
i tried your sample bt my stream is not rendring in the report viewer , can u please tell explicitly hoew i bind my stream to report.Do consider that m using infragistics reporting 12.1 wpf .Please guide me with respect to wpf based application. i am using client side render settings,my actual task was to export xamdatagrid to pdf bt i couldnt find support of it .Please provide any sample application if possible
Hi Sam,
For the time being it is not possible to integrate the xamdatagrid into the report viewer. In order to display the same data in both places, I would create an object data source, use it to create a report (table) and also bind it to the xamDataGrid. Notice the table doesn't have the same functionalities the xamDataGrid has, but it may be enough if what you are trying to do is just exporting the rows.
Concerning exporting the xamDataGrid to pdf (unfortunately currently not included) you can either export to one of the supported formats (WORD, EXCEL), or use the DataPresenter to export to xps, and then use another tool to convert one of those formats to pdf. Or you might use a pdf printer driver that would save the result of a print operation to a pdf file. Hopefully one of those options will work for you.
Here are same samples on how to:
Export to Excel
Export to Word
Regards,
Miguel.
hi Mighel ,
can u suggest any work around to export xamdatagrid to pdf and displaying xamdatagrid at report viewer?
Hello,
Here is a snippet to load you report (.igr) as a stream and render it in a xamReportViewer on client-side rendering scenarios.
In C#:
Stream reportStream = File.OpenRead(@"C:\test\Report1.igr");
var renderSettings = new ClientRenderSettings();
renderSettings.DefinitionStream = reportStream;
xamReportViewer1.RenderSettings = renderSettings;
reportStream.Close();
Or you can use a more powerful mechanism to map Report URI to files or other locations through a ReportUriResolver as shown here: How to Customize Report Uri Resolution.