Can we only display limited columns and rows like Excel and hide extra rows and columns?

Can Spreadsheet hide extra rows and columns like Excel?

Reference Excel screenshot, only 13 rows and 6 columns are displayed

Image_4034_1722330281952




3 Replies

DM Dinakar Manickam Syncfusion Team July 31, 2024 08:01 AM UTC

Hi lixin,


We have checked your reported query of limiting the row and columns and hiding the extra rows and columns in spreadsheet with reference to the attached screenshot. This can be achieved by setting the isFinite property of scrollSettings to true in our spreadsheet.


And then to render the rows and columns based on the data occupied, you can set the rowCount and colCount based on the usedRange property of the sheet.


For your convenience, we have prepared a sample, in which we have set the rowCount and colCount based on the usedRange in the created
event and attached along with the code snippet below for your reference.


Code Snippet:

created: function () {

    spreadsheet.merge('Cart!A1:F2');

    let sheets = spreadsheet.sheets;

    for (var i = 0; i < sheets.length; i++) {

      //Set the rowCount and colCount based on used range.

      sheets[i].rowCount = sheets[i].usedRange.rowIndex + 1;

      sheets[i].colCount = sheets[i].usedRange.colIndex + 1;

    }

    //To set the modified sheet property to the Spreadsheet.

    spreadsheet.setProperties({ sheets: sheets }, true);

    //To refresh the changes in UI.

    spreadsheet.resize();

  }


Sample Link: https://stackblitz.com/edit/gyqddg-jm3fb5


Also, we have prepared a video demonstration showcasing the above requirement and attached below for your reference.

Video Link: Please refer to the attachment below.


For more information, you can refer to the UG link mentioned below.

UG Link: https://ej2.syncfusion.com/javascript/documentation/spreadsheet/scrolling#finite-scrolling-with-defined-rows-and-columns


Kindly, check the above details and get back to us for further clarifications.


Regards,
Dinakar M


Attachment: VideoF191516_2882fdf6.zip


LI lixin August 1, 2024 08:34 AM UTC

Thank you for the reply.
I was able to solve my problem!


BP Babu Periyasamy Syncfusion Team August 2, 2024 10:30 AM UTC

Hi lixin,

We are glad that your query has been resolved. Kindly get back to us for any other assistance.


Loader.
Up arrow icon