Click here to Skip to main content
15,889,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i created a cell as below in pdf export.
C#
 PdfPCell subCell1 = new PdfPCell();
 subCell1.Phrase = new Phrase(dtResult.Rows[i][5].ToString() + ":-" + dtResult.Rows[i][6].ToString(), FontFactory.GetFont("verdana", 8, BaseColor.BLACK));
subTable1.AddCell(subCell1); 

i want to add the next data to the same cell without creating new cell. how to solve this?

Thanks..
Posted

1 solution

Use StringBuilder class[^] to create string you want to save in single cell.
C#
StringBuilder sb = new StringBuilder(); 
PdfPCell subCell1 = new PdfPCell();
for (...)
{
    sb.AppendLine(String.Concat(dtResult.Rows[i][5].ToString(),":-",dtResult.Rows[i][6].ToString()));
}
subCell1.Phrase = new Phrase(sb.ToString(), FontFactory.GetFont("verdana", 8, BaseColor.BLACK));
subTable1.AddCell(subCell1); 
 
Share this answer
 
Comments
hasbina 10-Jul-14 5:55am    
@lOS
Thank you sir....
Maciej Los 10-Jul-14 5:56am    
You're very welcome ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900