Export to XPS, as simple as PDF export now....!!!

XPS documents can now be generated directly from the C1Report control or the C1PrintDocuments. For a long time, Microsoft has been trying to make its own version of a portable document, famous in the user circles. Traditionally, creating an XPS file means selecting the print option in an application and then using the Microsoft XPS printer driver. With C1Report control, we have reduced this operation to a single line of code. There is no longer need to print your report using the XPS printer driver; all you need now it to render it using the following code:


Where rpt1 is the C1Report object that is used in the project to render a report.

Some detail about the background

What we have done with the 11v1 version of the controls is that a new export provider for XPS file format has been added in the C1Preview name space, and that is what we use when we call the "Export" method of the internal C1Document of the C1Report control. When we specify a file name, based on the extension mentioned in the string, the C1PrintDocument selects an export provider on its own, and renders the file at the location mentioned in the path. So the XPS export can not only be used for report files, but also for documents created using the C1PrintDocument objects. Attached is a sample that shows usage of this feature from both a C1Report object as well as from a C1PrintDocument. I found the link below quite helpful in detailing about the xps file format: http://www.prepressure.com/library/technology/xps Sample implementing export to XPS


GrapeCity Developer Tools
comments powered by Disqus