Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/08/2012, 10:14
valderramalex
 
Fecha de Ingreso: febrero-2012
Ubicación: bogota
Mensajes: 104
Antigüedad: 12 años, 3 meses
Puntos: 0
pdf con itextsharp y consulta sql

Buenos dias, acudo a ustedes siempre por ayuda, estoy creando un pdf con una consulta de sql y hasta el momento he creado este codigo pero no me funciona me sale un error en las lineas que resalte con amarillo si me pudiesen ayudar muchas gracias.

Dim Rutaarchivo As String = "C:\CrearPDF.pdf"
Dim docum As New Document
Dim pdfw As PdfWriter
Dim fuente As iTextSharp.text.pdf.BaseFont
Dim tleer As New Data.DataTable
docum = New Document(PageSize.LEDGER, 0, 0, 100, 20)
ejecutaradapter("SELECT Id_Producto, Cant, Valor_Cliente from T_Productos WHERE Id_Cotizacion= 15")
adapter.Fill(tleer)
pdfw = PdfWriter.GetInstance(docum, New FileStream(Rutaarchivo, FileMode.Create, FileAccess.Write, FileShare.None))
Dim oTabla As New PdfPTable(11, tleer.Rows.Count - 1)
docum.Open()
docum.NewPage()
fuente = FontFactory.GetFont(FontFactory.TIMES_ROMAN, iTextSharp.text.Font.DEFAULTSIZE, iTextSharp.text.Font.NORMAL).BaseFont
Dim cell1 As New Cell("Identificación")
Dim cell2 As New Cell("Nombres")
Dim cell3 As New Cell("Apellidos")
oTabla.AddCell(cell1)
oTabla.AddCell(cell2)
oTabla.AddCell(cell3)
Dim ciclo As Integer
For ciclo = 0 To tleer.Rows.Count - 1
oTabla.AddCell(tleer.Rows(ciclo)("Id").ToString)
oTabla.AddCell(tleer.Rows(ciclo)("Nombre_Usuario") .ToString)
oTabla.AddCell(tleer.Rows(ciclo)("Apellido_Usuario ").ToString)
Next
docum.Add(oTabla)
docum.PageSize.Rotate()
docum.Close()
End Sub