c# – PdfPCell中的水平文本对齐方式
发布时间:2020-12-15 18:23:49 所属栏目:百科 来源:网络整理
导读:我正在使用此代码水平对齐. 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.A
我正在使用此代码水平对齐.
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列的表,并在运行时使用上面的代码在for循环中动态添加单元格.我希望所有单元格内容都居中. 解决方法
试试这个,
cell = New PdfPCell(); p = New Phrase("value"); cell.AddElement(p); cell.HorizontalAlignment = Element.ALIGN_CENTER; //Tried with Element.Align_Center Also. Tried Adding this line before adding element also. table.AddCell(cell); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |