none
How to save a report as a file? RRS feed

  • Question

  • I am a newbin to report.
    Suppose I already
    Can you tell me how to save a report as a xps file?

    Does ReportViewer.LocalReport.Refresh() create such a function?

    Thanks
    Thursday, October 23, 2008 6:50 PM

All replies

  • The ReportViewer control currently doesn't support XPS as one of the export formats. The supported formats for exporting reports in local mode are Excel, PDF and Image. You can find more information on the control here:

    http://msdn.microsoft.com/en-us/library/bb885185.aspx


     This posting is provided "AS IS" with no warranties, and confers no rights
    Thursday, October 23, 2008 7:17 PM
  • I followed the example in "

    Sample Data and Report for Print Walkthrough" to export a report.
    Get an exception at the code.

    [CODE]
    report.Render("Image", deviceInfo, AddressOf CreateStream, _
               warnings) [/CODE]
    Microsoft.Reporting.WinForms.LocalProcessingException was unhandled
      Message="An error occurred during local report processing."
      Source="Microsoft.ReportViewer.WinForms"
      StackTrace:
           at Microsoft.Reporting.WinForms.LocalReport.CompileReport()
           at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
           at Microsoft.Reporting.WinForms.LocalReport.Render(String format, String deviceInfo, CreateStreamCallback createStream, Warning[]& warnings)
           at PrintLocalReport.Demo.Export(LocalReport report) in C:\Documents and Settings\hzhao\My Documents\Visual Studio 2005\Projects\PrintLocalReport\PrintLocalReport\Module1.vb:line 45
           at PrintLocalReport.Demo.Run() in C:\Documents and Settings\hzhao\My Documents\Visual Studio 2005\Projects\PrintLocalReport\PrintLocalReport\Module1.vb:line 89
           at PrintLocalReport.Demo.Main(String[] args) in C:\Documents and Settings\hzhao\My Documents\Visual Studio 2005\Projects\PrintLocalReport\PrintLocalReport\Module1.vb:line 107
           at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    Can you please tell me why?

    • Edited by ardmore Thursday, October 23, 2008 8:22 PM
    Thursday, October 23, 2008 8:20 PM
  • It's hard to say what the error is without looking at the rest of the code, however you can get some working samples from here:

    VS 2005
    http://www.microsoft.com/downloads/details.aspx?FamilyID=F38F7037-B0D1-47A3-8063-66AF555D13D9&displaylang=en

    VS 2008
    http://www.microsoft.com/downloads/details.aspx?familyid=8AF004BD-EE06-43FA-A5B6-955689A66C84&displaylang=en

    This is also another location that has additional samples/information on how to use the ReportViewer control:

    http://www.gotreportviewer.com/


     This posting is provided "AS IS" with no warranties, and confers no rights
    Thursday, October 23, 2008 8:37 PM