Fill viewport with blank cells

Posted by: peter on 3 September 2025, 5:51 pm EST

  • Posted 3 September 2025, 5:51 pm EST

    Currently if I import an excel file, spreadjs will only show the max rows/cols of the file, but I want to see blank cells similar to Excel, instead of gray. How to do this? If you can show a React example, that’d be great.

  • Posted 4 September 2025, 3:30 am EST

    Hi,

    As I understand, you would like blank cells to appear when importing an Excel file, instead of the gray area.

    If you are using the SpreadJS component directly, you are likely importing the Excel file with the

    import
    method. In the success callback of this method, you can add additional rows and columns so that the gray area is replaced with empty cells. Please see the attached snippet and sample: spreadjs-react-sample.zip

    spread.import(file, () => {
      console.log("Imported!!");
    
      // Add rows and columns as needed
      spread.getActiveSheet().setRowCount(1000);
      spread.getActiveSheet().setColumnCount(1000);
    }, (err) => {
      console.log(err);
    });

    If you are importing through the Designer component UI, you can instead use the

    fileLoaded
    event:

    https://developer.mescius.com/spreadjs/api/designer/classes/GC.Spread.Sheets.Designer.Events#fileloaded

    This event is triggered when an Excel file is imported in the Designer component, and you can set the row and column counts within the event to ensure empty cells are visible rather than the gray area, using

    setRowCount
    and
    setColumnCount
    .

    References:

    Regards,

    Priyam

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels