I have the following situation.
I have a report with many columns in design time that don't fit on an A4 sheet. So I switched to A3 to be able to work. But the user selects only some of the columns and prints in A4.
Then in the Before Print event I change the size from A3 to A4. But my band remains the same size and is cut.
Oh how to solve this?
A sample report is attached.
Stimulsoft.Reports.JS
Version: 2023.3.3
Build date: 2023.08.23
Resize Band on set Page size in runtime
Resize Band on set Page size in runtime
- Attachments
-
- set-paper-size-sample.mrt
- (12.9 KiB) Downloaded 128 times
-
- Posts: 5676
- Joined: Tue Mar 20, 2018 5:34 am
Re: Resize Band on set Page size in runtime
Hello,
You should manually correct the components size, and positions in that case, or create report from code:
https://www.stimulsoft.com/en/samples/r ... -from-code
Thank you.
You should manually correct the components size, and positions in that case, or create report from code:
https://www.stimulsoft.com/en/samples/r ... -from-code
Thank you.
Re: Resize Band on set Page size in runtime
Right. Changing the size manually may help. But I don't think it's an efficient solution.
I set the width of my band equal to the page width after changing the sheet size. I would expect the in-band panel to adjust automatically since it is with dockerStyle full. But that didn't happen.
Then I defined the panel width with the bandwidth meta. Because I have two columns in it. Now I don't have cut data. But I lost the space setting between columns I defined. Then decrease the width of the panel by 2, so there is space between the columns. In this simple example there are already problems with this approach.
One observation: I placed a panel aligned at the top of the page and it automatically adjusted when I changed the size of the sheet. No cropped data. Why can't the band behave like this? Are there any limitations?
I set the width of my band equal to the page width after changing the sheet size. I would expect the in-band panel to adjust automatically since it is with dockerStyle full. But that didn't happen.
Then I defined the panel width with the bandwidth meta. Because I have two columns in it. Now I don't have cut data. But I lost the space setting between columns I defined. Then decrease the width of the panel by 2, so there is space between the columns. In this simple example there are already problems with this approach.
One observation: I placed a panel aligned at the top of the page and it automatically adjusted when I changed the size of the sheet. No cropped data. Why can't the band behave like this? Are there any limitations?
- Attachments
-
- set-paper-size-sample (1).mrt
- (14.84 KiB) Downloaded 128 times
-
- Posts: 5676
- Joined: Tue Mar 20, 2018 5:34 am
Re: Resize Band on set Page size in runtime
Hello,
Please explain, how you run the report, change the page size and send it to printing.
Thank you.
Please explain, how you run the report, change the page size and send it to printing.
Thank you.
Re: Resize Band on set Page size in runtime
I made a new example to be closer to my reality and simpler. (But I didn't include the various columns I have in the real report, which is the reason for using A3 paper in design time)
I have an Order object with payment methods. I need to print the order data and payment methods in two columns.
Therefore, I created a band for the order and another band, with two columns, for the payment methods. Set the sheet size to A3 by default.
In the page's BeforePrint event, I change the size of the sheet to A4. And here the problem happens.
If the band doesn't have speakers it works fine. The problem is when using columns.
To run it, I open the mrt file in the editor, click on preview and see the problem.
Attached you can download the report and reproduce the problem.
Thanks for the help so far.
I have an Order object with payment methods. I need to print the order data and payment methods in two columns.
Therefore, I created a band for the order and another band, with two columns, for the payment methods. Set the sheet size to A3 by default.
In the page's BeforePrint event, I change the size of the sheet to A4. And here the problem happens.
If the band doesn't have speakers it works fine. The problem is when using columns.
To run it, I open the mrt file in the editor, click on preview and see the problem.
Attached you can download the report and reproduce the problem.
Thanks for the help so far.
- Attachments
-
- set-paper-size-sample (3).mrt
- (8.63 KiB) Downloaded 8 times
-
- Posts: 5676
- Joined: Tue Mar 20, 2018 5:34 am
Re: Resize Band on set Page size in runtime
Hello,
There is no possibility to automatically adjust all component sizes for new paper size.
You should manually correct the components size, and positions in that case, or create report from code.
Thank you.
There is no possibility to automatically adjust all component sizes for new paper size.
You should manually correct the components size, and positions in that case, or create report from code.
Thank you.