Npoi.Mapper icon indicating copy to clipboard operation
Npoi.Mapper copied to clipboard

Get column as "text" when mapping a column.

Open timh52280 opened this issue 2 years ago • 6 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.

timh52280 avatar Jun 24 '22 14:06 timh52280

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

donnytian avatar Jun 24 '22 14:06 donnytian

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

timh52280 avatar Jun 24 '22 14:06 timh52280

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

timh52280 avatar Jun 24 '22 15:06 timh52280

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.

timh52280 avatar Jun 24 '22 15:06 timh52280

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

donnytian avatar Jun 25 '22 06:06 donnytian

Thank you.

timh52280 avatar Jun 27 '22 14:06 timh52280