Custom Excel button - error when opening

Custom Excel button - error when opening

JosipJosip Posts: 7Questions: 1Answers: 0

Hello guys,

I'm working with custom excel export. Everything works fine till I add 27th column. Then Excel shows me an error. What I'am doing wrong here? I would really appreciate someones help me. Here's my code:

http://live.datatables.net/femerimi/13/edit

Replies

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    I was able to open the exported file with no problems. Does the test case show the issue you are having?

    Kevin

  • JosipJosip Posts: 7Questions: 1Answers: 0

    There are 26 columns now. Please try to add one more and check results please.

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Since you know what will cause the error please update the test case to show the problem so we can help debug.

    Kevin

  • JosipJosip Posts: 7Questions: 1Answers: 0

    Ok, here is example with error
    http://live.datatables.net/femerimi/15/edit

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    It opens fine in LibreOffice for me, although it shows lots of Undefined values.

    Does it generate the Excel file okay for you when you comment out the customize callback? Without having read and understood all the custom code you have in it (sorry - I'm rushing a bit atm!) my guess is that the error is in how the columns are referenced. You need to use AA for column 27, AB for 28 and so on.

    Allan

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Looks like the problem is int he buildRow function. It is generating the column letters, ie, A-Z. The 27th column should be AA but if you debug the code it results in 10 as the column number. The problem is with this statement:

     colNum = (i + 10).toString(36).toUpperCase();
    

    More code will need to be added to accommodate columns AA and beyond. I added a console.log statement so you can see this:
    http://live.datatables.net/gayuzile/1/edit

    Kevin

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    This is the function we use in Buttons to generate the column label.

    Allan

Sign In or Register to comment.