C# and Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to format a cell in Excel using the Excel Interop. Example: I need
to format a cell to be "610.00" Excel defaults this to 610. When I try to
match on this value of course I am not able to becasue of formating.

Later on I will need to format some dates but if I can get this one for now
I'll be happy. Then I might be able to figure out the date one on my own.

Thank You
 
I don't know anything about interop but i'd suggest setting the cell
format using: cells(x,y).NumberFormat = "0.00" which only affects
appearance and then compare cell values using cells(x,y).Value...

Hope that's even remotely close to what you're lookin for :S
 
Thanks shrewdmonky. I worked on your proposed solution but was not able to
make it work. Thanks to a friend however I have the right syntax.

Which is:

Excel.Range columnToFormat = oSheet.get_Range("A1","A100");
columnToFormat.NumberFormat = "#,##0.00_);[Red] (#,##0.0)"

This works as expected. Why is it so hard for Microsoft to put out useful
documentation?
 
Back
Top