简体   繁体   English

在Sharppdf中分成两行长字符串

[英]Split into two lines long string in sharppdf

I write the below code to declare a table row with sharpPDF. 我编写以下代码以使用sharpPDF声明表行。

pdfTableRow tableRow = resultTable.createRow();
tableRow[0].columnValue = "123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789";
tableRow[1].columnValue = "OK";
resultTable.rowStyle = new pdfTableRowStyle(predefinedFont.csCourier, 8, new pdfColor(predefinedColor.csBlack), new pdfColor(predefinedColor.csWhite));

With this result: 结果如下: 在此处输入图片说明

I want split the long string of "Fase" column into or more lines. 我想将“ Fase”列的长字符串分成多行。 Any solutions? 有什么办法吗?

Have you tried using addParagraph to wrap the text? 您是否尝试过使用addParagraph换行?

sharpPDF.Tables.pdfTableRow row = tbl.createRow(); // tbl is a pdfTable with columns
int iLineHeight = 12; // Height of line for wrapping
row[0].addParagraph("Your long string goes here and will wrap.", iLineHeight, sharpPDF.Enumerators.predefinedAlignment.csLeft);

source: http://sourceforge.net/p/sharppdf/discussion/366672/thread/bd3e5b23 来源: http : //sourceforge.net/p/sharppdf/discussion/366672/thread/bd3e5b23

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM