Created
July 28, 2016 09:39
-
-
Save ioncodes/e5b98b3916de7a5c814cf6bc595f9dfe to your computer and use it in GitHub Desktop.
Shows how to get the text from the active document via DTE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private DTE _dte; | |
private NAME(Package package) | |
{ | |
// ... | |
_dte = (DTE) ServiceProvider.GetService(typeof(DTE)); | |
// ... | |
} | |
private static string GetDocumentText(Document document) | |
{ | |
var textDocument = (TextDocument) document.Object("TextDocument"); | |
EditPoint editPoint = textDocument.StartPoint.CreateEditPoint(); | |
var content = editPoint.GetText(textDocument.EndPoint); | |
return content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment