最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - Word Addin JS RichAPI General exceptionerror when using getText() for paragraph - Stack Overflow

programmeradmin2浏览0评论
      await Word.run(async (context) => {
      const document = context.document;
      const body = document.body;
      const paragraphs = body.paragraphs;

      paragraphs.load({ $all: true });
      let listItems = [];
      let paragraphText = {};
      await context.sync();

      for (let i = 0; i < paragraphs.items.length; i++) {
        paragraphGUIDHash.set(paragraphs.items[i].uniqueLocalId, true);
        listItems.push(paragraphs.items[i].listItemOrNullObject);
        listItems[i].load("listString");
      }

      try {
        await context.sync();
      } catch (error) {
        console.log("Loading error for list paragraph api!!!");
      }

      for (let i = 0; i < paragraphs.items.length; i++) {
        paragraphText[i] = paragraphs.items[i].getText({ IncludeHiddenText: false, IncludeTextMarkedAsDeleted: false});
      }

      let sectionsJson = [];
      let currentSection = [];
      let sectionCount = 1;

      try {
        await context.sync();
      } catch (error) {
        console.log("Loading error for paragraph text!!!");
      }

})

The issue over here when i use getText() i run into Richapi error and i found it on word addin PC version of windows with Office 365 version 2308 (Build 16731.20948) on our client side. But the issue seems to be not there when we use getReviewedText().

Same issue we are not over observing on our side windows with Office 365 version 2501 (Build 18429.20132). Now Can any let me know what's the issue here because on last context.sync() getting RichApi.Error: GeneralException error.

Is there any way this can be fixed with latest version of Office JS or should have fall back mechanism everytime to switch between getText() and getReviewedText().

发布评论

评论列表(0)

  1. 暂无评论