在JavaScript、xPages中使用iText库调整表列宽

在JavaScript、xPages中使用iText库调整表列宽,javascript,itext,xpages,Javascript,Itext,Xpages,在xPages中使用iText库,如何调整列宽?如果我使用table.setWidths(30,10,30),我会得到以下错误:找不到错误:com.ibm.jscript.解释器异常:脚本解释器错误,line=52,col=7:Java类“com.itextpdf.text.pdf.PdfPTable”上的Java方法“setWidths(number,number,number)”看起来setWidths需要浮动。这行吗 表.设置宽度(parseFloat(30)、parseFloat(10)

在xPages中使用iText库,如何调整列宽?如果我使用table.setWidths(30,10,30),我会得到以下错误:找不到错误:com.ibm.jscript.解释器异常:脚本解释器错误,line=52,col=7:Java类“com.itextpdf.text.pdf.PdfPTable”上的Java方法“setWidths(number,number,number)”

看起来setWidths需要浮动。这行吗

表.设置宽度(parseFloat(30)、parseFloat(10)、parseFloat(30))


将代码封装到一个Java类中,该类只需要调用一个函数,其中流和文档作为参数使用table.setWidths(parseFloat(30)、parseFloat(10)、parseFloat(30)),我仍然得到相同的错误。Brian M Moore的一个有价值的提示(将参数作为数组传递)最终起到了什么作用var table=new com.itextpdf.text.pdf.PdfPTable(3);//3列。变量宽度:浮动=[150f,100f,150f];表.设置总宽度(宽度);表2.setLockedWidth(真);var cell1=new com.itextpdf.text.pdf.PdfPCell(new com.itextpdf.text.paragration(“表单元格1”);var cell2=new com.itextpdf.text.pdf.PdfPCell(new com.itextpdf.text.paragration(“表单元格2”);var cell3=new com.itextpdf.text.pdf.PdfPCell(new com.itextpdf.text.paragration(“表单元格3”);