Reputation: 1026
Using the method below I can load a row at time into an Excel file. Once all the rows are loaded into Excel.
A column holds alphanumeric characters,if cell content is numbers its aligned to left side otherwise aligned to right side.I need to always aligned to right side.
I would like change the format of cell to Text.
private void AddExcelRows(string startRange, int rowCount,int colCount, object values)
{
_range = _sheet.get_Range(startRange, _optionalValue);
_range = _range.get_Resize(rowCount, colCount);
_range.set_Value(_optionalValue, values);
}
How can I set cell format as Text?
Upvotes: 1
Views: 5433
Reputation: 5828
The text format is the '@' symbol, so:
_range.NumberFormat = "@";
should do the trick.
Upvotes: 5