I am using ExcelLibrary dll .
I want to Freeze the Header Row .. Can any body suggest how I might do this?
I have tried the following code..
Imports System.Data.SqlClient
Imports ExcelLibrary
Imports ExcelLibrary.SpreadSheet
Partial Class DownloadExcel
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Try
Dim wb As New Workbook()
Dim sheetrowcounter As Integer
sheetrowcounter = 0
Dim sheet As New ExcelLibrary.SpreadSheet.Worksheet("ExcelSheet")
sheet.Cells(sheetrowcounter, 0) = New Cell("DELIVERY MONITORING SUMMARY(PROJECT GRANDE) ")
sheet.Cells(sheetrowcounter, 2) = New Cell("")
sheet.Cells(sheetrowcounter, 3) = New Cell("Report Date: '" & DateTime.Now.ToString("yyyy/MM/dd H:mm:ss tt") & " ")
sheetrowcounter += 1
sheetrowcounter += 1
sheet.Cells(sheetrowcounter, 0) = New Cell("Sl No")
sheet.Cells.ColumnWidth(0) = 10000
sheet.Cells(sheetrowcounter, 1) = New Cell("Name")
sheet.Cells.ColumnWidth(1) = 6000
sheetrowcounter += 1
Dim t As DataTable = Session("exceltable")
For i As Integer = 1 To t.Rows.Count - 1
Try
sheet.Cells(sheetrowcounter, 0) = New Cell(t.DefaultView.Item(i)(0))
sheet.Cells(sheetrowcounter, 1) = New Cell(t.DefaultView.Item(i)(1))
sheetrowcounter += 1
Catch ex As Exception
End Try
Next
sheet.Cells(0, 0).Format.FormatString = "freeze"
wb.Worksheets.Add(sheet)
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=DeliveryMonitoringSummaryDaily.xls")
Dim m As System.IO.MemoryStream = New System.IO.MemoryStream()
wb.SaveToStream(m)
m.WriteTo(Response.OutputStream)
Catch ex As Exception
End Try
End Sub
End Class
I am Storing a Datatable with 2 columns and some Rows in the Session("exceltable") object..