By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Datagrid 'colspan' export to Excel problem

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.