在PdfPCell水平文本对齐 [英] Horizontal text alignment in a PdfPCell

查看:2747
本文介绍了在PdfPCell水平文本对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这code对齐水平。

I am using this code to align horizontally.

cell = New PdfPCell();
p = New Phrase("value");
cell.AddElement(p);
cell.HorizontalAlignment = PdfPCell.ALIGN_CENTER; //Tried with Element.Align_Center Also. Tried Adding this line before adding element also. 
table.AddCell(cell);

它不工作。

我创建一个表5列,并在动态增加细胞的运行时间循环以上code。我希望所有单元的内容为中心。

I am creating a table with 5 columns in it and adding cells dynamically in runtime in a for loop with above code. I want all cells content to be centered.

推荐答案

我知道这是老问题,但在适当的sollution是使用 cell.Horizo​​ntalAlignment = 1;

I know this is old question, but the proper sollution is to use cell.HorizontalAlignment = 1;

下面是一个不错的例如

这篇关于在PdfPCell水平文本对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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