itext7-表格单元格中的旋转段落使空格换行,从而换行

问题描述

我正在使用Java和itext7创建小标签,我需要将第一个单元格中的文本旋转90°:

Table table = new Table(2).useAllAvailableWidth().setHeight(UnitValue.PERCENT).setHeight(100f);

table.addCell(
    new Cell()
        .setBorder(new SolidBorder(0.5f))
        .setPadding(0f)
        .setVerticalAlignment(VerticalAlignment.MIDDLE)
        .add(
            new Paragraph()
                .add(sampleDate.format(DateTimeFormatter.ofPattern("dd MMM uuuu")))
                .setMultipliedLeading(0.9f)
                .setTextAlignment(TextAlignment.CENTER)
                .setFontSize(4f)
                .setRotationAngle(Math.PI/2)
        )
);
table.addCell(
    new Cell()
        .setBorder(new SolidBorder(0.5f))
        .setPadding(0f).setVerticalAlignment(VerticalAlignment.MIDDLE)
        .add(
        new Paragraph()
            .add(sampleNr + '\n' + initials)
            .setMultipliedLeading(0.9f)
            .setTextAlignment(TextAlignment.CENTER)
            .setFontSize(9f)
    )
);

document.add(table);

通过旋转段落,文本将在每个空格处断开,形成新行。 没有旋转,这不会在第二个单元格中发生。 (请原谅第二个单元格中的快速newLine)

enter image description here

我在网上发现可以通过用'\ u00a0'而不是普通空格(不酷)编写nonBreakingSpaces来解决问题的方法,但是我仍然认为问题出在我的代码中或itext7上?

提前谢谢

Rawi

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...