I tried searching for this but all I am finding references TableTools... is there anyway to make the export function for Excel using Buttons to set the column width? I would really like for it to just autowidth.
No sorry. There wasn't that option with TableTools and there still isn't with Buttons. It is something that I plan to introduce a new feature for in the next major version of Buttons. Hopefully not too far away!
Awesome. Anyway we could customize the Excel more would be awesome! I have this project that currently has 3 separate files for screen, PDF, and excel. It was poorly written and I am trying to make it all one the correct way. An option to define to column format (ex: Number) would be awesome if there is not already a way.
Joining the conversation a little late... @kthorngren what if we need only one specific column resized? Your code above works perfectly, but both of my examples below are not working.
$('row c[r^="D"]', sheet).attr('width', 50);
or $('row c[r^="D"]', sheet).each(function(){$(this).attr('width', 50);});
Any advice?
Do you by chance have a source where I can learn more about these manipulation techniques? Before finding this thread I had only seen 's' where 'width' is, and the only selector format I'd seen was in the $('row c...', sheet) format. I would really like to learn more about changing attributes like font size for a specific cell.
My approach for this type of thing is to find some base examples to work from then use console.log to look at the parameters passed into the function. That's what I did to answer your question. Just took my example and looked at what was available via console.log(col). I'm sure I took the same approach for finding the original answer.
Which is more or less the approach I took to develop the code originally . Took an xlsx file, unzipped it and take a look at the xml and try to cross reference it with what folklore is available on the web.
Answers
No sorry. There wasn't that option with TableTools and there still isn't with Buttons. It is something that I plan to introduce a new feature for in the next major version of Buttons. Hopefully not too far away!
Allan
Awesome. Anyway we could customize the Excel more would be awesome! I have this project that currently has 3 separate files for screen, PDF, and excel. It was poorly written and I am trying to make it all one the correct way. An option to define to column format (ex: Number) would be awesome if there is not already a way.
Is there an update for this issue? I need to adjust the widths for my columns
The below function will set all columns to width of 30. Assign it to the
customize
callback of theexcel
.Kevin
Thanks!
Joining the conversation a little late...
@kthorngren what if we need only one specific column resized? Your code above works perfectly, but both of my examples below are not working.
$('row c[r^="D"]', sheet).attr('width', 50);
or
$('row c[r^="D"]', sheet).each(function(){
$(this).attr('width', 50);
});
Any advice?
This code should allow you to set column D (col array element 3) to width of 50.
Kevin
That worked!
Do you by chance have a source where I can learn more about these manipulation techniques? Before finding this thread I had only seen
's'
where'width'
is, and the only selector format I'd seen was in the$('row c...', sheet)
format. I would really like to learn more about changing attributes like font size for a specific cell.Thanks for your help,
Joe
This page has some info that may help to understand the XML layout of the spreadsheet:
http://officeopenxml.com/SScontentOverview.php
My approach for this type of thing is to find some base examples to work from then use console.log to look at the parameters passed into the function. That's what I did to answer your question. Just took my example and looked at what was available via
console.log(col)
. I'm sure I took the same approach for finding the original answer.Kevin
Which is more or less the approach I took to develop the code originally . Took an xlsx file, unzipped it and take a look at the xml and try to cross reference it with what folklore is available on the web.
Allan
Appreciate the insight. Thanks again!
Joe