Hi,
I have a GridView where the first columns contains and image and the
other ones contains text. When I export the GridView, the rows in
Excel have a small height and therefore the images overlap each other.
I tried setting the GridView row height in a way that I guarantee that
the image will fit the row height. However, when I export the
GridView, the row height in Excel doesn't change (even if I make
RowStyle-Height="500", when the image has no more than 150!!)
My Export routine is this:
Private Sub Export(ByVal fileName As String, ByVal gv As GridView)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("content-disposition",
String.Format("attachment; filename={0}", fileName))
HttpContext.Current.Response.ContentType = "application/ms-
excel"
Dim sw As StringWriter = New StringWriter
Dim htw As HtmlTextWriter = New HtmlTextWriter(sw)
Dim table As Table = New Table
table.GridLines = gv.GridLines
If (Not (gv.HeaderRow) Is Nothing) Then
PrepareControlForExport(gv.HeaderRow)
table.Rows.Add(gv.HeaderRow)
End If
For Each row As GridViewRow In gv.Rows
PrepareControlForExport(row)
table.Rows.Add(row)
Next
If (Not (gv.FooterRow) Is Nothing) Then
PrepareControlForExport(gv.FooterRow)
table.Rows.Add(gv.FooterRow)
End If
table.RenderControl(htw)
HttpContext.Current.Response.Write(sw.ToString)
HttpContext.Current.Response.End()
End Sub
Any suggestions about how to make the images fit in the Excel file?
Thanks,
Ana
--
To unsubscribe, reply using "remove me" as the subject.