Imports Syncfusion.Windows.Forms.CellGrid
Imports Syncfusion.Windows.Forms.Spreadsheet.Helpers
Public Class Form1
Dim x As New Dictionary(Of String, Object)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Spreadsheet1.Open("C:\Test\Book1.xlsx")
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
PopulateStyles() '<= Here will reuslt in items populating
If x.Count = 0 Then
MsgBox("No Styles populated")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
ApplyStyles(0)
End Sub
Sub PopulateStyles()
If Spreadsheet1.Workbook.Worksheets.Count > 1 Then
Dim source = Spreadsheet1.Workbook.Worksheets(0)
x.Clear()
For irow = 2 To 6
Dim t = source.Range(irow, 1).Value
x.Add(t, source.Range(irow, 1).CellStyle)
Next
End If
End Sub
Sub ApplyStyles(sheetidx As Integer)
For isheet = 1 To 3
Dim source = Spreadsheet1.Workbook.Worksheets(isheet)
For irow = 2 To 10
Dim t = source.Range(irow, 1).Value
Try
Dim cs = x(t)
If cs IsNot Nothing Then
source.Range(irow, 1).CellStyle = CType(cs, Syncfusion.XlsIO.IStyle)
End If
Catch ex As Exception
End Try
Next
Next
End Sub
End Class