【发布时间】:2016-10-28 11:28:02
【问题描述】:
我对表格中的垂直对齐有疑问。文字太靠近底部边框:
我的代码如下所示:
nested = new PdfPTable(3);
nested.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;
nested.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
nested.WidthPercentage = 100;
nested.AddCell(new Phrase("blablabla"));
nested.AddCell(new Phrase("blablabla"));
nested.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
nested.AddCell(new Phrase("Stand: " +
pdfdoc.Add(nested);
添加或删除行 DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE; 没有任何效果。
【问题讨论】:
-
我的意思是垂直对齐,文本几乎写在边界线而不是中间。我将用对齐中心替换我的代码!但是没有对齐的表格选项。和nested.DefaultCell.VerticalAlignment = Element.ALIGN_MIDDLE;不起作用。
-
我已经更新了你的问题。现在可以回答了。
-
对不起,这是我的第一篇文章。下次我会做得更好。我正在使用 itextsharp 5.5.9。
-
检查这个? - SO Question
-
@pijemcolu 我不知道那个答案,但是(接受的)最佳答案并不能解决问题。你需要this answer,我刚刚投了赞成票,因为这或多或少是解决问题的方法。这个答案远未完成,这就是我没有将此问题标记为“重复”的原因。