如何在 Excel 工作表中使用 Office-js 插入页眉和页脚 [英] How to Insert headers and footers using Office-js in Excel Worksheet
本文介绍了如何在 Excel 工作表中使用 Office-js 插入页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们想使用 Office-js Api 在 Excel 工作表的页眉和页脚中插入文本.现在或不久的将来有什么方法可以做到这一点吗?
We want to insert text into headers and footers of an Excel Worksheet using the Office-js Api. Is there any way available now or in the near future to do this?
推荐答案
此功能在 ExcelApi 1.9(今年 5 月)中引入.文档
This feature got introduced in ExcelApi 1.9 (this May). Documentation
一些示例代码:
Excel.run(async (context)=>{
const sheets = context.workbook.worksheets;
sheets.load({$all: true}); // Load all sheets
const headerFooter = sheets.getActiveWorksheet().pageLayout.headersFooters.defaultForAllPages;
headerFooter.load({$all: true}); // Load header/footer
await context.sync();
headerFooter.set({leftHeader: 'something'});
});
这篇关于如何在 Excel 工作表中使用 Office-js 插入页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文