Table Auto Width with Header Bands

Stimulsoft Reports.NET discussion
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Table Auto Width with Header Bands

Post by MatthiasU »

Hello,

I need to create a report with a grouped table layout. For this I have added some header/footer bands and a table component. The table uses the properties "AutoWidth=True" and "AutoWidthType=Table".

But now I have some problems:
1) I need to define a minimal width for some columns.
2) I need a AutoWidth property for the total fields in the footer bands so that they are placed on the same position as the table columns.

Please see attachment for an example.


Many Thanks & Regards,
Matthias
Attachments
GroupedTable.zip
(18.57 KiB) Downloaded 530 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Table Auto Width with Header Bands

Post by HighAley »

Hello, Matthias.

Unfortunately, there is no way to set minimum size of the cells.
Please, try to use Data Band with Text components.
You could set Min and Max Size there and use Auto Width.
To change the size of text components on Group Footer you should write scripts that will save width of components for the group in a variable.

Thank you.
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: Table Auto Width with Header Bands

Post by MatthiasU »

Hello Alekey,

thank you for your reply. I will try your solution, but this seems to be a complicated solution for a simple problem...

Regards,
Matthias
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: Table Auto Width with Header Bands

Post by MatthiasU »

Hello,

I have tried to set the width of the text components in the footer with scripts. But this did not work properly.

In what event, I have to set the width? My current problem is, that I don't get the new (resized) width of the table cells...


I hope, you can help me.


Thanks & Regards,
Matthias
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: Table Auto Width with Header Bands

Post by MatthiasU »

Aleksey Andreyanov wrote: Unfortunately, there is no way to set minimum size of the cells.
Sorry, but this seems to be wrong. In the code, I can set MinSize and MaxSize of Table Cells. I have to set these properties to all cells of the corresponding column and have to set the "FixedWidth" property to true. And it works very well :D


But my question, how to get the rendered width of a table cell is still open :(


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

Re: Table Auto Width with Header Bands

Post by HighAley »

Hello, Matthias.

As I wrote before, you should use Data Band with text components on it instead of the Table component.
You could get the Width of rendered component in Get Value event of the component. Get it from sender.
To set the Width use Before Print event of the component where you need to change it.

Thank you.
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: Table Auto Width with Header Bands

Post by MatthiasU »

Hello,

thank you.

But how can I realize an auto-width solution with data band?

If I set the AutoWidth property on all text components in the data band, only the width but not the position of the components will be changed. In the table component, the position depends on the widths of the previous columns.

Is there really no way to get the rendered with of a table cell? This would resolve all my open points!


Many thanks & Regards,
Matthias
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Table Auto Width with Header Bands

Post by Alex K. »

Hello,

Please try to use the DockStyle property for the Text component in this case.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Table Auto Width with Header Bands

Post by HighAley »

Hello, Mattias.

Sorry, forget to write that you should set the Dock Style to Left.

Then you should set the Number of Pass property of the report to Double Pass.

After this you could store in a variable the width of the widest component at the first pass and set the width to the largest value on the second pass.

Please, look at the attached report template.
DynamicWidth.mrt
(22.48 KiB) Downloaded 422 times
Thank you.
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: Table Auto Width with Header Bands

Post by MatthiasU »

Hello, Aleksey and Aleksey,

I have tried your solution. But now it is possible, that the last column will grow outside the printable area :(

Please see the attached template. The XML data you'll find in my first post.


Thanks & Regards,
Matthias
Attachments
GroupedTableReport2.mrt
(24.69 KiB) Downloaded 395 times
Post Reply