excel showing date as serial number

excel showing date as serial number

mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

i have a code to export datatable to excel but when i export and go check the values for some reaon the field "DT_CANDIDATURA" is shown as a serial number instead of normal text, anyone know why that is?


Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Please link to a test case showing the issue so we can debug it.

    If you remove your customize function does it still happen?

    Thanks,
    Allan

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    hello Allan, im using server side processing to fill the table, is it possible to make the test case with it?
    and ive summed it down to a line thats causing it its:
    $('row c', sheet).attr( 's', '50');

    whatever atribute i set, it turns the date from normal to serial number, but if just remove that line it turns normal
    the thing is that i need that line to costumize the excel

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    i fixed it, had to create a new style just for that cell and specify the numFmtId, is there a way to add a costum format to the date, i wanted to use YYYY-MM-DD, but its formatting automatically as DD/MM/YYYY

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    nevermind got it all working, thank you for the attention still

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    i have another question, how do i put borders only on top and bottom of the excel? only way i found is borders on all sides

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    That has nothing to do with DataTables. Try the Excel help line.

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    i meant on the export to excel part, how do i set the border to just top and bottom instead of the default all sides border

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    I see. Never used customise Excel myself. I expect someone else will step up.

  • kthorngrenkthorngren Posts: 21,351Questions: 26Answers: 4,955

    While not easy It is possible to add styles to the built-in styles. See this thread for some ideas.

    Kevin

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0
    edited March 2023

    Is there a way to do it like ive been doing the costum styling?
    I was looking at the borderId in the <xf> tags, but if i change it from either 0 or 1 to any other number, the excel gets corrupted, but 0 removes the border and 1 adds the all sides border, ive been looking to see if i could find any info on the borderId's available but i cant find anything.

  • mikepre98mikepre98 Posts: 8Questions: 1Answers: 0

    Got it working, had to edit the buttons.html5.min.js itself, had to remove the left and right from the borders tag.
    thanks to everyone who tried to help :)

Sign In or Register to comment.