"Report save name" in preview

Stimulsoft Reports.NET discussion
Post Reply
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

"Report save name" in preview

Post by Fabio Pagano »

Assume this (vb) code:

Code: Select all

Dim rpt As New Stimulsoft.Report.StiReport
        rpt.LoadPackedDocument("c:\foo.mdz")
        rpt.Show()
If in the preview i choose "Save", the proposed report name is "Report" and the default extension is ".mdc". I would have expected a save default as "foo.mdz". Is there a way to accomplish this? I have found that setting (before the show method):

Code: Select all

rpt.ReportName = "foo"
gives (in the "Save") the correct name to the report, but the proposed extension is always ".mdc", not ".mdz".

In a few words, i need to open a previously saved packed document and, if i click "Save", the dialog must default to save on the document (file) just opened.

Hope i have been clear.

Thanks.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

"Report save name" in preview

Post by Fabio Pagano »

About the report name in the save dialog i have solved, it simply assumes the original reportname.

Now, i only don't know how to default to the ".mdz" extension when i click "Save" in the preview.

Thanks.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

"Report save name" in preview

Post by Vital »

Please call this code at start of your program:

Code: Select all

StiConfig.Services.Remove(typeof(Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService));
StiConfig.Services.Remove(typeof(Stimulsoft.Report.SaveLoad.StiPackedDocumentSLService));

StiConfig.Services.Add(new Stimulsoft.Report.SaveLoad.StiPackedDocumentSLService());
StiConfig.Services.Add(new Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService());
Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

"Report save name" in preview

Post by Fabio Pagano »

Ok, it works, thanks.

I have tried something more: i only want to give the ability to save only in compressed format, so i have put this VB code in FormLoad event:

Code: Select all

Stimulsoft.Report.StiConfig.Services.Remove(GetType(Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService))
        Stimulsoft.Report.StiConfig.Services.Remove(GetType(Stimulsoft.Report.SaveLoad.StiPackedDocumentSLService))

        Stimulsoft.Report.StiConfig.Services.Add(New Stimulsoft.Report.SaveLoad.StiPackedDocumentSLService())
But the ability to save in uncompressed format (mdc) remains.

Image

Using V2007.1.

Thanks.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

"Report save name" in preview

Post by Vital »

In this case you can use following code:

Code: Select all

StiServiceContainer services = StiConfig.Services.GetServices(typeof(Stimulsoft.Report.SaveLoad.StiDocumentSLService));
            foreach (StiService service in services)
            {
                if (service is Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService)
                {
                    service.ServiceEnabled = false;
                }
            }
Thank you.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

"Report save name" in preview

Post by Fabio Pagano »

I have translated in VB the above code:

Code: Select all

Dim services As Stimulsoft.Base.Services.StiServiceContainer = Stimulsoft.Report.StiConfig.Services.GetServices(GetType(Stimulsoft.Report.SaveLoad.StiDocumentSLService))

        For Each service As Stimulsoft.Base.Services.StiService In services

            If service Is Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService Then
                service.ServiceEnabled = False
            End If
        Next
But in the row:

Code: Select all

If service Is Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService Then
the editor gives the following error:

"StiXmlDocumentSLService is a type in SaveLoad and cannot be used as an espression".

Actually i have solved using the following code instead of the offending line:

Code: Select all

If service.ServiceName.ToLower = "stixmldocumentslservice" Then
but, of course, i don't like it too much.

May you help me?

Thanks.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

"Report save name" in preview

Post by Edward »

Please use the VB.Net code in the following form (it is a direct translation of Vital's code)

Code: Select all

  Dim services As Stimulsoft.Base.Services.StiServiceContainer =
  Stimulsoft.Report.StiConfig.Services.GetServices(GetType(Stimulsoft.Report.SaveLoad.StiDocumentSLService))
  Dim service As Stimulsoft.Base.Services.StiService
  For Each service In services
    If TypeOf service Is Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService Then
      service.ServiceEnabled = False
    End If
  Next
Let us know if you need additional help.

Thank you.
sphextor
Posts: 38
Joined: Tue Apr 01, 2008 1:42 am
Location: Thailand

"Report save name" in preview

Post by sphextor »

Edward wrote:Please use the VB.Net code in the following form (it is a direct translation of Vital's code)

Code: Select all

  Dim services As Stimulsoft.Base.Services.StiServiceContainer =
  Stimulsoft.Report.StiConfig.Services.GetServices(GetType(Stimulsoft.Report.SaveLoad.StiDocumentSLService))
  Dim service As Stimulsoft.Base.Services.StiService
  For Each service In services
    If TypeOf service Is Stimulsoft.Report.SaveLoad.StiXmlDocumentSLService Then
      service.ServiceEnabled = False
    End If
  Next
Let us know if you need additional help.

Thank you.
but when i want to open filetype in open dialog misssing

help me pleae i want user to save .mdz and also open only .mdz

code in vb.net

thankyou
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

"Report save name" in preview

Post by Edward »

Hello.

Unfortunately there is no such an option in the Designer yet.

Thank you.
Post Reply