Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
693 views
in Technique[技术] by (71.8m points)

itext 如何换行后对齐

我用itext想输出这样的内容

>  编制单位: xxxxxxx
>           yyyyyyy
>           zzzzzzz

代码:
p=new Paragraph("编制单位:xxxxxxxxx n yyyyyyyy",smallFont);
p.setAlignment(Element.ALIGN_LEFT);

其中xxxxxxxxx,yyyyyyy,zzzzzz要对齐.加入一定量空格可以解决但是空格数量并不对应着编制单位占用的空间,何况还有其它地方也要用到这种格式,那时候字体大小不一样就不知道到底加多少空格了.有什么好的解决办法吗?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你好,我也有同样需求,你的解决了吗?求方法


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...