如何将段落与itext对齐(对齐)? [英] How to align a paragraph (justify) whith Itext?

查看:89
本文介绍了如何将段落与itext对齐(对齐)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2条线,我想对齐(对齐)它们.

I have 2 lines and I want to align (justify) them.

我有此代码:

    Paragraph p=new Paragraph(ANC,fontFootData);
    p.setLeading(1, 1);
    p.setAlignment(Element.ALIGN_JUSTIFIED);
    document.add(p);


    Paragraph p2=new Paragraph(RUTTEL,fontFootData);
    p2.setLeading(1, 1);
    p2.setAlignment(Element.ALIGN_JUSTIFIED);
    document.add(p2);

其中ANC和RUTTEL是字符串,但它们不是对齐的.

where ANC and RUTTEL are string, but they not be align.

有人可以帮助我吗?

推荐答案

对于一行使用ALIGN_JUSTIFIED_ALL,多于一行使用ALIGN_JUSTIFIED.

For a one line use ALIGN_JUSTIFIED_ALL, more than one line use ALIGN_JUSTIFIED.

这篇关于如何将段落与itext对齐(对齐)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆