rvercesi
Member
- Joined
- Oct 16, 2008
- Messages
- 10
- Programming Experience
- 5-10
Hi there
I am developing a small app to help manage huge Excel worksheets.
These worksheets have multiple cells colored within.
I am loading the worksheets to a DataGridView as show below but I want to keep the cell colors.
Any ideias on how to achieve this? Would help if I didn't have to cycle all cells as the worksheets have near to on hundred columns and close to four hundred rows.
Regards
I am developing a small app to help manage huge Excel worksheets.
These worksheets have multiple cells colored within.
I am loading the worksheets to a DataGridView as show below but I want to keep the cell colors.
Any ideias on how to achieve this? Would help if I didn't have to cycle all cells as the worksheets have near to on hundred columns and close to four hundred rows.
Regards
VB.NET:
Dim connectionStringTemplate As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=Yes;IMEX=1"""
Dim connectionString As String = String.Format(connectionStringTemplate, sFileName)
Dim sqlSelect As String = "SELECT * FROM [Sheet1$];"
' Load the Excel worksheet into a DataTable
Dim workbook As DataSet = New DataSet()
Dim excelAdapter As System.Data.Common.DataAdapter = New System.Data.OleDb.OleDbDataAdapter(sqlSelect, connectionString)
Try
excelAdapter.Fill(workbook)
Dim worksheet As DataTable = workbook.Tables(0)
dgv.DataSource = worksheet
Catch
'MANAGE EXCEPTION
End Try