vb.net中如何获取到excel单元格的颜色
目前查了很多文章,给单元格设置颜色的很多,但获取颜色值的没查到
下面是我写的代码
但发现获取到的值都是 16777215
不知道该如何正确获取
Function ReadExcel(ByVal FileName As String)
Dim txt As String
Dim style1 As Excel.Style
Dim style2 As Excel.Style
AppXls = New Microsoft.Office.Interop.Excel.Application
AppXls.Workbooks.Open(FileName)
AppXls.Visible = False
AppWokBook = AppXls.Workbooks(1)
AppSheet = AppWokBook.Sheets(1)
style1 = AppSheet.Cells(2, 1).style
style2 = AppSheet.Cells(2, 2).style
Label2.Text = style1.Interior.Color
Label3.Text = style2.Interior.Color
mydataset = txt
AppXls.Quit()
AppWokBook = Nothing
AppSheet = Nothing
AppXls = Nothing
Return mydataset
End Function