Page 1 of 1

LANSA Integrator: ExcelReadService how to change date format and locale of Excel cell.

Posted: Tue Feb 02, 2021 4:19 pm
by Rieko Saitoh
Hi all,

I would like to set the dateformat in ExcelReadService as below.
March 14, 2012
Such a format is not common in Japanese. But in Excel we can change the cell formatting to set the date format.

Cell Formatting - Display Format - Date
Setting the locale to English (US) and the type "March 14, 2012".
cell setting.png
cell setting.png (78.46 KiB) Viewed 7158 times

Is it possible to change the dateformat like this with ExcelReadService?
I read the manual and found that the date format can be changed with the DEFINE command. Is it possible to change the locale as well?

Thank you.

Best regards,
Rieko Saitoh
LANSA japan

Re: LANSA Integrator: ExcelReadService how to change date format and locale of Excel cell.

Posted: Tue Feb 09, 2021 5:54 am
by Dino
Hi

I saw this example in the documentation, it shows how to change the date format, not the locale on it. Maybe an enhancement will be need to be able to change the locale.

Code: Select all

#jsmxcmd := 'ADD OBJECT(*CELLSTYLE) COLUMN(5) RANGE(5,10) TYPE(*DATE) FORMAT(*FORMAT14)'
https://docs.lansa.com/15/en/lansa093/c ... j_0485.htm

Re: LANSA Integrator: ExcelReadService how to change date format and locale of Excel cell.

Posted: Thu Feb 11, 2021 3:00 am
by Dino
Also, per the reusable part code in the XJSMEXCL ExcelService example provided in V15, looks like while format is a valid parameter for CellStyle, Locale is not there.

Code: Select all

#xjsmcmd := 'add Object(*CellStyle) Sheet(' + #Sheet + ') Column(' + #Column + ') Range(' + #Range + ') Type(' + #type + ') Font(' + #Font + ') FontSize(' + #FontSize + ') FontColor(' + #FontColor + ') Bold(' + #Bold + ') Italic(' + #Italic + ') Border(' + #Border + ') BorderStyle(' + #BorderStyle + ') BorderColor(' + #BorderColor + ') BackGround(' + #BackGround + ') Wrap(' + #Wrap + ') Locked(' + #Locked + ') Indent(' + #Indent + ') HAlign(' + #HAlign + ') VAlign(' + #VAlign + ')'

* Only add the format is nominated to ensure correct default is applied
If (#format <> *blank)

#xjsmcmd := #xjsmcmd + ' Format(' + #Format + ')'

Endif