繁体   English   中英

Tabel单元格和字符串在同一行itext

[英]Tabel cell and string in the same line itext

如何在同一行中的某些字符串之前使用单元格创建pdf? 我尝试

 PdfPTable tab=new PdfPTable(1);
 tab.addCell("T");
 tab.setWidthPercentage(3);
 tab.setHorizontalAlignment(Element.ALIGN_LEFT);
 document.add(new Paragraph(String.format("Something",tab)));
 document.add(tab);

但这行不通。

尝试这样的事情:

PdfPTable tab=new PdfPTable(2);
tab.addCell("T");
tab.addCell("Something");
tab.setWidthPercentage(30);

更新

 PdfPTable tab=new PdfPTable(2);
 PdfPTable tabLeft=new PdfPTable(1);
 tabLeft.addCell("T");
 tab.addCell(tabLeft);
 tab.addCell("Something");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM