标题不可见

问题描述 投票:0回答:0

我不想在桌子上放一个标题。为此,我在 tables.add 方法中传递了 false,并且还使用了 showHeaders:false 来表示表中的标题不可见。 表格标题不可见,但表格顶部显示一行。我附上了截图。我的代码在下面。

我怎样才能删除那条线?

  await Excel.run(async (context) => {
    let sheet = context.workbook.worksheets.getActiveWorksheet();
    let expensesTable = sheet.tables.add("A1:D1", false);
    expensesTable.name = "ExpensesTable";
    expensesTable.showHeaders = false;

    expensesTable.rows.add(null, [
      ["1/1/2017", "The Phone Company", "Communications", "$120"],
      ["1/2/2017", "Northwind Electric Cars", "Transportation", "$142"],
      ["1/5/2017", "Best For You Organics Company", "Groceries", "$27"],
      ["1/10/2017", "Coho Vineyard", "Restaurant", "$33"],
      ["1/11/2017", "Bellows College", "Education", "$350"],
      ["1/15/2017", "Trey Research", "Other", "$135"],
      ["1/15/2017", "Best For You Organics Company", "Groceries", "$97"]
    ]);
    if (Office.context.requirements.isSetSupported("ExcelApi", "1.2")) {
      sheet.getUsedRange().format.autofitColumns();
      sheet.getUsedRange().format.autofitRows();
    }

    sheet.activate();

    await context.sync();
  });
office-addins add-in excel-addins excel-tables excel-web-addins
© www.soinside.com 2019 - 2024. All rights reserved.