title: Can I use the Microsoft.Office.Interop.Word .dll in Silverlight to manipulate the SaveDialogFile of MSWord?
body: <p>I have problem in making silverlight application, I need to <strong>create a Word Document</strong> using silverlight and the <strong>Save it directly to the database using the Default Save button in MSWord</strong>, but then I cannot use the <strong>"Microsoft.Office.Interop.Word .dll"</strong> in silverlight to manipulate the SaveFileDialog so that I can set the Default path when saving..</p>
  
  <p>Another question is, <strong>can I hide or set the MSWord SaveFileDialog = false in Silverlight using Microsoft.Office.Interop.Word .dll?</strong> because my other plan is that to create a custom savefiledialog box in Silverlight and not to use the MSWord SaveFileDialog box..? </p>
  
  <p>I use the Silverlight 5 Beta, is there any compatibility issue in using other version of MS Office.?</p>
  
  <pre><code> public partial class MainPage : UserControl
   {
       dynamic objWord;
       dynamic document;
       dynamic range;
       static bool saveDoc = false;
  
       public MainPage()
       {
           InitializeComponent();
           objWord = AutomationFactory.CreateObject("Word.Application"); 
           AutomationEvent saveEvent = AutomationFactory.GetEvent(objWord, "DocumentBeforeSave");
           saveEvent.EventRaised += (s, args) =&gt;
           {
               saveDoc = true;
  
               if (saveDoc == true)
               {
                   SaveFileDialog dlg = new SaveFileDialog();
                   dlg.DefaultExt = ".doc"; // Default file extension
                   dlg.Filter = "Word documents (.doc)|*.doc"; // Filter files by extension
                   Nullable&lt;bool&gt; result = dlg.ShowDialog();
  
                   if (result == true)
                   {
                       string filename = dlg.SafeFileName;
                       FileInfo aD = new FileInfo(filename);
                       string pathDoc = aD.DirectoryName.ToString();
                       MessageBox.Show(pathDoc); //trying to get the path so that i can flush it to memory stream
                   }
               }
           };
       }
  
       private void Button_Click(object sender, RoutedEventArgs e)
       {
           if (AutomationFactory.IsAvailable)
           {
               try
               {
                   document = objWord.Documents.Add();
                   object startIndex = 0;
                   range = document.Range(ref startIndex);
                   objWord.Visible = true;
               }
               catch (Exception ex)
               {
                   MessageBox.Show(ex.Message);
               }
           }
       }
  }
  </code></pre>
  
  <p>Thanks in Advance :) God Bless</p>