Hello NG,
My previous post ("Create/Saving MSWord.....") could not get any replies so
taking one more chance to get some pointers.
Since that post I worked on my own and figured out many things. Only thing I
am stuck with is how to automate word instance to read from a table column,
change the file format, and save back into another column. Very much like
File-> Open (select html type file) -> SaveAs (rtf)
we might do for physical files.
Following code is better than the one I posted before and takes care of the
first problem I had in that posting. In my understanding this problem is not
related to msword NG as I am trying to using word in a windows app, using
Microsoft/System namespace rather 'ThisApplication'.
Microsoft.Office.Interop.Word.DocumentClass oDoc = new
Microsoft.Office.Interop.Word.DocumentClass();
string name = DateTime.Now.Minute.ToString() +
DateTime.Now.Second.ToString();
string sPath = @"C:\Documents and Settings\Lotus\Desktop\" + name + ".rtf";
object oPath = sPath;
object oMissing = System.Reflection.Missing.Value;
oDoc.Content.Text = sPath;
object oSaveFormat = Microsoft.Office.Interop.Word.WdSaveFormat.wdForma tRTF;
object oOpenFormat =
Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenF ormatWebPages;
oDoc.SaveAs (
ref oPath, ref oSaveFormat, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing
);
oDoc.Close(ref oMissing, ref oMissing, ref oMissing);
oDoc = null;