Column Headers missing while using GridWeb1.WebWorksheets.SaveToExcelFile

Hi,

I am using Aspose.grid as evaluation version & on the last phase of process.

Can u please let me know the pricing for the product..will manage to buy in last week of this month.

I am facing problem with the following code:

Private Sub btnSaveGrid_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveGrid.Click

Dim strFileName As String

strFileName = Server.MapPath(".") & "\Required Files\Sold\SoldDetails" & FormatDateTime(Date.Now(), DateFormat.LongDate) & ".xls"

Try

GridWeb1.WebWorksheets.SaveToExcelFile(strFileName, FileFormatType.Excel2003)

Dim file As System.IO.FileInfo = New System.IO.FileInfo(strFileName)

If file.Exists Then

Response.Clear()

Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name)

Response.AddHeader("Content-Length", file.Length.ToString())

Response.ContentType = "application/vnd.ms-excel"

Response.WriteFile(file.FullName)

Response.End()

Else

Response.Write(" ")

End If

Catch ex As Exception

Finally

strFileName = ""

End Try

End Sub

Its a .net Button from which i am facilating user to download grid as excel.I am facing problem when user will save the grid as excel, he should be able to see column names....where as its saving only data not the columns.

Ashutosh

for ex...i am showing plot no & phone no..& when i will save the Data as excel..it should save like...

PlotNo PhoneNo.

1 568142

2 2354876

where as its showing

1 568142

2 2354876

So how can i get headers while saving sheet using SaveToExcelFile Method

Hi,

Well, if you set the column headers using cells.SetColumnCaption() method, the headers won't be rendered in the exported excel file, this is due to the fact that MS Excel does not allow this by default. I think you should create column headers in the sheet (in-line headers) cells and then save the excel file, i.e..,

A B

1 PlotNo PhoneNo.

2 1 568142

3 2 2354876

And for sales inquires, please post a query @ Aspose.Purchase forum: http://www.aspose.com/community/forums/aspose.purchase/220/showforum.aspx and one of our sales representative will help you soon.

Thank you.