ATMLUtilitiesLibrary.UTRSOfficeUtils.ProcessWordDocument C# (CSharp) Method

ProcessWordDocument() private static method

private static ProcessWordDocument ( string fullFileName ) : Uri
fullFileName string
return System.Uri
        private static Uri ProcessWordDocument( string fullFileName )
        {
            object oTempFile = string.Format( "{0}\\{1}.html",
                                              Environment.GetFolderPath( Environment.SpecialFolder.InternetCache ),
                                              Guid.NewGuid() );
            object oFile = fullFileName;
            object oMissing = Missing.Value;
            object oReadOnly = true;
            object oFileType = WdSaveFormat.wdFormatHTML;
            CultureInfo saveCulture = Thread.CurrentThread.CurrentCulture;
            Application application = null;
            try
            {
                Thread.CurrentThread.CurrentCulture = new CultureInfo( "en-US" );
                application = new Application();
                Document document = application.Documents.Open( ref oFile, ref oMissing, ref oReadOnly, 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 );
                if (document != null)
                {
                    document.SaveAs( ref oTempFile, oFileType, 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 );
                }
            }
            finally
            {
                if (application != null)
                    application.Quit();
                Thread.CurrentThread.CurrentCulture = saveCulture;
            }
            return new Uri( oTempFile.ToString() );
        }