Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Report Width Formatting Question
icon5.gif  Report Width Formatting Question [message #674606] Fri, 27 May 2011 10:28 Go to next message
No real name is currently offline No real name
Messages: 4
Registered: May 2011
Junior Member
Hello,

I have created a report in BIRT using a Scripted Data Source built into an accounting application. The user can customize the report in a GUI dragging and dropping categories into the desired location. The report can have up to 14 columns horizontally, and 4 rows, the columns that do not have information in them are hidden in the rendering of the report.
I would like to generate a report with fixed column widths of about 1.5 inches, but a report width to reflect the number of columns that are appearing, so in short, a way to customize the report width on the fly each time it is ran - say a calculated width of 1.5in * # of columns.
I created a custom master page of 21 (1.5in * 14 columns) inches, set the "Layout Preference" of the report to "Auto Layout", and the width of each column to 1.5 inches. What happens here is that the "Auto Format" seems to override the column widths, if the data in a column of a relatively long label such as "Foreign Address" is empty, the column is much narrower than 1.5 inches, and the label is squished to take up 2 lines instead of 1. However the "Auto Layout" seems to help the report width situation. Now the "Fixed Layout" does what I want it to do with the column widths, they are each 1.5 and do not get squished when there is no data in that column, but the report width will be 21 inches even when only a few columns are showing up, which looks goofy. I have tried setting the individual columns "Shrink" variable to false (found in the "Advanced" section of the "Properties" tab), but that does not stop the columns from shrinking when I choose "Auto Layout".
Is there a way I can keep each column width to 1.5 inches and have a report width of varying length depending on how many columns are showing in the report?
Note:
I am generating reports of type HTML.
Also another question - is there a way to generate pdf reports with widths of multiple pages?

Thanks,
Meredith
Re: Report Width Formatting Question [message #675486 is a reply to message #674606] Tue, 31 May 2011 12:00 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Meredith,

In the beforeFactory you should be able to get a handle on the table if
you name it in its general properties. With this handle you should be
able to set individual column widths:


var mytbl = reportContext.getDesignHandle().findElement("mytable");
var col = mytbl.getColumns().get(0);
col.setProperty("width", "6in");

You should also be able to set properties for the master page:
reportContext.getDesignHandle().findMasterPage("myMasterPage").setProperty("width",
"8in");

Jason


On 5/27/2011 10:28 AM, forums-noreply@eclipse.org wrote:
> Hello,
>
> I have created a report in BIRT using a Scripted Data Source built into
> an accounting application. The user can customize the report in a GUI
> dragging and dropping categories into the desired location. The report
> can have up to 14 columns horizontally, and 4 rows, the columns that do
> not have information in them are hidden in the rendering of the report.
> I would like to generate a report with fixed column widths of about 1.5
> inches, but a report width to reflect the number of columns that are
> appearing, so in short, a way to customize the report width on the fly
> each time it is ran - say a calculated width of 1.5in * # of columns.
> I created a custom master page of 21 (1.5in * 14 columns) inches, set
> the "Layout Preference" of the report to "Auto Layout", and the width of
> each column to 1.5 inches. What happens here is that the "Auto Format"
> seems to override the column widths, if the data in a column of a
> relatively long label such as "Foreign Address" is empty, the column is
> much narrower than 1.5 inches, and the label is squished to take up 2
> lines instead of 1. However the "Auto Layout" seems to help the report
> width situation. Now the "Fixed Layout" does what I want it to do with
> the column widths, they are each 1.5 and do not get squished when there
> is no data in that column, but the report width will be 21 inches even
> when only a few columns are showing up, which looks goofy. I have tried
> setting the individual columns "Shrink" variable to false (found in the
> "Advanced" section of the "Properties" tab), but that does not stop the
> columns from shrinking when I choose "Auto Layout". Is there a way I can
> keep each column width to 1.5 inches and have a report width of varying
> length depending on how many columns are showing in the report?
> Note:
> I am generating reports of type HTML.
> Also another question - is there a way to generate pdf reports with
> widths of multiple pages?
>
> Thanks,
> Meredith
Re: Report Width Formatting Question [message #675816 is a reply to message #675486] Wed, 01 June 2011 11:35 Go to previous message
No real name is currently offline No real name
Messages: 4
Registered: May 2011
Junior Member
Hello Jason,

Thanks for the reply! I added the following to my beforeFactory that basically goes through each column and sets the width to 1.5 inches:

var mytbl = reportContext.getDesignHandle().findElement("customerMasterTable");
var col_count = 14;
for(i=0;i< col_count; i++){
var col = mytbl.getColumns().get(i);
col.setProperty("width", "1.5in");
}

When I ran the report using Auto Layout it still has the effect of conforming to the length of data in the column - if there's no data my labels are still scrunched and column width is smaller than 1.5 inches. It would be good if I could stick with Fixed Layout and use your instruction on setting the master page width. But in order to set the appropriate width, I would need to get the number of columns based on how the user set up the report. Is there a way to get the number of VISIBLE columns each time the report is ran in order to set the master page width?

Thanks,
Meredith

Previous Topic:Counting on a xml data sources
Next Topic:Layout Problem with Scripted data set with hashmap
Goto Forum:
  


Current Time: Thu Jul 24 02:28:41 EDT 2014

Powered by FUDForum. Page generated in 0.03121 seconds