Xcel interop format column

  • Thread starter Thread starter bob
  • Start date Start date
B

bob

Hi,
Trying to format a column to text so that I can have leading 0's in
some numbers.
Can't have quotes around the numbers so need to format cells.
tried
Range rge = ws.get_Range("F1", "F80");
rge.Style = XlColumnDataType.xlTextFormat;
This errors with the enum value not found;

Looking at the enum name I would have expected to be able to set a
column type property but I can't find a way to do it.
Thanks
Bob
 
Hi,
Trying to format a column to text so that I can have leading 0's in
some numbers.
Can't have quotes around the numbers so need to format cells.
tried
Range rge = ws.get_Range("F1", "F80");
rge.Style = XlColumnDataType.xlTextFormat;
This errors with the enum value not found;

Looking at the enum name I would have expected to be able to set a
column type property but I can't find a way to do it.
Thanks
Bob

I always use rge.NumberFormat = "@" to make a Range textual. No idea
about why the above doesn't work as it compiles for me (but I didn't
test it in a spreadsheet).
 
I always use rge.NumberFormat = "@" to make a Range textual. No idea
about why the above doesn't work as it compiles for me (but I didn't
test it in a spreadsheet).
Hi,
Thanks for that.
Yep the above compiles OK but generates run time error.
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top