I have came up with the following code:
static void Main(string[] args)
{
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
object miss = System.Reflection.Missing.Value;
object path = @"C:\\Users\\t-aaalle\\Documents\\TesterWordAddin.docx";
object readOnly = true;
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);
string totalText = "";
for (int i = 0; i < docs.Paragraphs.Count; i++)
{
totalText += "\r\n" + docs.Paragraphs[i + 1].Range.Text.ToString();
}
Console.WriteLine(totalText);
Console.ReadLine();
docs.Close();
word.Quit();
}
Currently this reads the text that is in a Microsoft word file, and what I want is to be able to take the variable 'totalText' and have that value stored in an OneNote file. Is there any C# librarys, or classes that will help me in doing this, perhaps stackoverflow posts that I might have missed?
Thanks