在sharppdf中分成两行长字符串

时间:2014-05-13 07:34:42

标签: c# 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));

有了这个结果: enter image description here

我希望将长串" Fase"分开。列成多行。 任何解决方案?

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用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);

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