PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Wed Feb 26, 2020 12:43 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Dec 22, 2007 6:56 am 
Offline

Joined: Sat Dec 22, 2007 6:47 am
Posts: 1
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group