EPPlusFree форматы данных

Для внесения в ячейку данных формата DateTime:

workSheet.Cells[curRow + firstDataRow, 31].Value = double.Parse(input);
workSheet.Cells[curRow + firstDataRow, 31].StyleID = workSheet.Cells[firstDataRow, 31].StyleID;
workSheet.Cells[curRow + firstDataRow, 31].Style.Numberformat.Format = "dd.MM.yyyy HH:mm:ss";//or m/d/yy h:mm

Для внесения в ячейку данных числового формата:

//integer (not really needed unless you need to round numbers, Excel will use default cell properties)
ws.Cells["A1:A25"].Style.Numberformat.Format = "0";

//integer without displaying the number 0 in the cell
ws.Cells["A1:A25"].Style.Numberformat.Format = "#";

//number with 1 decimal place
ws.Cells["A1:A25"].Style.Numberformat.Format = "0.0";

//number with 2 decimal places
ws.Cells["A1:A25"].Style.Numberformat.Format = "0.00";

//number with 2 decimal places and thousand separator
ws.Cells["A1:A25"].Style.Numberformat.Format = "#,##0.00";

//number with 2 decimal places and thousand separator and money symbol
ws.Cells["A1:A25"].Style.Numberformat.Format = "€#,##0.00";

//percentage (1 = 100%, 0.01 = 1%)
ws.Cells["A1:A25"].Style.Numberformat.Format = "0%";

//accounting number format
ws.Cells["A1:A25"].Style.Numberformat.Format = "_-$* #,##0.00_-;-$* #,##0.00_-;_-$* \"-\"??_-;_-@_-";

Ответить

Ваш адрес email не будет опубликован. Обязательные поля помечены *