Lotfiction
Lotfiction

Reputation: 359

Formating programmatically Excel cells from Scientific numeric to Text with C#

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 ?

Upvotes: 0

Views: 1785

Answers (1)

V2Solutions - MS Team
V2Solutions - MS Team

Reputation: 1127

try by using EntireColumn

cell.EntireColumn.NumberFormat = "@";

Upvotes: 1

Related Questions