We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Number format lost after adding CELL COMMENT

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 <?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>

Dim cellStyle As Aspose.Cells.Style<o:p></o:p>

Dim cellStyleFlag As New Aspose.Cells.StyleFlag<o:p></o:p>

cellStyle =

cellStyle.ForegroundColor = System.Drawing.ColorTranslator.FromHtml(colorCode)<o:p></o:p>

cellStyle.Pattern = BackgroundType.Solid<o:p></o:p>

cellStyle.Number =

cellStyleFlag.All = True<o:p></o:p>

currentCell.SetStyle(cellStyle, cellStyleFlag)<o:p></o:p>


Until this point the number
format is still retained.

Code for adding cell comment<o:p></o:p>

'Remove the old comment<o:p></o:p>


'Add a Comment to cell.<o:p></o:p>

Dim commentIndex As Integer =
wbUpLoaded.Worksheets(SheetName).Comments.Add(rowIndex, colIndex)<o:p></o:p>

'Accessing the newly added comment<o:p></o:p>

Dim comment As Comment =

'Setting the comment note<o:p></o:p>

comment.Note = s_strComment<o:p></o:p>

comment.Font.IsBold = True<o:p></o:p>

comment.AutoSize = True<o:p></o:p>

After executing the above
lines, the number format is lost.




Thanks for your posting and using Aspose.Cells for .NET.

We have tested your issue with the latest version: Aspose.Cells
for .NET v7.5.0.2
and found it is working fine.

If your issue still persist, please provide us your sample project replicating this issue with the latest version. We will look into it and update you asap.