Visual Studio - How to disable autoformat/correct while running macro?
- by Sam
When running a macro that changes the selected text, tags are automatically closed and the text formatted. How can I prevent that from happening?
For example, wrapping text in a tag:
DTE.ActiveDocument.Selection.Text = String.Format("<tag>{0}</tag>", DTE.ActiveDocument.Selection.Text)
Ends up with two closing tags:
<tag>Text</tag></tag>
Even stranger, multiple lines fails:
<li>One</li>
<li>Two</li>
<li>Three</li>
An ends up as
<ul> <li>One</li>
<li>Two</li>
<li>Three</li></li></ul>
How can I prevent that? As can be seen by the last example, the formatting is wrong and there is an extra </li>