Connecting Tech Pros Worldwide Forums | Help | Site Map

Datagrid 'colspan' export to Excel problem

kieran
Guest
 
Posts: n/a
#1: Nov 21 '05
Hi,

I have an 'export to excel' button on my Datagrid. All works well
except that on my Datagrid, I have sub total rows. The subtotal rows
use colspan so that the subtotals are given above certain columns

When I export to excel, I do not have the colspan. As a result, the
subtotals appear over the wrong columns in Excel.


This is how the export looks -

<td >Overall
Total</td><td>0</td><td>-2024.430</td><td>-2024.430</td><td>0</td><td>2024.430</td><td></td><td></td><td></td><td></td>



This is how the datagrid looks -

<td colspan="5">Overall Total</td><td
align="Center">0</td><td>-2024.430</td><td
align="Center">-2024.430</td><td align="Center">0</td><td>2024.430</td>



Here is the export function -

Public Sub ExcelExport()
Response.ContentType = "application/vnd.ms-excel"
' Remove the charset from the Content-Type header.
Response.Charset = ""
' Turn off the view state.
Me.EnableViewState = False
Dim tw As New System.IO.StringWriter
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
' Get the HTML for the control.
dgJobs.RenderControl(hw)
' Write the HTML back to the browser.
Response.Write(tw.ToString())
' End the response.
Response.End()
End Sub



How do i get around this.

Thanks for any help.




Closed Thread