YD

Hello Community,

I am now working on a report to write excel tabel, I am using the createExcelWorkbook function.

I have to write a date into the cell and the content of the cell should also be in date format in the excel table. So that when I use a filter to the whole column, I can have a good sorted view of all the dates. (as the example 2020,2019,2018,2017, I change their format manually in the excel). At the moment, all the dates are considered as string and when I use the filter, the dates are not sorted and each date is an independent entry in the filter, instead of being sorted into one year.(as shown in the image the last two enties in the filter).

Thanks in advance!

 

by Nikita Martyanov
Posted on Tue, 06/25/2019 - 08:08

Hello,

did you try

setCellType(Constants.XL_CELL_DATAFORMAT_GENERAL)

for the cell to change its format from string to date?

0
by Ye Ding Author
Posted on Fri, 07/05/2019 - 11:16

In reply to by billie1989

Hallo Nikita Martyanov,

thank you very much for your answer.

I have tried this method but however I get the following error when I used it.

I guess the problem is that the constant is not the suitable value.

I tried other constants which indeed work for this function however I can't get a date format for the cells.

XL_CELL_TYPE_BLANK,

XL_CELL_TYPE_BOOLEAN,

XL_CELL_TYPE_ERROR,

XL_CELL_TYPE_FORMULA

XL_CELL_TYPE_NUMERIC

XL_CELL_TYPE_STRING

Do you have any experience with it? It would be very helpful if you have a small example to show how to convert the cell format to date.

Thanks in advance!

0
by Torsten Haase
Posted on Fri, 09/20/2019 - 08:42

Hi,

if you set the date value using "XlsCell.setCellValue(object)" with a parameter of type java.util.Date, the cell will have the correct data type. The displayed data format for this style can be set by calling for example CellStyle.setDataFormat(Constants.XL_CELL_DATAFORMAT_M_D_YY)

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock