问题
I'm facing a problem after extracting data from my sqlServer dataBase to my Excel worksheet using Microsoft.Office.Interop.Excel reference. Numeric data are displayed in a scientific numeric format, instead of being displayed in a text format. I tried to format my cell this way, but still doesn't work :
Microsoft.Office.Interop.Excel.Range cell= (Range) worksheet.Cells[rowNum, fieldNum];
cell.NumberFormat="@";
I tried even to set my cells format in my Input Excel file; which i'm actually using as a template for this program; as Number or Text but helplessly it's not working.
How can i fix please this problem ?
回答1:
try by using EntireColumn
cell.EntireColumn.NumberFormat = "@";
来源:https://stackoverflow.com/questions/25889016/formating-programmatically-excel-cells-from-scientific-numeric-to-text-with-c-sh