468,283 Members | 1,798 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,283 developers. It's quick & easy.

Datagrid 'colspan' export to Excel problem

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.

Nov 21 '05 #1
0 2626

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by vinay | last post: by
2 posts views Thread by C | last post: by
2 posts views Thread by Bidarkota | last post: by
3 posts views Thread by Bidarkota | last post: by
6 posts views Thread by slinky | last post: by
1 post views Thread by Reggie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.