Break ContentControl on multiple pages in word online using office-js

18 views Asked by At

I am inserting some html into word document using insertHTML method but the html is long and If there is any content above that html the whole ContentControl drops to the 2nd page of the document to accommodate it in a single page. Is there any way to make ContentControl breakable on multiple pages? Here is my code

if (Array.isArray(content)) {
   for (const chunk of content) {
       insertedRange = context.document.body.insertHtml(chunk, options.location);
       context.document.body.insertHtml(lineBreakBlob, options.location);
       if (options.doWrap) {
          const insertedContentControl: Word.ContentControl = insertedRange.insertContentControl();
          insertedContentControl.appearance = 'Hidden';
          insertedContentControl.tag = options.title ? options.title : 'data';
          await insertedContentControl.context.sync();
       }
   }
}

screenshot of the issue I am facing, the content should start direct below the above text. enter image description here

0

There are 0 answers