Saving Report from stream
Saving Report from stream
I'm not sure if current beta builds fix this, but currently I am loading reports from a database and when I click "save" it wants to save the report as a file and also it does this when I close a report and it asks me if I want to save or cancel changes. I would like it to save back to the database instead. Any suggestion on how to do this would be appreciated.
Thanks,
Mat
Thanks,
Mat
Saving Report from stream
Use some code like this:
StiDesigner.SavingReport += new StiSavingObjectEventHandler(StiDesigner_SavingReport);
...
private void StiDesigner_SavingReport(object sender, StiSavingObjectEventArgs e)
{
if (this.MyReport.IsModified)
{
// Save report
}
}
I hope that helps.
I found it easier to use the save the string methods, but is just my two cents.
Marco
StiDesigner.SavingReport += new StiSavingObjectEventHandler(StiDesigner_SavingReport);
...
private void StiDesigner_SavingReport(object sender, StiSavingObjectEventArgs e)
{
if (this.MyReport.IsModified)
{
// Save report
}
}
I hope that helps.
I found it easier to use the save the string methods, but is just my two cents.
Marco
Saving Report from stream
This is a right way.
Saving Report from stream
Can you give your example in vb.net? Is this event in the current version or is it in one of the betas?
Mat
Mat
Saving Report from stream
This event handler exists from the StimulReport.Net version 2006.4 and todays beta versions also contains this event.
Please see the code in Vb.Net
Thank you.
Please see the code in Vb.Net
Code: Select all
Private report As StiReport = New StiReport
AddHandler StiDesigner.SavingReport, New StiSavingObjectEventHandler(AddressOf Me.On_SavingReport)
Private Sub On_SavingReport(ByVal sender As Object, ByVal e As StiSavingObjectEventArgs)
'If possible you may get the report object here
'Dim report As StiReport = TryCast(sender,StiDesigner).Report
If (report.IsModified) Then
report.Save("d:\MyReport.mrt")
End If
End Sub
Saving Report from stream
I'm getting a "savingreport" is not an event. What all do I need to have in my "imports"section to get that event.
Thanks,
Mat
Thanks,
Mat
Saving Report from stream
You should add the following into Imports section of your Application:
then you can add your custom event handler On_SavingReport to the static event of the StiDesigner class.
Please note that this event is exists on the class level, not on the instance of the StiDesigner. And you should add an event handler to the StiDesigner.SavingReport only once. The best way if you do this in the event handlers of the events like Load of the main Form of your project.
Thank you.
Code: Select all
Imports Stimulsoft.Report.Design
Please note that this event is exists on the class level, not on the instance of the StiDesigner. And you should add an event handler to the StiDesigner.SavingReport only once. The best way if you do this in the event handlers of the events like Load of the main Form of your project.
Thank you.