在 Word 加载项中使用 Office JavaScript API 代码的段落标记和隐藏格式符号 (¶)

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

是否可以使用office js添加和删除段落标记和隐藏格式符号(¶)。

office365 office-js office-addins word-addins word-web-addins
1个回答
0
投票

不可以,但是您可以使用以下代码来插入中断:

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-body.yaml
// Inserts a page break at the beginning of the document.
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
  // Create a proxy object for the document body.
  const body = context.document.body;

  // Queue a command to insert a page break at the start of the document body.
  body.insertBreak(Word.BreakType.page, Word.InsertLocation.start);

  // Synchronize the document state by executing the queued commands, and return a promise to indicate task completion.
  await context.sync();

  console.log("Added a page break at the start of the document body.");
});

要提交 Office JavaScript API 的功能请求,请将您的想法发布到 Microsoft 365 开发人员平台技术社区

© www.soinside.com 2019 - 2024. All rights reserved.