suppress "number stored as text" warning in Excel VSTO with C#
I am working in a Excel VSTO project with C#. For certain columns, I have set the NumberFormat to Text using
someCell.EntireColumn.NumberFormat = "@";
But when numbers do happen to be in these columns, Excel shows a green arrow with warning "Number Stored as Text". I want to suppress this warning message.
I know how to do that in Excel: Options -> Formulas -> in Error checking rules, uncheck "Numbers formatted as text or preceded by an apostrophe". Is it possible to do this in C# code, and only to certain cells/ranges? Thanks!
There's (in VBA)
Dim c As Range
For Each c In Selection.Cells
c.Errors(xlNumberAsText).Ignore = True
Next c
Seems like you can't address a whole range at once - have to loop through the cells
链接地址: http://www.djcxy.com/p/67840.html