You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by L Eder <ed...@gmail.com> on 2017/04/27 15:01:35 UTC

How to pre-condition a column header in the excel module

Hi members:

An user excel file contains leading and trailing spaces in some of the
column headers.

    Examples: " January ", " January"

As consequence the resulting imported rows are set as 0.

Is there any means in the excel module that alows me to pre-trim those
headers before the row bind happens?


An extra topic here is about another behavior noted in excel module:
it fails to recognize strings containing non-alpha characters, eg, it
imports as "null".

Excel input row examples for column 'code'
row 0: 13416015a
row 1: 13416215


    @Column(allowsNull = "true")
    @Getter @Setter
    @MemberOrder(sequence="1")
    private String code;

The imported result is:

row 0: 13416015a
row 1: null

The workaround i learned was set code as int.

Any clue on this issue? Thanks, Eder

Re: How to pre-condition a column header in the excel module

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Eder

For the first issue, I think you'll need to make a change to the module;
somewhere around

https://github.com/isisaddons/isis-module-excel/blob/master/dom/src/main/java/org/isisaddons/module/excel/dom/util/ExcelConverter.java#L525

make the change, raise a PR, and I'll merge it in.

~~~
For the second issue, you can probably handle this within your
implementation of RowHandler... make it handle "dirty" data.

HTH
Dan


On Thu, 27 Apr 2017 at 16:01 L Eder <ed...@gmail.com> wrote:

> Hi members:
>
> An user excel file contains leading and trailing spaces in some of the
> column headers.
>
>     Examples: " January ", " January"
>
> As consequence the resulting imported rows are set as 0.
>
> Is there any means in the excel module that alows me to pre-trim those
> headers before the row bind happens?
>
>
> An extra topic here is about another behavior noted in excel module:
> it fails to recognize strings containing non-alpha characters, eg, it
> imports as "null".
>
> Excel input row examples for column 'code'
> row 0: 13416015a
> row 1: 13416215
>
>
>     @Column(allowsNull = "true")
>     @Getter @Setter
>     @MemberOrder(sequence="1")
>     private String code;
>
> The imported result is:
>
> row 0: 13416015a
> row 1: null
>
> The workaround i learned was set code as int.
>
> Any clue on this issue? Thanks, Eder
>