代码如下: 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 =左,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
推荐答案请参阅短语(iText,一个免费的Java-PDF库) 5.5.9-SNAPSHOT API) [ ^ ]。
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中如何在文本中添加下划线
发布评论