Print on previos page problem

Stimulsoft Reports.Silverlight discussion
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

Hello,

I have problem with Print on previous page property. I am creating report in Silverlight and I am trying to move content from one page to previous if there is enough space. I found some topic on your forum which explains this. It says that if you have two pages (page1 and page2) to use AfterPrint event (or some that fits my needs) of page1 and write something like (if this.RenederedPages == 1) { page2.PrintOnPreviosPage = true; }, but it works for normal preview and does nothing in Silverlight preview (Pages either dissapear or stay in same space). My question is: Can I have 10 pages, and each of them have some content, but if any page have enough space to contain data from next page to move that content?

Best regards,
VojinDM
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Print on previos page problem

Post by Alex K. »

Hello,

In the native Silverlight scripts do not work, because for working with scripts compilation is necessary. In this case, you can save your report as "CSharp files for Silverlight reports (*. cs)". In this case, your additional code will be saved in the class and they will work correctly.

Thank you.
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

Aleksey,

Does this mean that if I save report as .cs file from Save as option in designer, that all code in my project will work once report is loaded? I would like to try it but I can't figure out how to Load document as .cs file.. Can you help me with that?
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

I managed to open report from .cs class but now I have different problem. Report have registered business objects, and when I am trying to preview it, it throws exception. It seams that when report tries to convert values from business objects, it recognizes all types as System.RuntimeType and can't do any conversions.

I first make an instance of Report.cs (Report report = new Report()), then i register busness objects , and then call report.Show() method. Report have exact same business objects as ones I am registering. It doesn't display any text values and when I click on Preview, it throws exception (Can not convert System.RuntimeType to whatever type (string, int ...)). It works perfectly for reports without business objects.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Print on previos page problem

Post by Alex K. »

Hello,

Please see the sample in attachment.

Thank you.
Attachments
845.SilverlightApplication1.zip
(90.66 KiB) Downloaded 282 times
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

Thanks for example. I looked it and tried it on simple example. It works fine when you have fixed data, but when I dynamically create properties it throws error for every value that is null. I feel like I must tell you exactly what am I doing:
I have service which returns values from database. When I receive data, I loop trough values and dynamically create types with properties and register them as business objects. I previously created report with exact same business objects and saved it as .cs file for Silverlight. I have imported that file in solution and made instance of that class, registered business objects and when I call Render method, it throws exception for every null value. Also, I must delete Data assembly because Silverlight doesn't have that assembly. Is it possible that dynamic properties are ones that are causing problem?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Print on previos page problem

Post by Alex K. »

Hello,

Please send us a sample projects with sample data which reproduses the problem for analysis.

Thank you.
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

Aleksey,

I just had to handle all null values and if there is one, to set its value to default one (int = 0, string = "" etc...). But now I am facing other problem - when I set Print on previous page property to true, whole page disappears. On one page I have panel which contains Data object. On the other page there is also panel and Data object. If there is enough space on first page, I would like to move panel from second page to first page. How can I manage that without loosing second page?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Print on previos page problem

Post by Alex K. »

Hello,

We couldn't reproduce this bug.
Please send us a simple test application which reproduces the problem.

Thank you.
VojinDm
Posts: 16
Joined: Thu Feb 24, 2011 3:49 am
Location: Kragujevac

Print on previos page problem

Post by VojinDm »

Hello Aleksey,

It is little complicated to create sample project, and i have very little time. I managed to move content to previous page. I am sorry to bother you for something that is basically simple, but as I said - I have very little time. There is one more problem (I hope last one) - Main reason for using your report engine was option to save report as string to database and load it with report.LoadFromString() method. Now when I must use .cs file that functionality is useless. Main problem is - when customer wants to create new design for report, but use our business objects, he must rebuild application, save report as .cs file,change events and you know what else more.. Main idea was to allow users to create report with their design and give them functionality to save it in database (as string). But as you said, if you don't use compilation - your property doesn't work. Can I still somehow manage this with report as text?

Best regards.
Locked