C# NPOI set cell style to Text / string 1-19 is formatted as a date / disable any formating

瘦欲@ 提交于 2019-12-02 07:33:10

Your data remains in "General" format even after you are using correct format string "@" as per documentation. Some time library methods don't work in NPOI so you'll have to try different approach.

You can try one of these

 _TextCellStyle.DataFormat = workbook.CreateDataFormat().GetFormat("text"); //Instead of "@"

Or prefix single quote for data when writing it for excel file like '1-19

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!