[Advanced Excel] Cell_WriteByIndex with CellType "datetime" writes a number

Forge Component
(54)
Published on 27 Aug by Hanno
54 votes
Published on 27 Aug by Hanno

Dear team,

A question for writing values with Cell_WriteByIndex with celltype "datetime", it writes data to the cell but the data shows not as a datetime / date or time but as a number:

The number format in the excel cell becomes General i see. My client doesn't want to do change the number format each time they export a dataset, so what can be done that the cell value displays as a date in excel and not a number, like now?

In the cell that I write for the testing I do this (just an example):

The alternative is to write the contents as date formatted text, but then it becomes text which is also not handy.

Please let me know,

Wilko

Wilko Odijk wrote:

Dear team,

A question for writing values with Cell_WriteByIndex with celltype "datetime", it writes data to the cell but the data shows not as a datetime / date or time but as a number:

The number format in the excel cell becomes General i see. My client doesn't want to do change the number format each time they export a dataset, so what can be done that the cell value displays as a date in excel and not a number, like now?

In the cell that I write for the testing I do this (just an example):

The alternative is to write the contents as date formatted text, but then it becomes text which is also not handy.

Please let me know,

Wilko

Hi Wilko,


Please try the CellType: "Custom"

Hope it works.


Best Regards,

FV


Wilko Odijk wrote:

Dear team,

A question for writing values with Cell_WriteByIndex with celltype "datetime", it writes data to the cell but the data shows not as a datetime / date or time but as a number:

The number format in the excel cell becomes General i see. My client doesn't want to do change the number format each time they export a dataset, so what can be done that the cell value displays as a date in excel and not a number, like now?

In the cell that I write for the testing I do this (just an example):

The alternative is to write the contents as date formatted text, but then it becomes text which is also not handy.

Please let me know,

Wilko

Wilko, please check your CellType value, it seems you are setting the parameter value to "datatime" and not "datetime".

Also try out the new version (2.1.2 - https://www.outsystems.com/forge/component-versions/355) and see if it resolves your issue, as it now supports the NumberFormat property under CellFormat.

Hanno