Tricinty
Tricinty

Reputation: 73

How can i get a DataType of a specific cell with EpPlus?

How can i get a DataType of a specific cell with EpPlus while reading an excel file and not the NumberFormat?

Upvotes: 1

Views: 2040

Answers (1)

bryc3monk3y
bryc3monk3y

Reputation: 464

Is this what you were looking for?

var longValDt = xlws.Cells[i, j].Value.GetType().ToString(); // "System.String"
var shortValDt = xlws.Cells[i, j].Value.GetType().ToString().Split('.')[1]; // "String"
var longTextDt = xlws.Cells[i, j].Text.GetType().ToString(); // "System.String"
var shortTextDt = xlws.Cells[i, j].Text.GetType().ToString().Split('.')[1]; // "String"
var format = xlws.Cells[i, j].Style.Numberformat.Format; // "General"

Upvotes: 1

Related Questions