Hello,I'm trying to use the WebExcelExporter to export a WebDataGrid. This works fine, but when the spreadsheet opens it doesn't include the column names. Any ideas to what I may be missing?
Can anyone point me in the right direction?Thank you.
Thanks David,
You are correct that the header row is there without any header text in it.
Furthermore, I just did your test and did a DataBind before calling export and that does indeed fix the issue!
If that's the correct approach, simply calling DataBind first then I'm fine with that.
If you want to reproduce the scenario it is very straight forward.
I created a test page with a SQDataSource, populated it with a table from my server and fed that to a WebDataGrid.
Next, I added a WebExcelExporter and a button and called Export on the button click.
I'm using v11.1 with VS2010 SP1 on XP SP3.
Hey everyone,
Is it that you're not getting the column headers to export? But you're still seeing the row? Could you try calling DataBind() before calling Export? And if someone can attach a small sample reproducing this, I'll take a look and see if it is a bug we can fix.
thanks,David Young
This fix worked for me as well, thanks.
I made a small modification to account for any number of columns (VB)::
Protected Sub WebExcelExporter_RowExported(sender As Object, e As Infragistics.Web.UI.GridControls.ExcelRowExportedEventArgs) Handles WebExcelExporter.RowExported If e.CurrentRowIndex = 0 Then For i As Integer = 0 To (Grid.Rows(0).Items.Count - 1) e.WorksheetRow.Cells(i).Value = Grid.Columns(i).Header.Text Next End If End Sub
But this still doesn't get to the root of why this is happening... am I missing something?
I'm using v11.1 btw
I eventual fixed the problem by adding the following code:
e)
{
(e.CurrentRowIndex == 0)
i=0;i<5;i++)
e.WorksheetRow.Cells[i].Value = PoolGrid.Columns[i].Header.Text;
}
Lex
I will try a few other things, will submit a bug if I cant fix it.