We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Make each column the width of the widest cell?

I'm trying to see if there are any <e-sheet(s)> settings that dynamically set the width of ever cell in a column based off the width of the widest text loaded into any cells in that column? Or maybe there's a global setting for this?

1 Reply

SI Silambarasan I Syncfusion Team July 26, 2017 01:18 PM UTC

Hi Jacob, 
 
Thank you for using Syncfusion products. 
 
We have checked your requirement and it has been achieved by using ‘fitWidth()’ client-side method in Spreadsheet. And, currently we don’t have any global setting for achieve the auto fit to width based on column text content.  Please refer the below code example. 
 
JS Playground Sample link: http://jsplayground.syncfusion.com/wlbj2iiv 
 
 
var dataSource = [ 
        //.. 
    ]; 
 
$("#Spreadsheet").ejSpreadsheet({ 
    sheets: [{ 
        rangeSettings: [{ dataSource: dataSource }] 
    }], 
    loadComplete: "onLoadComplete" 
}); 
 
function onLoadComplete (args){ 
    if (!this.isImport){ 
        this.XLResize.fitWidth([0,1]); // Column index 
    } 
} 
 
 
 
Could you please check the above sample and let us know whether is this fulfilling your requirement, if not please share us more information regarding this so that we can analyze based on that and provide you a better solution. The information provided would be great help for us to proceed further. 
 
Regards,
Silambarasan
 


Loader.
Up arrow icon