donnytian / Npoi.Mapper

Use this tool to import or export data with Excel file. The tool is a convention based mapper between strong typed object and Excel data via NPOI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exporting data using Put doesn't recognize UseFormat.

germancasares opened this issue · comments

Was trying to insert a DateTime using Put, but It always returned me the numeric value of the Date.

I even reproduced it on the tests.

https://i.imgur.com/trrQhor.png

If you insert one row with put as override = true. It works.

But then if it is as override = false. It doesnt read the format properly.

Hi, as you described, that's by design. If you don't set orverwrite as true, the format will not set to cell and you are using existing format in the worksheet, for a pure 'save` action that means the "existing format" is the NPOI/Excel default format.

So basically you can just keep overwrite as true and then it should be ok, if you have existing data in a worksheet and want to keep them during the export, just make sure the column is set to expected format in existing worksheet, the mapper won't touch the format when you set overwrite as false.