0

I found the solution on stackoverflow for setting one column of Excel file as Text.

DataFormat currDataFormat = this.Workbook.CreateDataFormat();
CellStyle textStyle = this.Workbook.CreateCellStyle();
textStyle.DataFormat = currDataFormat.GetFormat("@");
sheet.SetDefaultColumnStyle(0, textStyle);

I tried same, while exporting the excel file, it is showing "Date" format for the same column. It is not working for me. I want one column as "Text" format.

Thanks in advance.

Emma Thapa
  • 767
  • 1
  • 7
  • 14

1 Answers1

0

Question seems duplicate. please see the answer here. Actual code fix should be

textStyle.DataFormat = currDataFormat.GetFormat("text");
kumar chandraketu
  • 2,232
  • 2
  • 20
  • 25