Kevin
Kevin

Reputation: 1240

C# COM Interop Excel: Preserving Leading Zeros In Text Strings

I am outputting an Excel worksheet that contains strings of the form hh:mm:ss. However, Excel is seeing fit to delete any leading zeros even though they are text. I tried myRange.NumberFormat = "@" but this results in bizarre decimal representations.

Any advice is appreciated.

Regards.

Upvotes: 0

Views: 357

Answers (1)

Kevin
Kevin

Reputation: 1240

Asked too soon. Setting range.NumberFormat = "hh:mm:ss" did the trick without affecting the other strings in that column.

Upvotes: 1

Related Questions