Update MRT model with designer

Stimulsoft Reports.NET discussion
Post Reply
NicolasM
Posts: 23
Joined: Tue Mar 08, 2016 1:53 pm

Update MRT model with designer

Post by NicolasM »

Hello,

I create my own designer with WinForm by using StiRibbonDesignerControl. I use it to create my models (MRT files) and to test print, export... (all models use only Business Objets).

I just start to use it for test and I found a problem with my code: when I modify the model, it's not automatically updated in the report (this.stiDesignerControl.Report). So I have to close and restart application to load my new model. Can I do that by code ?

My export code for example:

Code: Select all

Stimulsoft.Report.StiReport report = this.stiDesignerControl.Report;
report.Render(true);

// Get filepath
string filepath = GetFilePath("CSV File|*.csv");

// Export document
StiCsvExportService service = new StiCsvExportService();
report.ExportDocument(service, filepath);

// Open document
System.Diagnostics.Process.Start(filepath);
Thanks in advance for your help.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Update MRT model with designer

Post by HighAley »

Hello.

Sorry, we didn't understand your question.
Could you describe your issue more detailed?
Also you wrote the same code as in your other post. Is it right?

Thank you.
NicolasM
Posts: 23
Joined: Tue Mar 08, 2016 1:53 pm

Re: Update MRT model with designer

Post by NicolasM »

Hello,

Sorry, I will try to explain my problem.

I create a C# project (using WinForm) to create my own StimulSoft Designer. I use StiRibbonDesignerControl and a panel with buttons.

I launch the application, load a model and load Business Object my clicking on a button. The code behind this button is:

Code: Select all

Stimulsoft.Report.StiReport r = GetReport();
SetRefAssemblies(r);

// General
r.RegData("General", Test.General.Data);

// Columns
r.RegData("CustomerEntryColumns", Test.CustomerEntryColumns.GetEntryColumns());

// Data
r.RegData("CustomerList", Test.CustomerList.GetDummyData());

// Update report
this.stiDesignerControl.Report = r;
Now, all data is set and can work on model.

I have create others buttons used to show, print, export (see my first code for export action).

My problem is: in I modify the model with the designer and try to show or export it just after, the modification is not set. I have to quit and launch the application to "apply" it. In other word, the model is well saved but I have to reload it to update model in StiRibbonDesignerControl .Report.

When I save my model file, I would like to load it automaticaly into StiRibbonDesignerControl .Report. Is it possible ?

Thanks in advance for your help.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Update MRT model with designer

Post by HighAley »

Hello.

We need more information about your issue.
What do you mean under model? How do you change it and what do you need to update?
Please, send us a sample project that reproduces your issue.

Thank you.
NicolasM
Posts: 23
Joined: Tue Mar 08, 2016 1:53 pm

Re: Update MRT model with designer

Post by NicolasM »

Hello,

Sorry for this latter answer.

You can found in attachment the C# project (simplified).

By model, I mean MRT file. When I launch my app, I load “Test_CustomerReport.mrt” file. Next, I click on “Custumer” button (in left panel) to load Business Objects associate to the model. Now, I can click on “Print” to show the print preview.

But if now I modify the MRT file and save modification, “Print” doesn’t work or the modification on MRT isn’t apply.

I create this app to create and modify MRT files. For that, I need to update report when the MRT file is modified and test changes when clicked on “Print”.
Is it ok for you?

Thanks for your help.
Attachments
TestPrintModelEditor.7z
C# project
(22.6 KiB) Downloaded 396 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Update MRT model with designer

Post by Alex K. »

Hello,

Please try to add the Compile() method:

Code: Select all

private void button6_Click(object sender, EventArgs e)
{
    Stimulsoft.Report.StiReport report = this.stiDesignerControl.Report;

    report.Compile();
    report.Render();

    report.Show();
}
Thank you.
NicolasM
Posts: 23
Joined: Tue Mar 08, 2016 1:53 pm

Re: Update MRT model with designer

Post by NicolasM »

Hello Aleksey,

Thank you for your reply. It's works now!

Thanks to all !
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Update MRT model with designer

Post by Alex K. »

Hello,

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

Thank you.
Post Reply