问题描述
我需要在 Microsoft Excel 中使用 Graph API 创建一个表格。
https://docs.microsoft.com/en-us/graph/api/worksheet-post-tables?view=graph-rest-1.0
根据上述文档,如果我们在创建表 API 中将 hasHeaders
字段设置为 false,它应该创建一个没有标题的表。但是,我仍然得到一张带有标题的表格。我在下面添加了屏幕截图。
那么如何在 Excel 中创建没有标题的表格?
解决方法
如果我正确阅读了文档,即使您的源代码没有标题,Excel 也会自动创建标题:
创建表后,您需要class MySinglton {
private static volatile MySinglton instance;
private MySinglton() {}
public static MySinglton getInstance() {
if (instance == null) {
synchronized (MySinglton.class) {
if (instance == null) {
instance = new MySinglton();
}
}
}
return instance;
}
}
您创建的Update
对象,并将WorkbookTable
设置为ShowHeaders
https://docs.microsoft.com/en-us/graph/api/table-update?view=graph-rest-1.0&tabs=http