Hello,
I've been working on a solution for quite a time and tried different approaches without success.
I need to generate a table looking report. I'm not sure anymore, which component to use to achieve that.
What I want to do:
I need a table with 7 static columns for example.
Depending on the content, the cells need to merge together and become a bigger cell.
I would appreciate any approach.
If needed, the solution can be pure C# too.
Thank you very much.
Merge cells horizontally dynamically
Re: Merge cells horizontally dynamically
I posted a possible solution to my question here before my thread was approved. Why was my answer deleted?
Re: Merge cells horizontally dynamically
I will try to post my solution again:
Maybe this will help someone who has the same requirements for a special report;
Currently I'm using a consistent working event called "Get Value" for every Cell in the table.
Appearently this event works as assumed like an iteration for every cell from left to right.
On this condition I used some helper variables in the template and a little bit of C# code in the event to "merge" cells.
The logic is quite simple. I "merge" every Cell together, who has the same value in a line/row. There can be multiple merges in a row.
I was generally trying to mimic the "Process duplicate" functionality, but just on the horizontal plane.
What I do in the Get Value Event:
you can try it for yourself, since I added my example report
My question:
Is there a way to achieve the same output but with the use of components and native functionality?
The form and way the datasource is provided can be changed!
I'm open for every suggestion and any help is appreciated!
Thank you very much in advance.
Maybe this will help someone who has the same requirements for a special report;
Currently I'm using a consistent working event called "Get Value" for every Cell in the table.
Appearently this event works as assumed like an iteration for every cell from left to right.
On this condition I used some helper variables in the template and a little bit of C# code in the event to "merge" cells.
The logic is quite simple. I "merge" every Cell together, who has the same value in a line/row. There can be multiple merges in a row.
I was generally trying to mimic the "Process duplicate" functionality, but just on the horizontal plane.
What I do in the Get Value Event:
Code: Select all
if(e.Value == lastValue && lastLine == Line)
{
//mark for merge!
merge = true;
(lastComponent as Stimulsoft.Report.Components.Table.StiTableCell).Width += (sender as Stimulsoft.Report.Components.Table.StiTableCell).Width;
(sender as Stimulsoft.Report.Components.Table.StiTableCell).Enabled = false;
}
else
{
//save values for next cell
lastComponent = sender;
lastValue = e.Value;
merge = false;
lastLine = Line;
}
My question:
Is there a way to achieve the same output but with the use of components and native functionality?
The form and way the datasource is provided can be changed!
I'm open for every suggestion and any help is appreciated!
Thank you very much in advance.
- Attachments
-
- sample.mrt
- (786.07 KiB) Downloaded 95 times
-
- Posts: 6196
- Joined: Tue Mar 20, 2018 5:34 am
Re: Merge cells horizontally dynamically
Hello,
Thank you for your sample.
Unfortunately, there are no standard options for merging horizontally, only via code in events.
Thank you.
Thank you for your sample.
Unfortunately, there are no standard options for merging horizontally, only via code in events.
Thank you.