Get Content Controls of all Selected Content

There is a GetCurrentContentControl method to get the Content Control that is selected.

Is there a way to get a list of the Content Controls for all the range of text that is selected? E.g. if I highlight a range of content, can I retrieve a list of all the content controls in that selection?

Furthermore, is it possible to get the XML structure of the selected content?

Hello @doo

In general, this can be done in such way:

  1. Get selected text as range with GetRangeBySelect method;
  2. Get all paragraphs from range with GetAllParagraphs method;
  3. For each paragraph get Content Controls with GetAllContentControls method;
  4. Sort Content Controls by types (inlineLvlSdt/ BlockLvlSdt).

I’m afraid no. How do you want to use that XML structure? Basically, what is your usage scenario?