本文介绍了在itextsharp pdfpcell中如何在文本中添加下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码如下:



PdfPTable table = new PdfPTable(3);

PdfPCell cell = new PdfPCell(new Phrase( OFFICE COPY BANK COPY DEPARTMENT COPY,cop));

cell.VerticalAlignment = Element.ALIGN_MIDDLE;

cell.Horizo​​ntalAlignment = Element.ALIGN_CENTER;

cell.Colspan = 3;



cell.Horizo​​ntalAlignment = 1; // 0 =左,1 =居中,2 =正确

table.AddCell(单元格);

the code is given below

PdfPTable table = new PdfPTable(3);
PdfPCell cell = new PdfPCell(new Phrase("OFFICE COPY BANK COPY DEPARTMENT COPY", cop));
cell.VerticalAlignment = Element.ALIGN_MIDDLE;
cell.HorizontalAlignment = Element.ALIGN_CENTER;
cell.Colspan = 3;

cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
table.AddCell(cell);

cell = new PdfPCell(new Phrase("(*)Purpose of Deposit/Payment: application fees for admission to the course of" + cnams.CourseName + "," + depname + "", nm));
                    table.AddCell(cell);









在上面的代码中,我需要在存款/付款的目的:申请入场费用+ cnams.CourseName +,+ depname +

b $ b



请帮帮我

提前致谢。



我尝试了什么:



i需要在付款目的的情况下打印下划线





in the above code i need to print the underline in between the "purpose of Deposit/Payment: application fees for admission to the course of" + cnams.CourseName + "," + depname +"



Pls help me
Thanks in Advance.

What I have tried:

i need to print the underline in the case of purpose of payement

推荐答案


PdfPCell yourCell = new PdfPCell();
Paragraph yourParagraph = new Paragraph("Some Text:", FontFactory.GetFont("Calibri", 11f, Font.BOLD, BaseColor.BLACK));
LineSeparator underline = new LineSeparator(1, 100, BaseColor.BLACK, Element.ALIGN_LEFT, -2);
yourParagraph.Add(underline );
yourCell.AddElement(yourParagraph);
yourCell.PaddingTop = 20f;
yourCell.Border = PdfPCell.NO_BORDER;
yourTable.AddCell(yourCell);


这篇关于在itextsharp pdfpcell中如何在文本中添加下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:02