ActiveReports 9
Rendering to XML
Show AllShow All
Hide AllHide All

XML is a useful format for delivering data to other applications as the resulting XML file opens in an internet browser. You can use the XmlRenderingExtension to render your report in this format. XML is a good format for delivering data to other applications. The resulting XML file opens in an internet browser

In order to render your report in XML, add reference to the following assemblies in the project:

The following steps provide an example of rendering a report in the Xml format.

  1. In Visual Studio, create a new Windows Forms Application or open an existing one.
  2. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
  3. Add the following code inside the Form_Load event.
Visual Basic.NET code. Paste INSIDE the Form Load event.
Copy Code
' Provide the page report you want to render.
Dim report As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo("C:\Sample_PageReport.rdlx"))
Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)

' Create a output directory
Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyXml")
outputDirectory.Create()

' Provide settings for your rendering output.
Dim xmlSetting As New GrapeCity.ActiveReports.Export.Xml.Page.Settings()
Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = xmlSetting' Set the rendering extension and render the report.
Dim xmlRenderingExtension As New GrapeCity.ActiveReports.Export.Xml.Page.XmlRenderingExtension()Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))reportDocument.Render(xmlRenderingExtension, outputProvider, xmlSetting)
C# code. Paste INSIDE the Form Load event.
Copy Code
// Provide the page report you want to render.
GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(@"C:\Sample_PageReport.rdlx"));
GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);

// Create a output directory
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyXml");
outputDirectory.Create();

// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Xml.Page.Settings xmlSetting = new GrapeCity.ActiveReports.Export.Xml.Page.Settings();
GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = xmlSetting;

//Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Xml.Page.XmlRenderingExtension xmlRenderingExtension = new GrapeCity.ActiveReports.Export.Xml.Page.XmlRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
reportDocument.Render(xmlRenderingExtension, outputProvider, xmlSetting);

Xml Rendering Properties

ActiveReports offers several options to control how reports render to Xml.

Property Description
Encoding Select the encoding schema to use in the XML transformation.
XslStylesheet

Select the existing XSL Stylesheet file to use to transform the resulting XML file. Note: When using the XslStylesheet option, be sure to save the file in the correct file format, such as HTML.

 

Controlling XML Output

You can also control XML output through properties on the individual report controls. These properties are:

Interactivity

XML format does not support interactive features except that when rendering a report to XML, complete drill-down data is shown regardless of whether the data is rendered in expanded state or not.
See Also

Concepts

 

 


Copyright © 2014 GrapeCity, inc. All rights reserved

Support Forum