Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Overflow not working in BIRT runtime engine
Overflow not working in BIRT runtime engine [message #658309] Mon, 07 March 2011 19:43 Go to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
In BIRT 2.6.2 I'm having problems getting the overflow=visible property for table cells to work properly. In the report designer, I set the cell properties whiteSpace=nowrap and overflow=visibile. The XML in the report design for my test table header row is:

<header>
	<row id="8">
		<cell id="9">
			<property name="whiteSpace">nowrap</property>
			<property name="overflow">visible</property>
			<label id="23">
				<property name="display">block</property>
				<text-property name="text">Now is the time for all good men to come to the aid of their party.</text-property>
			</label>
		</cell>
		<cell id="10"/>
		<cell id="11"/>
	</row>
</header>


My test table has three columns. In the header row, column 1 contains a long string and columns 2 and 3 are empty. I want the long string to overflow the right margin of column 1 into columns 2 and 3.

In the report designer, the string overflows properly in "View Report in Web Viewer" and "View Report as HTML". In "View Report as PDF" the string is truncated at the right margin of column 1.

When this report design is used in my web server with the BIRT runtime engine, the string is truncated with both the HTML and PDF output formats. With the HTML output format the following HTML is generated for the header row:

<tr valign="top" align="left">
	<th class="style_1" style=" overflow:hidden;font-weight: normal;">
		<div id="AUTOGENBOOKMARK_1">Now is the time for all good men to come to the aid of their party.</div>
	</th>
	<th style=" overflow:hidden;font-weight: normal;"></th>
	<th style=" overflow:hidden;font-weight: normal;"></th>
</tr>


Note that the runtime engine has generated the style "overflow:hidden" for the first 'th' element, when I wanted it to generate "overflow:visible".

For now, in my web app, I have fixed the problem with the HTML by doing a global replace of "overflow:hidden" by "overflow:visibible" in the HTML returned by the BIRT engine. This is a hack, and I don't have an equivalent one for PDF output.

Is this a bug in BIRT, or have I overlooked something? Has anyone else noticed this problem?

John Norstad
Re: Overflow not working in BIRT runtime engine [message #658441 is a reply to message #658309] Tue, 08 March 2011 14:44 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

For PDF in your engine code there are several options you can use in the PDFRenderOption class:

public static final String PAGE_OVERFLOW = "pdfRenderOption.pageOverflow";

public static final int CLIP_CONTENT = 1;
public static final int FIT_TO_PAGE_SIZE = 2;
public static final int OUTPUT_TO_MULTIPLE_PAGES = 4;
public static final int ENLARGE_PAGE_SIZE = 8;

/**
* If it is set to false, all the text should be displayed into one line,
* the text which can not be displayed in the line will be clipped.
*/
public static final String PDF_TEXT_WRAPPING = "pdfRenderOption.textWrapping";

/**
* If it is set to false, no hyphenation is used.
* The word longer than the line width will be clipped at the line boundary.
*/
public static final String PDF_HYPHENATION = "pdfRenderOption.hyphenation";


To set these just use code like:
PDFRenderOption options = new PDFRenderOption();
options.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
options.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true);


Can you post what options you are setting for the HTMLRenderOption instance? Are you setting
renderOption.setEnableAgentStyleEngine(false);

Jason
Re: Overflow not working in BIRT runtime engine [message #658620 is a reply to message #658441] Wed, 09 March 2011 09:58 Go to previous messageGo to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
Jason asked:

Quote:

Can you post what options you are setting for the HTMLRenderOption instance? Are you setting renderOption.setEnableAgentStyleEngine(false);



No, I'm not calling renderOption.setEnableAgentStyleEngine.

Here's the method I wrote to run BIRT reports in my server. It's pretty simple.

    /** Runs a report.
     *
     *  @param  format          Report format = "html", "pdf", or "xls".
     *
     *  @param  params          A hasmap mapping parameter names to parameter values.
     *
     *  @param  request         Http request.
     *
     *  @return                 The report in a byte array.
     *
     *  @throws Exception
     */
     
    public static byte[] runReport (String format, HashMap<String, String> params,
        HttpServletRequest request)
            throws Exception
    {
        String reportName = params.get("Report name");
        ReportInfo reportInfo = ReportInfo.getInfo(reportName);
        String reportPath = reportsDirPath + "/" + reportName + ".rptdesign";
        IReportRunnable design = engine.openReportDesign(reportPath);
        IRunAndRenderTask task = engine.createRunAndRenderTask(design);
        RenderOption options = null;
        if (format.equals("html")) {
            HTMLRenderOption htmlOptions = new HTMLRenderOption();
            htmlOptions.setImageHandler(new HTMLServerImageHandler());
            htmlOptions.setEmbeddable(true);
            htmlOptions.setBaseImageURL(request.getContextPath() + "/birt-images");
            htmlOptions.setImageDirectory(imagesDirPath);
            options = htmlOptions;
        } else if (format.equals("pdf")) {
            PDFRenderOption pdfOptions = new PDFRenderOption();
            if (reportInfo.singlePage)
                pdfOptions.setOption(PDFRenderOption.PAGE_OVERFLOW, 
                    PDFRenderOption.FIT_TO_PAGE_SIZE);
            options = pdfOptions;
        } else {
            EXCELRenderOption xlsOptions = new EXCELRenderOption();
            options = xlsOptions;
        }
        options.setOutputFormat(format);
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        options.setOutputStream(stream);
        task.setRenderOption(options);
        task.setParameterValues(params);
        task.run();
        task.close();
        return stream.toByteArray();
    }


John Norstad
Re: Overflow not working in BIRT runtime engine [message #658744 is a reply to message #658620] Wed, 09 March 2011 16:17 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

Please try adding options.setEnableAgentStyleEngine(true); for the HTML
option.

Jason

On 3/9/2011 4:58 AM, John Norstad wrote:
> Jason asked:
>
> Quote:
>> Can you post what options you are setting for the HTMLRenderOption
>> instance? Are you setting renderOption.setEnableAgentStyleEngine(false);
>
>
> No, I'm not calling renderOption.setEnableAgentStyleEngine.
>
> Here's the method I wrote to run BIRT reports in my server. It's pretty
> simple.
>
> /** Runs a report.
> *
> * @param format Report format = "html", "pdf", or "xls".
> *
> * @param params A hasmap mapping parameter names to parameter values.
> *
> * @param request Http request.
> *
> * @return The report in a byte array.
> *
> * @throws Exception
> */
> public static byte[] runReport (String format, HashMap<String, String>
> params,
> HttpServletRequest request)
> throws Exception
> {
> String reportName = params.get("Report name");
> ReportInfo reportInfo = ReportInfo.getInfo(reportName);
> String reportPath = reportsDirPath + "/" + reportName + ".rptdesign";
> IReportRunnable design = engine.openReportDesign(reportPath);
> IRunAndRenderTask task = engine.createRunAndRenderTask(design);
> RenderOption options = null;
> if (format.equals("html")) {
> HTMLRenderOption htmlOptions = new HTMLRenderOption();
> htmlOptions.setImageHandler(new HTMLServerImageHandler());
> htmlOptions.setEmbeddable(true);
> htmlOptions.setBaseImageURL(request.getContextPath() + "/birt-images");
> htmlOptions.setImageDirectory(imagesDirPath);
> options = htmlOptions;
> } else if (format.equals("pdf")) {
> PDFRenderOption pdfOptions = new PDFRenderOption();
> if (reportInfo.singlePage)
> pdfOptions.setOption(PDFRenderOption.PAGE_OVERFLOW,
> PDFRenderOption.FIT_TO_PAGE_SIZE);
> options = pdfOptions;
> } else {
> EXCELRenderOption xlsOptions = new EXCELRenderOption();
> options = xlsOptions;
> }
> options.setOutputFormat(format);
> ByteArrayOutputStream stream = new ByteArrayOutputStream();
> options.setOutputStream(stream);
> task.setRenderOption(options);
> task.setParameterValues(params);
> task.run();
> task.close();
> return stream.toByteArray();
> }
>
>
> John Norstad
Re: Overflow not working in BIRT runtime engine [message #659002 is a reply to message #658744] Thu, 10 March 2011 16:29 Go to previous messageGo to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
Jason Weathersby wrote on Wed, 09 March 2011 11:17

Please try adding options.setEnableAgentStyleEngine(true); for the HTML option.



Eureka! That fixed the problem for the HTML format output. Many thanks.

I'm still having the same truncation problem in the PDF output, however. I don't see a similar option for PDF.

John Norstad
Re: Overflow not working in BIRT runtime engine [message #659020 is a reply to message #659002] Thu, 10 March 2011 16:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

Did you try:
PDFRenderOption options = new PDFRenderOption();
options.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
options.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true);

Jason

On 3/10/2011 11:29 AM, John Norstad wrote:
> Jason Weathersby wrote on Wed, 09 March 2011 11:17
>> Please try adding options.setEnableAgentStyleEngine(true); for the
>> HTML option.
>
>
> Eureka! That fixed the problem for the HTML format output. Many thanks.
>
> I'm still having the same truncation problem in the PDF output, however.
> I don't see a similar option for PDF.
>
> John Norstad
>
Re: Overflow not working in BIRT runtime engine [message #659068 is a reply to message #659020] Thu, 10 March 2011 21:03 Go to previous messageGo to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
Jason Weathersby wrote on Thu, 10 March 2011 11:37
Did you try:
PDFRenderOption options = new PDFRenderOption();
options.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
options.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true);



I just tried this, but it didn't help.

Here's the good overflowing text with HTML format:

http://russell.at.northwestern.edu/~jln/birt/html.png

Here's the bad truncated text with PDF format:

http://russell.at.northwestern.edu/~jln/birt/pdf.png

John Norstad
Re: Overflow not working in BIRT runtime engine [message #659223 is a reply to message #659068] Fri, 11 March 2011 15:23 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

John,

It does not look like the pdf emitter supports the overflow style. Can
you log a bug for this? The only way I know around this is to not set
the column widths.

Jason

On 3/10/2011 4:03 PM, John Norstad wrote:
> Jason Weathersby wrote on Thu, 10 March 2011 11:37
>> Did you try:
>> PDFRenderOption options = new PDFRenderOption();
>> options.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
>> options.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true);
>
>
> I just tried this, but it didn't help.
>
> Here's the good overflowing text with HTML format:
>
>
>
> Here's the bad truncated text with PDF format:
>
>
>
> John Norstad
>
Re: Overflow not working in BIRT runtime engine [message #660308 is a reply to message #659223] Thu, 17 March 2011 18:57 Go to previous messageGo to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
Jason Weathersby wrote on Fri, 11 March 2011 10:23
It does not look like the pdf emitter supports the overflow style. Can
you log a bug for this?



Yes, I'll log a bug.

Thanks very much for looking into this.

John Norstad
Re: Overflow not working in BIRT runtime engine [message #662438 is a reply to message #658309] Wed, 30 March 2011 16:27 Go to previous messageGo to next message
John Norstad is currently offline John NorstadFriend
Messages: 6
Registered: March 2011
Junior Member
I overlooked the obvious: Use the "merge cells" feature to merge the leftmost cell with the long string together with the empty cells to its right in the same row.

The PDF emitter should still probably support overflow=visible, but this problem is no longer critical for our application.

I've update the bug report with this same comment.

John Norstad
Re: Overflow not working in BIRT runtime engine [message #798546 is a reply to message #662438] Tue, 14 February 2012 20:37 Go to previous messageGo to next message
praneeth botta is currently offline praneeth bottaFriend
Messages: 6
Registered: January 2012
Junior Member
Is there any solution for this in BIRT 3.7 ?????

I am also currently having same requirement. The text in the first cell need to overflow into next cells.

While keeping the options preformatted in ROW. And auto in cell & dataset. I could able to get the overflow in html & doc view but NOT IN PDF view.

Re: Overflow not working in BIRT runtime engine [message #798572 is a reply to message #798546] Tue, 14 February 2012 21:18 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Here is the bug number:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340569
I do not think this has been fixed. Can you add comments to the bug?

Jason

On 2/14/2012 3:38 PM, praneeth botta wrote:
> Is there any solution for this in BIRT 3.7 ?????
>
> I am also currently having same requirement. The text in the first cell
> need to overflow into next cells.
>
> While keeping the options preformatted in ROW. And auto in cell &
> dataset. I could able to get the overflow in html & doc view but NOT IN
> PDF view.
>
>
Re: Overflow not working in BIRT runtime engine [message #798641 is a reply to message #798572] Tue, 14 February 2012 23:22 Go to previous messageGo to next message
praneeth botta is currently offline praneeth bottaFriend
Messages: 6
Registered: January 2012
Junior Member
I posted a comment in bugzilla
Re: Overflow not working in BIRT runtime engine [message #798644 is a reply to message #798641] Tue, 14 February 2012 23:24 Go to previous messageGo to next message
praneeth botta is currently offline praneeth bottaFriend
Messages: 6
Registered: January 2012
Junior Member
Merging of cells is not a solution. Because columns borders will be lost if we merge cells.
But according to my requirement i need to retain the table view while making the data overflow.
Re: Overflow not working in BIRT runtime engine [message #897451 is a reply to message #658309] Tue, 24 July 2012 07:54 Go to previous messageGo to next message
Jomar Romero is currently offline Jomar RomeroFriend
Messages: 4
Registered: July 2012
Junior Member
Hello,

I'm actually having the same problem. As I generate the output as HTML, text overflow works as it should be. But this is not the case with PDF generation as texts tend to be truncated. Was this ever resolved?

Any help would be appreciated.

Thanks!
Re: Overflow not working in BIRT runtime engine [message #897626 is a reply to message #897451] Tue, 24 July 2012 19:54 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you add a comment to the bugzilla number?

Jason

On 7/24/2012 3:54 AM, Jomar Romero wrote:
> Hello,
>
> I'm actually having the same problem. As I generate the output as HTML,
> text overflow works as it should be. But this is not the case with PDF
> generation as texts tend to be truncated. Was this ever resolved?
>
> Any help would be appreciated.
>
> Thanks!
Re: Overflow not working in BIRT runtime engine [message #900256 is a reply to message #897626] Mon, 06 August 2012 08:26 Go to previous messageGo to next message
Jomar Romero is currently offline Jomar RomeroFriend
Messages: 4
Registered: July 2012
Junior Member
I already did. But no response received yet. =( thanks
Re: Overflow not working in BIRT runtime engine [message #900404 is a reply to message #900256] Mon, 06 August 2012 21:02 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I will check with the team. Can you post a pdf that shows the issue?

Jason

On 8/6/2012 4:26 AM, Jomar Romero wrote:
> I already did. But no response received yet. =( thanks
Previous Topic:Birt drill down chart
Next Topic:Grid as Table in PowerPoint
Goto Forum:
  


Current Time: Mon Nov 24 22:45:36 GMT 2014

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

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