Hi Team,
We are facing a issue with Aspose.cells. When we add a cell comment the number format is getting lost. Can you please suggest how we can resolve this? We are using the below code to set style and later add comment
eg: suppose the cell had a value 456.000 before adding comment, after the comment is added it becomes 456 (decimal part is lost)
Code for setting cell color
Dim cellStyle As Aspose.Cells.Style
Dim cellStyleFlag As New Aspose.Cells.StyleFlag
cellStyle =
currentCell.Worksheet.Workbook.Styles(currentCell.Worksheet.Workbook.Styles.Add())
cellStyle.ForegroundColor = System.Drawing.ColorTranslator.FromHtml(colorCode)
cellStyle.Pattern = BackgroundType.Solid
cellStyle.Number =
currentCell.GetDisplayStyle().Number
cellStyleFlag.All = True
currentCell.SetStyle(cellStyle, cellStyleFlag)
cellStyle.Update()
Until this point the number
format is still retained.
Code for adding cell comment
'Remove the old comment
wbUpLoaded.Worksheets(SheetName).Comments.RemoveAt(rowIndex,
colIndex)
'Add a Comment to cell.
Dim commentIndex As Integer =
wbUpLoaded.Worksheets(SheetName).Comments.Add(rowIndex, colIndex)
'Accessing the newly added comment
Dim comment As Comment =
wbUpLoaded.Worksheets(SheetName).Comments(commentIndex)
'Setting the comment note
comment.Note = s_strComment
comment.Font.IsBold = True
comment.AutoSize = True
After executing the above
lines, the number format is lost.
Thanks
Sripriya