Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

New Post: C# Word Addin - Get selected text OR read all

$
0
0
Hi all,

I am programming a Word Addin in C# using Netoffice. I want to get selected text or (if nothing is selected) all text.

I found that snippet:

   string selectText = string.Empty;
   Word.Selection wordSelection = this.Application.Selection;
    if (wordSelection != null && wordSelection.Range != null)
    {
        selectText = wordSelection.Text;
    }
But now I need an else which selects the whole text in the word document.

Does anybody knows how to do that?

Viewing all articles
Browse latest Browse all 1741

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>