How to merge tow cells of the Grid row? [message #245853] |
Mon, 02 July 2007 06:09  |
Eclipse User |
|
|
|
Originally posted by: HJiang.StateStreet.com
Hi, Now I have a 2*2 grid. I want to merge the second row into one cell
at runtime. Does anyone know how to do that? Please give me a sample.
Thanks a lot!
|
|
|
|
|
|
|
|
Re: How to merge tow cells of the Grid row? [message #759841 is a reply to message #759710] |
Wed, 30 November 2011 04:35   |
Eclipse User |
|
|
|
Can this be done for a single instance, too?
The scenario is as follows:
I have a complex report showing analysis results and want to create PDF output.
Ihe results are shown grouped by the type of the result and (inside the groups) different layouts are used depending on the type.
For example, descriptive results are shown in a simple 2-column table name: value,
most of the results are shown in a 4-column table |parameter|method|result|unit,
and for special cases I need a predefined matrix layout of the results inside the group.
(e.g. the first result goes to cell B3, the second one to cell C3, the third to cell A4).
For other special cases I need a differend matrix layout (e.g. different cells merged, different column widths, different dimension).
What I was able to do is create a grid with a maximum dimension (say, 8x8), fill the cells with the results accordingly and hide the superfluous rows and columns.
But I cannot format the grid, e.g. merge cells and set column widths.
The same report may contain two ore more of these special cases.
I think that using the beforeFactory event is not an option, then?
BTW I also tried a different way and generate a complete HTML table dynamically, then show it using a DynamicText item.
Though officially not supported, BIRT (3.7.1) interpretes the HTML table, tr, td tags and renders the table nicely in the PDF output. Even colspan is working more or less.
However, BIRT ignores all width attributes (be it as HTML attributes or as inline style).
So I came up with the idea to use a 100-column table and then add colspan='20' for a column with 20% width.
This works basically.
The only problem is: If the cell has set a border, the PDF renderer generates a short line where a column with colspan='1' would end.
You can see what I mean with a simple example.
Create a report which displays a dynamic text item. Then use the following code for its value:
"<table width='150mm'>" +
"<tr><td align='center' colspan='30' style='border:1pt; width:30%;'>Name</td><td colspan='70' style='border:1pt; width:70%;'>was?</td></tr>" +
"<tr><td colspan='30' style='border:1pt;'>Flecki</td><td colspan='70' style='border:1pt;'>Katze</td></tr>" +
"<tr><td colspan='30' style='border:1pt; background-color:yellow; font-weight:bold'>Charlie</td><td colspan='70' style='border:1pt'>Kater</td></tr>" +
"<tr><td colspan='100' align='center' style='border:1pt; background-color:white;'><div style='background-color:pink'>Hier ist die Summenzeile. Sie besteht aus einem deutlich längeren Text</div></td></tr>" +
"</table>"
Note the short lines near the top left corners of the cells.
|
|
|
Re: How to merge tow cells of the Grid row? [message #759974 is a reply to message #759841] |
Wed, 30 November 2011 13:55   |
Eclipse User |
|
|
|
You can set the row and column span dynamically per instance but you can
not drop a column or row. You could hide a cell dynamically. Look a
the second grid in the modified example and and look at the oncreate
script for cell1 and 2. One other option is to insert two detail rows
and then put in both grid types (one in each row) and hide the one you
do not want.
Jason
On 11/30/2011 4:35 AM, h.vonbargen wrote:
> Can this be done for a single instance, too?
>
> The scenario is as follows:
> I have a complex report showing analysis results and want to create PDF
> output.
>
> Ihe results are shown grouped by the type of the result and (inside the
> groups) different layouts are used depending on the type.
> For example, descriptive results are shown in a simple 2-column table
> name: value,
> most of the results are shown in a 4-column table
> |parameter|method|result|unit,
> and for special cases I need a predefined matrix layout of the results
> inside the group.
> (e.g. the first result goes to cell B3, the second one to cell C3, the
> third to cell A4).
> For other special cases I need a differend matrix layout (e.g. different
> cells merged, different column widths, different dimension).
> What I was able to do is create a grid with a maximum dimension (say,
> 8x8), fill the cells with the results accordingly and hide the
> superfluous rows and columns.
>
> But I cannot format the grid, e.g. merge cells and set column widths.
>
> The same report may contain two ore more of these special cases.
>
> I think that using the beforeFactory event is not an option, then?
>
> BTW I also tried a different way and generate a complete HTML table
> dynamically, then show it using a DynamicText item.
> Though officially not supported, BIRT (3.7.1) interpretes the HTML
> table, tr, td tags and renders the table nicely in the PDF output. Even
> colspan is working more or less.
> However, BIRT ignores all width attributes (be it as HTML attributes or
> as inline style).
> So I came up with the idea to use a 100-column table and then add
> colspan='20' for a column with 20% width.
> This works basically.
> The only problem is: If the cell has set a border, the PDF renderer
> generates a short line where a column with colspan='1' would end.
>
> You can see what I mean with a simple example.
> Create a report which displays a dynamic text item. Then use the
> following code for its value:
>
> "<table width='150mm'>" +
> "<tr><td align='center' colspan='30' style='border:1pt;
> width:30%;'>Name</td><td colspan='70' style='border:1pt;
> width:70%;'>was?</td></tr>" +
> "<tr><td colspan='30' style='border:1pt;'>Flecki</td><td colspan='70'
> style='border:1pt;'>Katze</td></tr>" +
> "<tr><td colspan='30' style='border:1pt; background-color:yellow;
> font-weight:bold'>Charlie</td><td colspan='70'
> style='border:1pt'>Kater</td></tr>" +
> "<tr><td colspan='100' align='center' style='border:1pt;
> background-color:white;'><div style='background-color:pink'>Hier ist die
> Summenzeile. Sie besteht aus einem deutlich längeren
> Text</div></td></tr>" +
> "</table>"
>
>
> Note the short lines near the top left corners of the cells.
|
|
|
|
Powered by
FUDForum. Page generated in 0.25745 seconds