Hi, i am totally new at using the apose cells and I am just starting to do something now, i am trying to add some simple color to the A1 cell, but it just don't seem to work, i have posted the code below and am hoping you know where i am going wrong, also, how would I place an image from the intternet into A2 as well? thanks in advance:
Private Sub ImportDataGrid(ByVal sheet As Worksheet)
Dim license As License = New License()
license.SetLicense("D:\Aspose.Cells.lic")
sheet.Cells("A1").PutValue("Results")
sheet.Cells("A1").Style.Font.Color = Drawing.Color.Red
sheet.Cells("A1").Style.Font.IsBold = True
sheet.Cells("A1").Style.Font.Name = "Verdana"
sheet.AutoFitColumn(0, 0, 0)
' get data
Dim theDataAdapter As Data.SqlClient.SqlDataAdapter
Dim theDataset As New Data.DataSet("MyDataSet")
theDataAdapter = New Data.SqlClient.SqlDataAdapter("dbo.[test_sp]", strConn)
theDataAdapter.SelectCommand.Parameters.AddWithValue("@status", Data.SqlTypes.SqlInt16.Null).Value = 1
theDataAdapter.SelectCommand.CommandType = Data.CommandType.StoredProcedure
theDataAdapter.Fill(theDataset, "Results")
Dim dataTable As Data.DataTable = New Data.DataTable("Results")
dataTable = theDataset.Tables("Results")
GridView1.DataSource = dataTable
GridView1.DataBind()
'end get data
Dim dataGrid As dataGrid = New dataGrid()
dataGrid.DataSource = dataTable
dataGrid.DataBind()
sheet.Cells.ImportDataGrid(dataGrid, 1, 0, False)
sheet.AutoFitColumns()
GridView1.Visible = False
Response.Write("done")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim workbook As Workbook = New Workbook()
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim sheet As Worksheet = workbook.Worksheets(0)
ImportDataGrid(sheet)
workbook.Save("c:\test.xls", FileFormatType.Default)
End Sub