Hi,
While i am programmin using table using sharpDPF, i am getting the fillowing error "Value was either too large or too small for an unsigned byte."
the code for this is as follows...
pdfTable myTable = new pdfTable();
myTable.borderSize = 0;
myTable.borderColor = predefinedColor.csWhite;
myTable.cellpadding = 1;
myTable.tableHeaderStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 0, predefinedColor.csBlack, predefinedColor.csWhite);
myTable.rowStyle = new pdfTableRowStyle(predefinedFont.csHelvetica, 14, predefinedColor.csBlack, predefinedColor.csWhite);
myTable.tableHeader.addColumn(new pdfTableColumn("title", predefinedAlignment.csCenter, 570));
int titleCount = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Trim().Length;
int titleRows = (int)Math.Ceiling((double)titleCount / 64);
string[] titleStrings = new string[titleRows];
for (int i = 0; i < titleRows ; i++)
{
if (i == (titleRows - 1))
titleStrings[i] = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Substring(i * 64, titleCount - ((i * 64)));
else
{
if(i==0 & titleCount <=64)
titleStrings[i] = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Trim().Substring(i * 64, titleCount);
else
titleStrings[i] = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Trim().Substring(i * 64, 64);
}
//pdfTableRow myRow = myTable.createRow();
//myRow[0].columnAlign = predefinedAlignment.csCenter;
//if (i == (titleRows - 1))
//{
// myRow[0].columnValue = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Substring(i * 64, titleCount - ((i * 64) + 2));
//}
//else
//{
// if (i == 0 & titleCount <= 64)
// {
// myRow[0].columnValue = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Trim().Substring(i * 64, titleCount);
// }
// else
// {
// myRow[0].columnValue = objProposalData.DsProposalData.Tables[0].Rows[0]["secondaryGoal"].ToString().Trim().Substring(i * 64, 64);
// }
//}
//myTable.addRow(myRow);
}
foreach (string newString in titleStrings)
{
pdfTableRow myRow = myTable.createRow();
myRow[0].columnAlign = predefinedAlignment.csCenter;
myRow[0].columnValue = newString.Trim();
myTable.addRow(myRow);
myRow = null;
}
myPage.addTable(myTable, 21, 771);
myTable = null;
Please any one tell me why the error is occuring.
|