Change behavior of save button in Viewer
Change behavior of save button in Viewer
I need to use my own function to export the report data to XML because some clients use a different XML structure than the one outputed by Stimulsoft.
In the Viewer, when the user click Save -> XML File, choose a file name and location, then press Save, is there a way to interrupt the save event, cancel it and instead call my own function so I can create the XML file myself?
Thanks.
In the Viewer, when the user click Save -> XML File, choose a file name and location, then press Save, is there a way to interrupt the save event, cancel it and instead call my own function so I can create the XML file myself?
Thanks.
Change behavior of save button in Viewer
Hello,
Could you, please clarify your issue. Do you want make your own export to xml on the base of our DataSet or do you want to realize it from scratch?
Thank you.
Could you, please clarify your issue. Do you want make your own export to xml on the base of our DataSet or do you want to realize it from scratch?
Thank you.
Change behavior of save button in Viewer
I would prefer to realize it from scratch.
I only want to use the "Save -> XML File" button already in the viewer because adding other buttons would confuse the user.
Thank you.
I only want to use the "Save -> XML File" button already in the viewer because adding other buttons would confuse the user.
Thank you.
Change behavior of save button in Viewer
Hello,
You can use ProcessExport event of StiViewerControl. Please add your own event handler to this event. Default event handler is:
You need add check for StiXmlExportService.
Thank you.
You can use ProcessExport event of StiViewerControl. Please add your own event handler to this event. Default event handler is:
Code: Select all
protected virtual void OnProcessExport(object sender)
{
StiExportService service = sender as StiExportService;
service.Export(CurrentReport, null, false);
}
Thank you.
Change behavior of save button in Viewer
Thanks for this answer. This is my event handler:
It works but I have a hard time getting Stimulsoft to use it.
I saw that my StiReport object have ViewerControl and ViewerForm properties but they are always null, and creating new StiViewerControl or StiViewerForm doesn't seem to work.
The only way I found for Stimulsoft to use my new handler is this:
However this is bad since the ActiveForm is easy to change for the user and can lead to NullReferenceExceptions.
Is there another way to access the StiViewerControl and StiViewerForm objects used by my StiReport object to show the reports?
Thank you.
Code: Select all
private void OnProcessExport(object sender, EventArgs e)
{
StiExportService service = sender as StiExportService;
if (service is StiXmlExportService)
{
MySaveToXml();
}
else
{
service.Export(_stiReport, null, false);
}
}
I saw that my StiReport object have ViewerControl and ViewerForm properties but they are always null, and creating new StiViewerControl or StiViewerForm doesn't seem to work.
The only way I found for Stimulsoft to use my new handler is this:
Code: Select all
_stiReport.Show();
((StiViewerForm)StiViewerForm.ActiveForm).ViewerControl.ProcessExport += new EventHandler(OnProcessExport);
Is there another way to access the StiViewerControl and StiViewerForm objects used by my StiReport object to show the reports?
Thank you.
Change behavior of save button in Viewer
Hello,
You need create your own form with StiViewerControl to use this event of viewer.
Thank you.
You need create your own form with StiViewerControl to use this event of viewer.
Thank you.