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

Get column as "text" when mapping a column.

timh52280 opened this issue · comments

First thank you very much for making this great library really is very useful, I just want more than to report a bug, I want to see if there is a way to get the data from a column as "text" instead of inferring the data type with the first column, since the excel file I process I have no way to process it by hand, this because I have a column with some keys like the following:

PaymentForm

01
02
03
04
05

And when I map the excel file, in spite of placing the property where it is mapped as a "string", the library obtains the data as shown below:

PaymentFormStringProperty

1
2
3
4
5

Is there any way to get the data as "text" without having to process the file by hand?

Greetings.

you can try the new TakeDynamicWithColumnType() method, if that not help, I may consider this as a bug and try to fix.

Thank you, I will test it and get back with the results.

Doesn't work if the cells for example are Numeric with format.

I think it is not really a bug but a missing feature, because for example, if the cell has CellType.Numeric NPOI does not allow to get StringCellValue, I have been reading that it is recommended to use DataFormatter and IFormulaEvaluator objects to get the text value of the cells.

thanks for the info, will fix it in next release.

Thank you.