thank you

2009/3/4 MSB <[email protected]>

>
> Hello,
>
> Shoukd this line;
>
> AreaReference ar = new AreaReference(range.getReference());
>
> not read this;
>
> AreaReference ar = new AreaReference(range.getNameName());
>
> The getNameName() method returns a String that identifies the named range,
> getReference() returns a forumla.
>
>
> Yingxue Feng wrote:
> >
> >  Hi
> >
> >    /*
> >     * Get column of a name range
> >     */
> >    private static short getNamedRangeColumn (HSSFWorkbook wb, String
> name)
> > {
> >        int namedCellIdx = wb.getNameIndex(name);
> >        HSSFName range = wb.getNameAt(namedCellIdx);
> >
> >        AreaReference ar = new AreaReference(range.getReference());
> >        CellReference[] cells = ar.getAllReferencedCells();
> >
> >        // Store the column of the named range;
> >        short rShort = cells[0].getCol();
> >
> >        // memory cleanup
> >        range = null;
> >        ar = null;
> >        cells = null;
> >
> >        return rShort;
> >
> >     }
> >
> > I upload template xls, and I got the following error:
> >
> > java.lang.IllegalArgumentException: Invalid Formula cell reference:
> > 'Tasks!D'
> >     at
> > org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:61)
> >     at
> > org.apache.poi.hssf.util.AreaReference.<init>(AreaReference.java:63)
> >     at
> >
> com.cypress.cyplm.servlet.AdminTaskSetEditAction.getNamedRangeColumn(AdminTaskSetEditAction.java:145)
> >     at
> >
> com.cypress.cyplm.servlet.AdminTaskSetEditAction.processWorkbook(AdminTaskSetEditAction.java:171)
> >     at
> >
> com.cypress.cyplm.servlet.AdminTaskSetEditAction.save(AdminTaskSetEditAction.java:593)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> > the poi version we use is 3.1-FINAL, we just changed it back from 3.2. we
> > do
> > not want to update poi to 3.2 cos it may bring other issues with our
> > codes.
> >
> > so the questions is, how to fix the issue? thanks
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/get-a-column-of-a-name-range-issue-tp22315130p22336096.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to