ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: jplevene on February 23, 2024, 08:47:44 pm

Title: Create an empty spreadsheet
Post by: jplevene on February 23, 2024, 08:47:44 pm
Created a pqGrid and used code below to import a spreadsheet:

        pq.excel.importXl({ url: "https://paramquery.com/pro2/Content/workbook.xlsx" }, function (wb) {
            $("#grid").pqGrid("importWb", { workbook: wb, extraRows: 10, extraCols: 10 });
           $("#grid").pqGrid("hideLoading");
        });

How do I create an empty spreadsheet into my grid without loading an empty xlsx file?  Basically I want to open the grid and it is an empty spreadsheet ready to edit, etc.

SOLVED (See my reply)
Title: Re: Create an empty spreadsheet
Post by: paramvir on February 23, 2024, 10:10:18 pm
Empty workbook can be used instead of empty xlsx file and extraRows, extraCols parameters can be used to add empty rows and columns.

Code: [Select]
var wb = {
      sheets: [
        {
          rows: [
          ],         
          columns: [         
          ]
        }
      ]
    }

    //import workbook into the grid.
    grid.importWb({ workbook: wb, extraRows: 20, extraCols: 10 });
Title: Re: Create an empty spreadsheet
Post by: jplevene on February 23, 2024, 10:11:57 pm
I did it by:

Code: [Select]
$("#grid").pqGrid("importWb", { sheet:0, workbook:{sheets:[{}]}, extraRows: 10, extraCols: 10 })