Word Office Javascript API - Format first x chars

Tino Hager 0 Reputation points
2024-03-11T14:35:21.1233333+00:00

I need to change the size of the first X characters for my add-in. To do this, I should either be able to go through the individual characters or format the first X characters in one go. But I can't find a way to access the individual characters in a Word.Range that works on the web and also on the desktop. So far it only works via the search method. Have I overlooked something?

// slow performance

const charRangeCollection = word.search("*", {
  matchWildcards: true,
  matchCase: false,
  ignoreSpace: true,
  ignorePunct: true,
  matchPrefix: false,
  matchSuffix: false,
  matchWholeWord: false,
});

This does not work with Word under Windows.

const wordChar = wordRange.getRange().split([""]);
Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
655 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,459 questions
0 comments No comments
{count} votes