Page 1 of 2

Save possible in Demo mode?

Posted: Tue May 15, 2012 6:52 am
by mietzekotze
Hello,

my company owns a certificate of your .NET Application and we are very happy with it. We use its Viewer funcionality in our ASP-Applications. Now we want to expand our software with the designer, which is included in your WebDesign-Package. I loaded the trial version to evaluate, to see if i experience errors. The only thing i recognized, that if i want to save a report (change something in the mrt report, not to export the report), the message apperas, that i have a test version, then a progressbar appears short, and disappears again, but the changes are not adopted, Is this, because i have the trial version?

Regards

Save possible in Demo mode?

Posted: Wed May 16, 2012 7:13 am
by HighAley
Hello.
mietzekotze wrote:my company owns a certificate of your .NET Application and we are very happy with it. We use its Viewer funcionality in our ASP-Applications. Now we want to expand our software with the designer, which is included in your WebDesign-Package. I loaded the trial version to evaluate, to see if i experience errors. The only thing i recognized, that if i want to save a report (change something in the mrt report, not to export the report), the message apperas, that i have a test version, then a progressbar appears short, and disappears again, but the changes are not adopted, Is this, because i have the trial version?
Due to the Flash player restrictions it's impossible to save report without dialog window. When you click on the Save button, the OnSaveReport event occurs on server which you could handle.

Thank you.

Save possible in Demo mode?

Posted: Mon May 21, 2012 7:37 am
by mietzekotze
Could you give me an example, how the save-sub has to look like?

I wanted to try this:

Code: Select all

Public Sub StiWebDesigner1_SaveReport(ByVal sender As Object, ByVal e As Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs) Handles StiWebDesigner1.SaveReport
        IO.Directory.CreateDirectory(Path)


        If Not IsNothing(Path) And Not IsNothing(filename) Then
            If Not IO.Directory.Exists(Path) Then
                IO.Directory.CreateDirectory(Path)
            End If
            report.Save(Path & "\" & filename)
        End If

    End Sub

but i think, that this sub isnt able to use the variables path and filename, which i declared in my class. Whenever i try to run this sub, it always gives me the error "System.ArgumentNullException: The value must not be zero"


//Edit:

Ok, i now have a code:

Code: Select all

 Public Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlAdapterService())
        StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlDatabase())
        StiOptions.Configuration.Localization = "de.xml"
        nvc = Request.QueryString
        Parameter() 'defines variables
        report.MetaTags.Add("fullpath", Path & "\" & filename)

        Dim exttemp As String = IO.Path.GetExtension(dict.Item("template"))
        If exttemp = ".mrx" Then
            If Not dict.ContainsKey("tpwd") Then
                Dim pwd As String = InputBox("Please type in the Password:", "This file is crypted and needs a password.")
                report.LoadEncryptedReport(dict.Item("template"), pwd)
            Else
                report.LoadEncryptedReport(dict.Item("template"), dict.Item("tpwd"))
            End If
        ElseIf exttemp = ".mrz" Then
            report.LoadPackedReport(dict.Item("template"))
        ElseIf exttemp = ".mrt" Then
            report.Load(dict.Item("template"))
        End If
        StiWebDesigner1.Design(report)
    End Sub

    Public Sub StiWebDesigner1_SaveReport(ByVal sender As Object, ByVal e As Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs) Handles StiWebDesigner1.SaveReport

        Dim path As String = IO.Path.GetDirectoryName(e.Report.MetaTags.Item("fullpath").Tag)
        Dim filename As String = IO.Path.GetFileName(e.Report.MetaTags.Item("fullpath").Tag)
        If Not IsNothing(path) And Not IsNothing(filename) Then
            If Not IO.Directory.Exists(path) Then
                IO.Directory.CreateDirectory(path)
            End If
            e.report.Save(e.Report.MetaTags.Item("fullpath").Tag)
        End If
    End Sub
As you can see, i just passed the path-variables via the MetaTags of the report, which works ok, but which is more of a workaround, so is there another way of passing the variables to this sub?

Save possible in Demo mode?

Posted: Tue May 22, 2012 9:04 am
by HighAley
Hello.

We can't see where are you getting from variables path and filename.
In the SaveReport event the report is already serialized. And you can't get any other parameters.

The MetaTags were made special to pass any user data. So your solution is right.

Thank you.

Save possible in Demo mode?

Posted: Tue May 22, 2012 9:38 am
by mietzekotze
This is the complete Sourcecode:

Code: Select all

Imports Stimulsoft.Report
Partial Class _Default
    Inherits System.Web.UI.Page
    Dim nvc As NameValueCollection
    Dim dict As New System.Collections.Generic.Dictionary(Of String, String)
    Public report As StiReport = New StiReport

    Public Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlAdapterService())
        StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlDatabase())
        StiOptions.Configuration.Localization = "de.xml"
        nvc = Request.QueryString

        Parameter()
        If IO.File.Exists(dict.Item("template")) Then
            Dim exttemp As String = IO.Path.GetExtension(dict.Item("template"))
            If exttemp = ".mrx" Then
                If Not dict.ContainsKey("tpwd") Then
                    Dim pwd As String = InputBox("Please type in the Password:", "This file is crypted and needs a password.")
                    report.LoadEncryptedReport(dict.Item("template"), pwd)
                Else
                    report.LoadEncryptedReport(dict.Item("template"), dict.Item("tpwd"))
                End If
            ElseIf exttemp = ".mrz" Then
                report.LoadPackedReport(dict.Item("template"))
            ElseIf exttemp = ".mrt" Then
                report.Load(dict.Item("template"))
            End If
        End If

        'Dim delMeta As StiMetaTag = New StiMetaTag(report.MetaTags.Item("fullpath").Name, report.MetaTags.Item("fullpath").Tag)
        'report.MetaTags.Remove(delMeta)

        If IsNothing(dict.Item("output")) Then
            report.MetaTags.Add("fullpath", dict.Item("template"))
        Else
            report.MetaTags.Add("fullpath", dict.Item("output"))
        End If
        StiWebDesigner1.Design(report)
    End Sub

    Public Sub Parameter()
        If Not String.IsNullOrEmpty(nvc("template")) Then
            dict.Add("template", nvc("template"))
        Else
            dict.Add("template", "")
        End If
        If Not String.IsNullOrEmpty(nvc("tpwd")) Then
            dict.Add("tpwd", nvc("tpwd"))
        End If
        If Not String.IsNullOrEmpty(nvc("output")) Then

            dict.Add("output", nvc("output"))
        Else
            dict.Add("output", Nothing)
        End If
    End Sub

    Public Sub StiWebDesigner1_SaveReport(ByVal sender As Object, ByVal e As Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs) Handles StiWebDesigner1.SaveReport

        Dim path As String = IO.Path.GetDirectoryName(e.Report.MetaTags.Item("fullpath").Tag)
        Dim filename As String = IO.Path.GetFileName(e.Report.MetaTags.Item("fullpath").Tag)
        If Not IsNothing(path) And Not IsNothing(filename) Then
            If Not IO.Directory.Exists(path) Then
                IO.Directory.CreateDirectory(path)
            End If
            e.Report.Save(e.Report.MetaTags.Item("fullpath").Tag)
        End If
    End Sub
End Class
If the MetaTags are the only way to provide a variable to the sub, could you please tell me how to delete MetaTags from the file?

The background is following:

I want to integrate the webdesigner and webviewer in an existing project, which has to call them with parameters. There are 2 parameter, the "template" parameter, which tells the application which template has to use, and the second one is an output-path for a new template.

So, if i save the template, my application writes the path in the metatags of the report. If i want to edit the report, and save as a new report (Example: I have report a, and want to create report b, which is pretty similiar to report a, i can take report a and change it the way i want) i need to write the metatags new. I tried to delete the MetaTags with

Code: Select all

Dim delMeta As StiMetaTag = New StiMetaTag(report.MetaTags.Item("fullpath").Name, report.MetaTags.Item("fullpath").Tag)
        report.MetaTags.Remove(delMeta)
but this doesn't work. The best way would be, to delete all MetaTags.

Save possible in Demo mode?

Posted: Wed May 23, 2012 2:47 am
by Vladimir
Hello,

Please try to use the following option:

Code: Select all

StiWebDesignerOptions.SendSavedReportToClient = true;
Specified option allows feedback to the designer when you change a report on the server side in save events.

Thank you.

Save possible in Demo mode?

Posted: Thu May 24, 2012 2:59 am
by mietzekotze
Vladimir wrote:Hello,

Please try to use the following option:

Code: Select all

StiWebDesignerOptions.SendSavedReportToClient = true;
Specified option allows feedback to the designer when you change a report on the server side in save events.

Thank you.

I'm not sure how this can help me, saving reports to the server. The most important thing for me, is the passing of variables to the SaveReport-Sub, and deleting or editing the metatags. if they are the only way of passing variables.

Save possible in Demo mode?

Posted: Fri May 25, 2012 4:30 am
by HighAley
Hello.

We've analysed your code.
Due to the Designer is a client side application, on every request, for example, StiWebDesigner1_SaveReport event, a new server session is created and all variable initialise again.
So you could move

Code: Select all

nvc = Request.QueryString
string to a Parameter sub. Then call it from StiWebDesigner1_SaveReport sub. You get all necessary variables from URL. And you don't need to use MetaTags.

If you will have any problems with this implementation, here is a code how to remove MetaTags from report:

Code: Select all

report.MetaTags.Add(new StiMetaTag("qqq", "111"));
report.MetaTags.Add(new StiMetaTag("www", "222"));
report.MetaTags.Add(new StiMetaTag("eee", "333"));

StiMetaTag tag = report.MetaTags["qqq"];
report.MetaTags.Remove(tag);  // Clear specified tag
report.MetaTags.Clear();  // Clear all tags
Thank you.

Save possible in Demo mode?

Posted: Mon Jun 04, 2012 3:36 am
by mietzekotze
Great, thank you. It worked perfectly. Somehow I didnt had the idea to just read out the parameters a second time.

Save possible in Demo mode?

Posted: Mon Jun 04, 2012 9:44 am
by Alex K.
Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.