I am building a report using the microsoft.interop.excel library in C#.
I have something like this:
Range rangeTarget;
.
.
.
rangeTarget = worksheet.get_Range("C" + row, "N" + row);
I want the range to display its values as whole numbers i.e. with no decimal places. I've tried rangeTarge.AutoFormat, but have no idea how to use it.
Any Ideas ?
Thanks.
I don't know what the other formats are but you can look on the MSDN.
Excel.Range ThisRange = ThisSheet.get_Range("A:A",system.type.missing);
ThisRange.NumberFormat = "0.00%";
ThisRange.NumberFormat = "General";
ThisRange.NumberFormat = "hh:mm:ss";
ThisRange.NumberFormat = "DD/MM/YYYY";
Marshal.FinalReleaseComObject(ThisRange);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With