Good point, Greg. Thanks. I think the best choice to handle dates, though,
is to provide a CellStyle object and then use DateUtil.isADateFormat static
method to check if the formatted value is in fact a date or not. It seems
to work better now.

Anyway, including the CellStyle in this method would be a good improvement
for this SheetContentsHandler or should I keep it just to fit my needs to
work with dates?


Regards.

On Mon, May 7, 2018 at 1:21 AM, Greg Woolsey <greg.wool...@gmail.com> wrote:

> Don't know the history, but the value is not that straightforward.  If the
> cell has a specifically assigned format, it is used.  However, format may
> also be derived from conditional formatting, which may not be evaluated in
> that context.  In fact, conditional formatting evaluation is quite a recent
> addition to POI.  I haven't checked, but since the same or similar
> formatting constructs are used, it could also come from theme or table
> styles.
>
> On Sun, May 6, 2018, 20:55 Wilson de Carvalho <wcmjun...@gmail.com> wrote:
>
> > Hi, everyone.
> >
> > I've been working in a solution with an implementation
> > of XSSFSheetXMLHandler.SheetContentsHandler interface and struggled with
> > date-formatted cells. I wonder why the format code that is present in the
> > style file is not provided in method
> >
> > public void cell(String cellReference, String formattedValue, XSSFComment
> > comment),
> >
> > thus making it something like:
> >
> > public void cell(String cellReference, String formattedValue, XSSFComment
> > comment, String formatString)
> >
> >
> > It would greatly improve user code flexibility if the format string that
> is
> > used to define a cell was also provided in this method. It would avoid
> the
> > need of extending org.xml.sax.helpers.DefaultHandler when the sole
> purpouse
> > is to have access to the cell format string.
> >
> > Any thoughts or considerations?
> >
> >
> > Regards,
> >
> > --
> > Wilson de Carvalho.
> >
>



-- 
Wilson de Carvalho.

Reply via email to