垂直对齐不在复合模式下工作 [英] Vertical alignment not working in composite mode

查看:136
本文介绍了垂直对齐不在复合模式下工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下应该根据文档工作,但它不适合我。我错过了什么吗?

The following should work according to the documentation but it's not working for me. Am I missing something?

PdfPTable rs1 = new PdfPTable(1);
PdfPCell c = new PdfPCell();

Paragraph p = new Paragraph("some text to align");

c.AddElement(p);
c.VerticalAlignment = Element.ALIGN_MIDDLE;

rs1.AddCell(c);
rs1.AddCell("more text");

return rs1;


推荐答案

啊。你需要设置PdfCell的垂直对齐,而不是段落。

Ah. You need to set the PdfCell's vertical alignment, not the paragraph.

PdfPCell c = new PdfPCell();
c.setVerticalAlignment(Element.ALIGN_MIDDLE);
...

这篇关于垂直对齐不在复合模式下工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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