Formatting help required

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

Hi,

Thanks for considering Aspose.

Well, related font color you are doing fine and it should work ok and if you are implementing cell's background or filling color, please use these two lines of code:

sheet.Cells("A1").Style.ForegroundColor = Color.Yellow

sheet.Cells("A1").Style.Pattern = BackgroundType.Solid

For further ref, please check:

And related placing image from the webimage to the sheet you may try to get the image from the url into the stream and then paste it in the excel sheet.

(Please import System.Net namespace in your app. before writing code )

Dim objImage As MemoryStream
Dim objwebClient As WebClient
Dim sURL As String = "http://files.myopera.com/Mickeyjoe_irl/albums/38458/nissan%20cube%20in%20car%20park.jpg"
objwebClient = New WebClient()
objImage = New MemoryStream(objwebClient.DownloadData(sURL))
Dim wb As Workbook = New Workbook()
Dim sheet As Worksheet = wb.Worksheets(0)
Dim pictures As Pictures = sheet.Pictures
Dim index As Integer = pictures.Add(1,0,objImage)
Picture picture = sheet.Pictures(index)
wb.Save("d:\test\testwebpicbook.xls")

Thank you.