|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
PdfPTable how to stop columns from displaying vertically?Hi everybody,
I am using pdfTable.AddCell to export my grid to a pdf file. Everything works great with a few columns but as I add more columns, they begin to display vertically. Is there a way to ony have my cells display horizontally? Thanks for any help and here is my code(the commented lines are things Ive tried with no success): Document document = new Document(); PdfPTable pdfTable = new PdfPTable(dv.Table.Columns.Count); pdfTable.DefaultCell.BackgroundColor = Color.LIGHT_GRAY; //pdfTable.DefaultCell.NoWrap = true; for (int a = 0; a < dv.Table.Columns.Count; a++) { pdfTable.AddCell(new Phrase(dv.Table.Columns[a].Caption)); //pdfTable.DefaultCell.HorizontalAlignment = iTextSharp.text.Element. .ALIGN_CENTER; } pdfTable.DefaultCell.BackgroundColor = Color.WHITE; for (int row = 0; row <= dv.Table.Rows.Count - 1; row++) { for (int column = 0; column <= dv.Table.Columns.Count - 1; column++) { pdfTable.AddCell(new Phrase(dv.Table.Rows[row][column].ToString())); } } //pdfTable.SetTotalWidth(new float[] { (2000.0f) }); //pdfTable.SplitLate = false; MemoryStream ms = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(document, ms); document.Open(); document.Add(pdfTable); document.Close(); Response.ClearContent(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Export.pdf"); Response.BinaryWrite(ms.GetBuffer()); Response.End(); |
|
|
Re: PdfPTable how to stop columns from displaying vertically?See http://1t3xt.be/?X000099.
Paulo > -----Original Message----- > From: dsz352 [mailto:dsz352@...] > Sent: Friday, September 04, 2009 1:16 PM > To: itextsharp-questions@... > Subject: [itextsharp-questions] PdfPTable how to stop columns > from displaying vertically? > > > Hi everybody, > I am using pdfTable.AddCell to export my grid to a pdf file. > Everything > works great with a few columns but as I add more columns, > they begin to > display vertically. Is there a way to ony have my cells display > horizontally? > > Thanks for any help and here is my code(the commented lines > are things Ive > tried with no success): > > Document document = new Document(); > PdfPTable pdfTable = new PdfPTable(dv.Table.Columns.Count); > > pdfTable.DefaultCell.BackgroundColor = Color.LIGHT_GRAY; > //pdfTable.DefaultCell.NoWrap = true; > for (int a = 0; a < dv.Table.Columns.Count; a++) > { > pdfTable.AddCell(new Phrase(dv.Table.Columns[a].Caption)); > //pdfTable.DefaultCell.HorizontalAlignment = > iTextSharp.text.Element. .ALIGN_CENTER; > } > pdfTable.DefaultCell.BackgroundColor = Color.WHITE; > for (int row = 0; row <= dv.Table.Rows.Count - 1; row++) > { > for (int column = 0; column <= dv.Table.Columns.Count > - 1; column++) > { > pdfTable.AddCell(new > Phrase(dv.Table.Rows[row][column].ToString())); > } > } > //pdfTable.SetTotalWidth(new float[] { (2000.0f) }); > //pdfTable.SplitLate = false; > > MemoryStream ms = new MemoryStream(); > PdfWriter writer = PdfWriter.GetInstance(document, ms); > document.Open(); > document.Add(pdfTable); > document.Close(); > Response.ClearContent(); > Response.ContentType = "application/pdf"; > Response.AddHeader("content-disposition", > "attachment;filename=Export.pdf"); > > Response.BinaryWrite(ms.GetBuffer()); > Response.End(); Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: PdfPTable how to stop columns from displaying vertically?Thank you!
![]() ![]() |
| Free embeddable forum powered by Nabble | Forum Help |