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.
Hi,
Can you check the font and background color/images applied to the column header? It could happen that the font color is white, that's why you cannot see it, but it could be stil there. You can copy and try to paste to see if the text is actually there.
Thank you,
Angel
I am having the same problem, its not the fontcolor.
This is the definition of my grid:
="100%"
="PoolGrid_InitializeRow"
>
/>
="False">
As you can see nothing special.
This is the code to export:
.eExporter.DownloadName = fileName;
.AllDataInDataSource;
.Excel2007;
.SessionsGrid);
Any idear what direction to look for?
Lex
I don't see anything wrong with your code. Can you submit a bug for that issue to our Dev support system including a sample web site or project please.
I will try a few other things, will submit a bug if I cant fix it.
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;
}
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
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