Hi, I am trying to add grid lines to excelml or a border. I want this applied to all styles no matter what style it is. I tried to do this to the default styles, but my excel file won't open because it's "corrupt". Here is my code:
Can anyone help me?
Thank you.
For
Each
style
As
StyleElement
In
e.Styles
Select
Case
style.Id
Case
"itemStyle"
Dim
borders
As
New
BorderStylesCollection()
Dim
borderStyle
As
New
BorderStyles
For
i
As
Integer
= 1
To
4
'four borders
borderStyle.PositionType =
DirectCast
(i, PositionType)
borderStyle.Color = System.Drawing.Color.Black
borderStyle.LineStyle = LineStyle.Continuous
borderStyle.Weight = 1.0R
borders.Add(borderStyle)
Next
For
Each
border
As
BorderStyles
In
borders
style.Borders.Add(border)
Next
Exit
Select
Case
"alternatingItemStyle"
Dim
borders
As
New
BorderStylesCollection()
Dim
borderStyle
As
New
BorderStyles
For
i
As
Integer
= 1
To
4
'four borders
borderStyle.PositionType =
DirectCast
(i, PositionType)
borderStyle.Color = System.Drawing.Color.Black
borderStyle.LineStyle = LineStyle.Continuous
borderStyle.Weight = 1.0R
borders.Add(borderStyle)
Next
For
Each
border
As
BorderStyles
In
borders
style.Borders.Add(border)
Next
Exit
Select
End
Select
Next
Can anyone help me?
Thank you.