【发布时间】:2018-08-09 23:40:25
【问题描述】:
我有下一个问题,我需要在这个单元格上包装这个文本,但是看起来被裁剪了
示例: click here
但全文为:0123456789ABCDEFGH 并且只显示:0123456789ABCD
如何将文本包装在单元格上?我在 Eclipse Neon 上使用 BIRT Report 4.6
【问题讨论】:
我有下一个问题,我需要在这个单元格上包装这个文本,但是看起来被裁剪了
示例: click here
但全文为:0123456789ABCDEFGH 并且只显示:0123456789ABCD
如何将文本包装在单元格上?我在 Eclipse Neon 上使用 BIRT Report 4.6
【问题讨论】:
如果您正在使用资源,请在其中添加此功能。如果没有,您可以复制并使用函数内的代码。
变量 longStr 是你想要包装的长字符串 (0123456789ABCDEFGH) width 是您要为字符串授权的大小,因此对您来说是 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));
}
【讨论】: