export excelhtml5. How to set properly format of data: number, date and time?

export excelhtml5. How to set properly format of data: number, date and time?

pablo6684pablo6684 Posts: 2Questions: 1Answers: 0

Hi,
I want to export data using excelhtml5 and I need this data in correct tormat
How to set properly format of data: number, date and time.

I try to use customized, but i don't know how to do...

customize: function ( xlsx ){
var sheet = xlsx.xl.worksheets['sheet1.xml'];
$('c[r=D2]', sheet).attr( 't', 'd'); //try to set date type
}

Please help me.

Answers

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin

    If you use the nightly it will automatically detect numbers. Dates aren't automatically detected though - that would require some customisation of the Open Spread Sheet XML. I don't knnow how to do that either :smile:. You'd need to refer to the Open Spread Sheet documentation.

    Allan

  • pablo6684pablo6684 Posts: 2Questions: 1Answers: 0

    Hi,
    thank you very much for your answer, I appreciate :)
    Unfortunately you didn't help me to much.

    I tried use to 'nightly' version, but I didn't notice differences.
    All values in exported sheet has 'General' typ.

    It is surprise for me
    that it is possible to set border to set background
    but not possible to set data type for cell\row\column.... :/

    I try to find something in documentation Open Spread Sheet.

    I have some idea, but I must doing more experiments.
    <c r="B2" s="1"><v>42607</v></c> //s="1" it is date
    <c r="C2" s="2"><v>0.4375</v></c> //s="2" it is hour
    <c r="D2" s="5"><v>125</v></c> //s="5" it is int
    <c r="E2" s="4"><v>123.6</v></c> //s="4" it is float

    For example:
    if i change s="1" to s="5" I get number type not date
    but it's works when I change xml what I created by ms excel
    when i want to do the same in sheet created by html5 it's not works

    So i still hope that some one help me.
    Please think about that.

    Best regards,
    Pawel from Poland.

  • allanallan Posts: 63,831Questions: 1Answers: 10,518 Site admin

    If you have a link to your page I'd be happy to take a look and see what the numbers aren't automatically detected with the nightly version.

    Allan

This discussion has been closed.