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

Javascript Errors After Formatting Any Cell After 22

I have been using the ejSpreadsheet and everything runs fine, until I try to format any cells after cell 22.  When using the XLResize.fitWidth() function and the setBorder() function, I get javascript errors.  The code used to fit Width is below:
for (var i  =  0; i  <  jobCount + 16;  i++) { this.XLResize.fitWidth([i]) };

When i is greater than 22, the following error happens - "Cannot read property 'offsetWidth' of undefined"

When I try to set border on a cell greater than 22, this error happens - ""Cannot read property 'className' of undefined"

Is this a known problem?  I was also wondering what I can do to work around this/fix this.

Thank you for your assistance.  

1 Reply

Silambarasan I January 3, 2019 03:34 PM UTC

Hi Blake, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your reported issue and we would like to let you know that Spreadsheet will render initially with 20 rows (default row count) and 21 columns (default column count).  
 
The cause of this is due to when applying the border and fitWidth for range more than initial column count. However, we would like to suggest you to set the ‘’colCount” sheet property in Spreadsheet to apply formatting for range more than initial column count.  
 
In the below sample we are applying the border and fit width for 50 rows and 50 columns. Please check the below code snippet. 
 
 
$("#Spreadsheet").ejSpreadsheet({ 
    sheets: [{ 
        dataSource: dataSource, rowCount: 50, colCount: 50 
    }], 
    loadComplete: "onLoadComplete" 
}); 
 
function onLoadComplete(args) { 
    if (!this.isImport) { 
        var excelObj = $("#Spreadsheet").data("ejSpreadsheet"); 
        for (var i = 0; i < 50; i++) { 
            this.XLResize.fitWidth([i]); 
        }; 
        this.setBorder({ style: "solid", type: "outside", color: "#000000" }, "B1:AZ50"); 
    } 
} 
 
 
Could you please check the above sample and get back to us with more information if you need any further assistance on this? 
 
Regards, 
Silambarasan 

Loader.
Live Chat Icon For mobile
Up arrow icon