I have an outlook automation. I would like to use a Word document as template for the message content. Lets say i have some formatted text containing tables, colors, sizes, etc. Now I'd like to copy/paste this content into an Outlook message object.
Here is some Sample Code (no cleanup):
String path = @"file.docx";
String savePath = @"file.msg";
Word.Application wordApp = new Word.Application();
Word.Document currentDoc = wordApp.Documents.Open(path);
Word.Range range = currentDoc.Range(0, m_CurrentDoc.Characters.Count);
String wordText = range.Text;
oApp = new Outlook.Application();
Outlook.NameSpace ns = oApp.GetNamespace("MAPI");
ns.Logon("MailBox");
Outlook._MailItem oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.To = "mymail@someserver.com";
oMsg.Body = wordtext;
oMsg.SaveAs(savePath);
Using Outlook/Word 2007, however the word files still mayb in 2000/2003 format (.doc).
Visual Studio 2010 with .net 4.0 (should obvious due to the samplecode).
I'm used to interop and I know that I am currently just copieing the "plain text". I think it has to be done via retreiving rtf/html from the word document...
Any suggestions?