How can I save a report to a file?

Sometimes you may face a necessity to save a template or the rendered document into a file. To do this, you can take advantage of the static method of the Write class:

PerpetuumSoft.Framework.Serialization.XSerializationManager,

For example:

PerpetuumSoft.Framework.Serialization.XSerializationManager.Write(document, "test.rst");

Please note that this way you can save a report template (.rst) as well as the rendered document (.rsd).


Getting an .rsd document in SharpShooter Reports.WPF can be done as follows:

a) Subscribe to an event which is called after the report rendering is finished:
reportSource.RenderCompleted += reportSource_RenderCompleted;

b) Save the document as follows:

private void reportSource_RenderCompleted(object sender, EventArgs e)
{
PerpetuumSoft.Framework.Serialization.XSerializationManager.Write(reportSource.Document, "C:\\document.rsd");
}

Add Feedback