Keep with next-functionality

Stimulsoft Reports.NET discussion
Post Reply
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Keep with next-functionality

Post by olaodling »

I have tried to find a "keep with next"-functionality (like the property you can set in Word on a paragraph) when creating reports, without any success.

The reports we're creating shows a number of header + text-pairs, where the header is a fixed text and the text-part is the value from one column in the data source table.

Ex:
Name
John Doe

Address
Unknown Street 51

The problem is that at page breaks, the header line can end up on the bottom of one page, and the text part starts at the top of the next page (the text parts can occationally be very long, sometimes more than a page).

Is there some way I can configure the report to make the header lines to be printed on the same page as the corresponding text (like the "keep with next"-property in Word)? Or is there any other work-around to achieve the same result?

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

Re: Keep with next-functionality

Post by Alex K. »

Hello,

Please try to use the additional Panel component on which put your two Text component and set the CanBreak property to false for panel component.

Thank you.
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Re: Keep with next-functionality

Post by olaodling »

Hello Aleksey,

and thanks for your reply. The solution you propose I have tried, and it works splendid, as long as the second text component doesn't contain so much text that it spans more than a page. In that case, the output gets really bad :? (with empty pages).

And since some of the second text components can contain much text, there will certainly be occasions where it will contain more than one page of data, and then the output will not be accepted by out customer.

Do you have any other idea?

Thanks.
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Re: Keep with next-functionality

Post by olaodling »

Hello again,

Is there any possibility to add my own event handler to some event in the rendering process to examine the text in the second text box and change the CanBreak-property of the textbox and its parent depending on how much text there will be rendered in the textbox?

Thanks!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Keep with next-functionality

Post by HighAley »

Hello.

Could you send us your report template with sample data to reproduce the issue?
We will try to provide you a solution.

Thank you.
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Re: Keep with next-functionality

Post by olaodling »

Thanks for looking into my problem.

I have attached six files, report file, schema file, two data files and two pdf-files with the rendered reports from the two data files.

As you can see, the report file is simple, but will show the problems I have implementing a "keep with next"-functionality.

Viewing the first pdf, one can notice that the header "Fourth Data" will keep to the next text field, and that's good. But notice the big, empty space at the lower part of page one, which will not be acceptable to my customer (the big empty space is due to the CanBreak-property set to false for the Panel).

The second pdf is just for showing the behaviour when having a text field bigger than a page in the Panel, with an extra blank page in the middle.

And to summorize my need, I want to make sure that the header line (e.g. "Fourth Data") will always be stuck with the following text field, and not having the risk of the header line being the last line on a page (with the following text field starting at the next page).

Thanks!
Attachments
Temp.mrt
Report file
(11.68 KiB) Downloaded 192 times
Temp1.pdf
Second data file
(98.2 KiB) Downloaded 229 times
Temp0.pdf
First report file
(96.88 KiB) Downloaded 228 times
Temp1.xml
Second data file
(1.9 KiB) Downloaded 249 times
Temp0.xml
First data file
(962 Bytes) Downloaded 234 times
TempData.xsd
Schema file
(635 Bytes) Downloaded 247 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Keep with next-functionality

Post by Alex K. »

Hello,

As a way, you can try to use the Child component.
Please check the modified report in attachment.

Thank you.
Attachments
Temp_modified.mrt
(13.2 KiB) Downloaded 275 times
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Re: Keep with next-functionality

Post by olaodling »

Hello.

I tried with the Child component, and though the result was better, it is not good enough.

Scanning the documentation once more, I found the RenderTo property (or ReportTo as the documentation says) which looks promising.

Question: MUST the two connected text components be in the same container(e.g. Panel)?

In my efforts to implement the "keep with next"-functionality, I need to keep the two text components in different containers.

Thanks
olaodling
Posts: 6
Joined: Wed Apr 24, 2013 6:15 am

Re: Keep with next-functionality

Post by olaodling »

Hello.

Finally I solved the problem (at least I think so), and it was equally easy as hard to find out ;)

If I make the header line text component so big that it covers the first line of the next text component, and sets the CanBreak-property to false, the rendering engine will keep the header line text component unbroken. The following text component has the CanBreak-property set to true which means that it can be broken anywhere. But since the two overlaps, the engine will guarantee that at least the first line from the latter text component always will be printed on the same page as the header.

So simple, but still hard to find out :)

Thanks for all the effort you have put into my questions!

Regards Ola
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Keep with next-functionality

Post by Andrew »

Hello,

Great!
Thank you for letting us know about this.

If you have additional questions. do not hesitate to contact us.
Thank you.
Post Reply