I have a radgrid with an export function that brings data from a database, including an additional header and text, which are document conditions. These document conditions include images, the problem is the last image that is resized to adjust to the tall of the PDF
Protected Sub CotDetGrid_PdfExporting(sender As Object, e As GridPdfExportingArgs) Handles CotDetGrid.PdfExporting
Try
colwidth = Split(CamposDeseados, ",").Count
Dim columnasMenos = 0
If PoscProducto.Equals("Fila") Then
If CamposDeseados.Contains("Producto") And CamposDeseados.Contains("Observación") Then
colwidth -= 2
columnasMenos = 2
ElseIf CamposDeseados.Contains("Producto") Or CamposDeseados.Contains("Observación") Then
colwidth -= 1
columnasMenos = 1
End If
Else
If CamposDeseados.Contains("Observación") Then
colwidth -= 1
columnasMenos = 1
End If
End If
colwidth = CType((555 / colwidth), Integer) 'calcular el width segun la cantidad de columnas
e.RawHTML = ""
e.RawHTML = "<
div
style
=
'font-size:10pt;'
>" & _
"<
table
width
=
'555px'
style
=
' margin-left:0px; margin-right:0px;'
>" & _
"<
colgroup
><
col
/><
col
/></
colgroup
>" & _
"<
tbody
>" & _
"<
tr
>" & _
"<
td
align
=
'center'
colspan
=
'2'
> " + Imagen + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'center'
colspan
=
'2'
> " + DirTel + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'center'
colspan
=
'2'
> </
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
> </
td
>" & _
"<
td
align
=
'right'
>" + FechaElaboracion + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
> </
td
>" & _
"<
td
align
=
'right'
>" + FechaEmision + "</
td
>" & _
"</
tr
>" & _
"<
tr
><
td
> </
td
><
td
> </
td
></
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'left'
>" + Cliente + "</
td
>" & _
"<
td
align
=
'right'
>" + Moneda + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'left'
>" + Saludo + ContactoNombre + "</
td
>" & _
"<
td
align
=
'right'
>" + NumPartidas + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'left'
>" + ContactoPuesto + "</
td
>" & _
"<
td
align
=
'right'
>" + fFolio + "</
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
align
=
'left'
>" + ContactoTelefono + "</
td
>" & _
"<
td
> </
td
>" & _
"</
tr
>" & _
"<
tr
>" & _
"<
td
colspan
=
'2'
> </
td
>" & _
"</
tr
>" & _
"<
tr
style
=
'text-align: justify; text-justify: inter-word;'
>" & _
"<
td
colspan
=
'2'
> " + hiddenMensajeGrid.Value + " </
td
>" & _
"</
tr
>" & _
"</
tbody
>" & _
"</
table
>"
Dim columnasPdf As Integer = CamposDeseados.Split(",").Length - columnasMenos
Dim col = ""
For i = 1 To columnasPdf Step 1
col += "<
col
/>"
Next
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
table
width
=
'555px'
style
=
'font-size:8pt; margin-left:0px; margin-right:0px;white-space: nowrap;'
>" & _
"<
colgroup
>" & _
col & _
"</
colgroup
>" & _
"<
tbody
>" & _
"<
tr
style
=
'text-align:center; background-color:#A0A0A0; color:#FFFFFF; font-weight: bold;'
>"
If CamposDeseados.Contains("Partida") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Partida</
td
>"
End If
If CamposDeseados.Contains("Imagen") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Imagen</
td
>"
End If
If CamposDeseados.Contains("Código") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Código</
td
>"
End If
If CamposDeseados.Contains("Producto") And PoscProducto.Equals("Columna") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Producto</
td
>"
End If
If CamposDeseados.Contains("Unidad de Medida") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Unidad de Medida</
td
>"
End If
If CamposDeseados.Contains("Precio Unitario") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Precio Unitario</
td
>"
End If
If CamposDeseados.Contains("Cantidad") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
>Cantidad</
td
>"
End If
If CamposDeseados.Contains("Importe") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Importe</
td
>"
End If
If CamposDeseados.Contains("Descuento %") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Descuento %</
td
>"
End If
If CamposDeseados.Contains("Impuesto %") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Impuesto %</
td
>"
End If
If CamposDeseados.Contains("Impuesto") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Impuesto</
td
>"
End If
If CamposDeseados.Contains("Total") Then
e.RawHTML = Convert.ToString(e.RawHTML) & _
"<
td
style
=
'text-align:right;'
>Total</
td
>"
End If
e.RawHTML = Convert.ToString(e.RawHTML) & _
"</
tr
>" & _
body & _
"</
tbody
>" & _
"</
table
>" & _
"</
div
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "<
br
/><
br
/><
br
/>"
e.RawHTML = Convert.ToString(e.RawHTML) & "<
div
style
=
'font-size:10pt;'
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "<
table
width
=
'555px'
style
=
'margin-left:0px; margin-right:0px;'
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "<
colgroup
><
col
/></
colgroup
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "<
tbody
>"
If IncluirCondiciones = 1 Then
CotizacionCondiciones = CotizacionCondiciones.Replace("<
p
", "<div
style
=
'font-size:10pt;'
")
CotizacionCondiciones
= CotizacionCondiciones.Replace("</p>", "</
div
><
br
/><
p
></
p
>")
CotizacionCondiciones = CotizacionCondiciones.Replace("span", "div style='font-size:10pt;'")
e.RawHTML = Convert.ToString(e.RawHTML) & "<
tr
> <
td
style
=
'line-height:1;'
> <
p
></
p
>" + CotizacionCondiciones + "</
td
> </
tr
>"
End If
If IncluirFirma = 1 Then
e.RawHTML = Convert.ToString(e.RawHTML) & "<
tr
><
td
> </
td
></
tr
><
tr
><
td
> </
td
></
tr
><
tr
><
td
> </
td
></
tr
><
tr
><
td
style
=
'text-align:center'
>___________________________</
td
></
tr
><
tr
><
td
style
=
'text-align:center'
>" + NombreResponsable + "</
td
></
tr
>"
End If
e.RawHTML = Convert.ToString(e.RawHTML) & "</
tbody
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "</
table
>"
e.RawHTML = Convert.ToString(e.RawHTML) & "</
div
>"
Catch ex As Exception
ErrorManager(ex, "CotDetGrid_PdfExporting")
End Try
End Sub