Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Setting margins for Excel output
Setting margins for Excel output [message #655957] Wed, 23 February 2011 14:15 Go to next message
Eclipse UserFriend
Originally posted by: remkus.wideopenwest.com

Hi,

My application constrains me to using BIRT 2.2.1.

I have a report that will be output to either PDF, HTML, or XLS.

With the HTML and PDF outputs, I'd like to have reasonable margins, but
with a margin set on XLS, it causes the emitter to produce an empty
column at the margins.

I know I can detect the output format in the beforeFactory script and
can run this.getMasterPage(), but I don't see how I can change the
margins on the master page once I have that object.

Any suggestions?

Thanks
Re: Setting margins for Excel output [message #655988 is a reply to message #655957] Wed, 23 February 2011 16:09 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Dave,

If you are using a RunAndRender task you can modify the masterpage like:

reportContext.getReportRunnable().designHandle.getDesignHand le().findMasterPage( "myMasterPage").setProperty("leftMargin",
"0.7in" )

in the beforeFactory. Make sure to name the master page. In later
versions of BIRT you get the design handle like
reportContext.getDesignHandle()

Jason

On 2/23/2011 9:15 AM, Dave Remkus wrote:
> Hi,
>
> My application constrains me to using BIRT 2.2.1.
>
> I have a report that will be output to either PDF, HTML, or XLS.
>
> With the HTML and PDF outputs, I'd like to have reasonable margins, but
> with a margin set on XLS, it causes the emitter to produce an empty
> column at the margins.
>
> I know I can detect the output format in the beforeFactory script and
> can run this.getMasterPage(), but I don't see how I can change the
> margins on the master page once I have that object.
>
> Any suggestions?
>
> Thanks
Re: Setting margins for Excel output [message #656019 is a reply to message #655988] Wed, 23 February 2011 18:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: remkus.wideopenwest.com

Jason,

Excellent ....

Just like having your car engine running while waiting or someone, I
found an example of setting a watermark on a page that was getting me to
roughly the same solution. ;)

That example, though, counted the number of master pages and in my
implementation, I selected the last one.

//
// Try to turn off the margins for XLS
//
if ( reportContext.getOutputFormat() == "xls" ) {
//
// Find the master pages
//
var rh = reportContext.getReportRunnable().designHandle.getDesignHand le();
var pc = rh.getMasterPages().getCount();

// I should only have one master page
// Check to make sure I have a page I
// can access
if ( pc > 0 ) {
var ph = rh.getMasterPages().get(pc-1);
// Set the left and right margins to 0pt
ph.setProperty("leftMargin","0pt");
ph.setProperty("rightMargin","0pt");
}
}

That got me wondering about two things ....
1) What purpose would it serve to have more than one MasterPage? does
the report only reference the first? last? Could I actually have a
report without a master page defined?
2) Would another potential solution be to define two master pages - one
with margins, the other without - and select between the two based on
the report format? If so, how would I go about selecting an alternate
master page?

Thanks

On 02/23/11 11:09, Jason Weathersby wrote:
> Dave,
>
> If you are using a RunAndRender task you can modify the masterpage like:
>
> reportContext.getReportRunnable().designHandle.getDesignHand le().findMasterPage( "myMasterPage").setProperty("leftMargin",
> "0.7in" )
>
> in the beforeFactory. Make sure to name the master page. In later
> versions of BIRT you get the design handle like
> reportContext.getDesignHandle()
>
> Jason
>
> On 2/23/2011 9:15 AM, Dave Remkus wrote:
>> Hi,
>>
>> My application constrains me to using BIRT 2.2.1.
>>
>> I have a report that will be output to either PDF, HTML, or XLS.
>>
>> With the HTML and PDF outputs, I'd like to have reasonable margins, but
>> with a margin set on XLS, it causes the emitter to produce an empty
>> column at the margins.
>>
>> I know I can detect the output format in the beforeFactory script and
>> can run this.getMasterPage(), but I don't see how I can change the
>> margins on the master page once I have that object.
>>
>> Any suggestions?
>>
>> Thanks
>
Re: Setting margins for Excel output [message #656218 is a reply to message #656019] Thu, 24 February 2011 15:31 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Dave,

We have multiple master pages so you can do thing like switch potrait to
landscape in the same report. Every report item can be bound to a
particular master page. For example assume you have two tables one can
be bound to the first master page and the second table can be bound to
the second master page. Anytime there is a master page change a page
break is automatically inserted.

Jason

On 2/23/2011 1:48 PM, Dave Remkus wrote:
> Jason,
>
> Excellent ....
>
> Just like having your car engine running while waiting or someone, I
> found an example of setting a watermark on a page that was getting me to
> roughly the same solution. ;)
>
> That example, though, counted the number of master pages and in my
> implementation, I selected the last one.
>
> //
> // Try to turn off the margins for XLS
> //
> if ( reportContext.getOutputFormat() == "xls" ) {
> //
> // Find the master pages
> //
> var rh = reportContext.getReportRunnable().designHandle.getDesignHand le();
> var pc = rh.getMasterPages().getCount();
>
> // I should only have one master page
> // Check to make sure I have a page I
> // can access
> if ( pc> 0 ) {
> var ph = rh.getMasterPages().get(pc-1);
> // Set the left and right margins to 0pt
> ph.setProperty("leftMargin","0pt");
> ph.setProperty("rightMargin","0pt");
> }
> }
>
> That got me wondering about two things ....
> 1) What purpose would it serve to have more than one MasterPage? does
> the report only reference the first? last? Could I actually have a
> report without a master page defined?
> 2) Would another potential solution be to define two master pages - one
> with margins, the other without - and select between the two based on
> the report format? If so, how would I go about selecting an alternate
> master page?
>
> Thanks
>
> On 02/23/11 11:09, Jason Weathersby wrote:
>> Dave,
>>
>> If you are using a RunAndRender task you can modify the masterpage like:
>>
>> reportContext.getReportRunnable().designHandle.getDesignHand le().findMasterPage( "myMasterPage").setProperty("leftMargin",
>> "0.7in" )
>>
>> in the beforeFactory. Make sure to name the master page. In later
>> versions of BIRT you get the design handle like
>> reportContext.getDesignHandle()
>>
>> Jason
>>
>> On 2/23/2011 9:15 AM, Dave Remkus wrote:
>>> Hi,
>>>
>>> My application constrains me to using BIRT 2.2.1.
>>>
>>> I have a report that will be output to either PDF, HTML, or XLS.
>>>
>>> With the HTML and PDF outputs, I'd like to have reasonable margins, but
>>> with a margin set on XLS, it causes the emitter to produce an empty
>>> column at the margins.
>>>
>>> I know I can detect the output format in the beforeFactory script and
>>> can run this.getMasterPage(), but I don't see how I can change the
>>> margins on the master page once I have that object.
>>>
>>> Any suggestions?
>>>
>>> Thanks
>>
>
Previous Topic:Problems manually installing BIRT
Next Topic:Preview fails when parameters present
Goto Forum:
  


Current Time: Tue Apr 23 09:01:59 GMT 2024

Powered by FUDForum. Page generated in 0.03069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top