将 BIRT 报告导出为 PDF 的单元格上的自动换行文本



>我有下一个问题,我需要将此文本包装在此单元格上,但出现裁剪

例: 点击这里

但全文是:0123456789ABCDEFGH 并且仅显示:0123456789ABCD

如何在单元格上换行文本?,IM 在 Eclipse Neon 上使用 BIRT 报告 4.6

基于 : http://developer.actuate.com/community/forum/index.php?/topic/19827-how-do-i-use-word-wrap-in-report-design/?s=173b4ad992e47395e2c8b9070c2d3cce

如果您使用的是资源,请在其中添加此函数。如果没有,您可以复制并使用函数中的代码。

变量 longStr 是您要包装的长字符串 (0123456789ABCDEFGH( 宽度是您要为字符串授权的大小,因此它是 15。

/** 
* Format a long String to be smaller and be entirely showed
*
*@param longStr 
*             the String to split
*@param width
*               the character number that the string should be 
*
*@returns the string splited
*/
function wrap(longStr,width){ 
length = longStr.length; 
if(length <= width) 
return longStr; 
return (longStr.substring(0, width) + "n" + wrap(longStr.substring(width, length), width)); 
} 

最新更新