Hi,
I just updated Aspose.Cells from version 4.4.1.13 to 4.4.3.4 and my setting are not set anymore!
I use something like this:
With pSheet.Cells(pRow, 0)
.PutValue(pDescription)
.SetStyle(InitStyle(enuStyle.DefaultStyle, _
pFontSize:=16, _
pFontBold:=True, _
pFontUnderline:=FontUnderlineType.Single))
End With
The InitStyle method is a helper method that returns a Style:
Private Function InitStyle(ByVal pStyle As enuStyle, _
ByVal pFontColor As System.Drawing.Color, _
ByVal pForegroundColor As Color, _
Optional ByVal pCustom As String = "", _
Optional ByVal pFontName As String = "Arial", _
Optional ByVal pFontSize As Integer = 10, _
Optional ByVal pFontBold As Boolean = False, _
Optional ByVal pFontUnderline As Aspose.Cells.FontUnderlineType = FontUnderlineType.None, _
Optional ByVal pAlignmentHorizontal As Aspose.Cells.TextAlignmentType = TextAlignmentType.Left, _
Optional ByVal pAlignmentVertical As Aspose.Cells.TextAlignmentType = TextAlignmentType.Center, _
Optional ByVal pBorderTop As Aspose.Cells.CellBorderType = CellBorderType.None, _
Optional ByVal pBorderLeft As Aspose.Cells.CellBorderType = CellBorderType.None, _
Optional ByVal pBorderRight As Aspose.Cells.CellBorderType = CellBorderType.None, _
Optional ByVal pBorderBottom As Aspose.Cells.CellBorderType = CellBorderType.None _
) As Aspose.Cells.Style
Dim objStyle As Aspose.Cells.Style = mWorkbook.Styles(0)
With objStyle
'Basic formatting
.ForegroundColor = pForegroundColor
.Pattern = BackgroundType.Solid
.HorizontalAlignment = pAlignmentHorizontal
.VerticalAlignment = pAlignmentVertical
With .Font
.Name = pFontName
.Size = pFontSize
.IsBold = pFontBold
.Underline = pFontUnderline
.Color = pFontColor
End With
.Borders(Aspose.Cells.BorderType.TopBorder).LineStyle = pBorderTop
.Borders(Aspose.Cells.BorderType.LeftBorder).LineStyle = pBorderLeft
.Borders(Aspose.Cells.BorderType.RightBorder).LineStyle = pBorderRight
.Borders(Aspose.Cells.BorderType.BottomBorder).LineStyle = pBorderBottom
.Custom = pCustom
Select Case pStyle
Case enuStyle.DefaultStyle
'Nothing more
Case enuStyle.TableDetail
'Nothing more
Case enuStyle.TableFooterPrograms
.Font.IsBold = True
.Font.Size = 12
.Borders(Aspose.Cells.BorderType.TopBorder).LineStyle = CellBorderType.Double
Case enuStyle.TableHeader
.HorizontalAlignment = TextAlignmentType.Center
.Font.IsBold = True
.Font.Size = 12
.ForegroundColor = Color.Silver
.Borders(Aspose.Cells.BorderType.TopBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.LeftBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.RightBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.BottomBorder).LineStyle = CellBorderType.Thin
Case enuStyle.TableStrategy
.Font.IsBold = True
.ForegroundColor = Color.FromArgb(204, 255, 204) 'Light green
Case enuStyle.TableStrategyBorders
.HorizontalAlignment = TextAlignmentType.Center
.VerticalAlignment = TextAlignmentType.Center
.Font.IsBold = True
.Font.Size = 10
.ForegroundColor = Color.FromArgb(204, 255, 204) 'Light green
.Pattern = BackgroundType.Solid
.Borders(Aspose.Cells.BorderType.LeftBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.RightBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.TopBorder).LineStyle = CellBorderType.Thin
.Borders(Aspose.Cells.BorderType.BottomBorder).LineStyle = CellBorderType.Thin
Case enuStyle.TableStyle
.Font.IsBold = True
.ForegroundColor = Color.FromArgb(255, 255, 153) 'Light Yellow
Case Else
Stop
End Select
End With
Return objStyle
End Function
What has changed? How can I easily fix that code? It is the second time in a short period of time I modify the Style method.