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.
MIT License
589 stars 114 forks source link

Get column as "text" when mapping a column. #105

Closed timh52280 closed 1 year ago

timh52280 commented 2 years ago

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.

donnytian commented 2 years ago

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

timh52280 commented 2 years ago

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

timh52280 commented 2 years ago

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

timh52280 commented 2 years ago

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.

donnytian commented 2 years ago

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

timh52280 commented 2 years ago

Thank you.