Overflow not working in BIRT runtime engine [message #658309] |
Mon, 07 March 2011 19:43  |
John Norstad 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   |
|
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 #658744 is a reply to message #658620] |
Wed, 09 March 2011 16:17   |
|
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 #659020 is a reply to message #659002] |
Thu, 10 March 2011 16:37   |
|
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 #659223 is a reply to message #659068] |
Fri, 11 March 2011 15:23   |
|
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 #897626 is a reply to message #897451] |
Tue, 24 July 2012 19:54   |
|
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!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03307 seconds