Excel Formula for POI

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Excel Formula for POI

shibsankar
Hi,

I am doing excel parsing with POI.

I have an excel cell where Formula is written.

Formula is :  =MROUND((IF(NZ38="","",NZ38+OB38)),TIME(0,10,0)).  This shows
data in cell like this : Mon 30/12 23:30

But I want the data in this format : 12/30/19 23:10 . I get this  when I do
Format cell > right click > Format Cell > Date > Type [ MM/DD/YY HH:MM ](24
hrs)

How do I get the same by POI programmatically ?

Thanks
Shib
Reply | Threaded
Open this post in threaded view
|

Re: Excel Formula for POI

Dominik Stadler
Hi,

Did you try something like

cellStyle.setDataFormat(
        createHelper.createDataFormat().getFormat("m/d/yy h:mm"));

The complete example is available at
http://poi.apache.org/components/spreadsheet/quick-guide.html#CreateDateCells

Regards.. Dominik.



On Sat, Jun 29, 2019 at 4:33 AM shibsankar <[hidden email]> wrote:

> Hi,
>
> I am doing excel parsing with POI.
>
> I have an excel cell where Formula is written.
>
> Formula is :  =MROUND((IF(NZ38="","",NZ38+OB38)),TIME(0,10,0)).  This shows
> data in cell like this : Mon 30/12 23:30
>
> But I want the data in this format : 12/30/19 23:10 . I get this  when I do
> Format cell > right click > Format Cell > Date > Type [ MM/DD/YY HH:MM ](24
> hrs)
>
> How do I get the same by POI programmatically ?
>
> Thanks
> Shib
>