after the reference of idataobject interface is created I need to bring the words in the clip board into an array excluding all the spaces in the original text. Please advice. Thank you.
here's my first part of the code:
public void ReadMsWord()
{
string filePath = null;
OpenFileDialog file = new OpenFileDialog();
file.Title = "Word File";
file.InitialDirectory = "c:\\";
file.RestoreDirectory = true;
if (file.ShowDialog() == DialogResult.OK)
{
filePath = file.FileName.ToString();
}
try
{
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
object miss = System.Reflection.Missing.Value;
object path = filePath;
object readOnly = false;
Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
docs.ActiveWindow.Selection.WholeStory();
docs.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
Here I'm trying to import data from a word document. The data is copied from a word file to the clip board.
I need to bring the words in the clip board into an array excluding all the spaces in the original text.