Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
289
stars
50
forks
source link
ContentControls.Add() is trimming space from user selection #217
This is trimming out the preceeding space from the selection. Thus converting only the part of the text excluding the trailing space into a control.
How do I achieve this without tampering the existing selected text. With some of the solutions I tried the existing control within the selection is getting removed.
I am trying to select some text and add a content control to this selected text as below.
selection.Range.ContentControls.Add(WdContentControlType.wdContentControlText);
This is trimming out the preceeding space from the selection. Thus converting only the part of the text excluding the trailing space into a control.
How do I achieve this without tampering the existing selected text. With some of the solutions I tried the existing control within the selection is getting removed.