Visual Studio DTE2: how to get text content of the current document

Posted by Sylvain on Stack Overflow See other posts from Stack Overflow or by Sylvain
Published on 2010-04-09T15:39:18Z Indexed on 2010/04/09 15:43 UTC
Read the original article Hit count: 511

Filed under:
|
|
|

I developped a package to extend Visual Studio. As part of it, I have a context menu that must process the whole text content of the active document (HTML editor).

I understand how to get the current selection : TextSelection txtSelection = (TextSelection)_bllManager.CurrentDocument.Selection;

But I dont't understand how to get the whole content of the code window in case nothing is selected.

Currently I use a work-around doing txtSelection.SelectAll() but it moves the cursor and I don't want that.

Any suggestion ?

Thanks.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about visual