Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            //initialize remoting
            RemotingConfiguration.Configure("WordRemoteConverter.exe.config", false);
            RemotingConfiguration.RegisterWellKnownServiceType(new RemoteConverter().GetType(), "RemoteConverter", WellKnownObjectMode.Singleton);


            //check if word 2013 is available
            try
            {
                using (SingleWordApp wordapp = new SingleWordApp())
                {
                    if (wordapp.WordIsAvailable)
                    {
                        lbl_wordinstalled.ForeColor = Color.Green;
                        lbl_wordinstalled.Text      = "available";
                    }
                    else
                    {
                        lbl_wordinstalled.ForeColor = Color.Red;
                        lbl_wordinstalled.Text      = "not available";
                    }
                }
            }
            catch
            {
                lbl_wordinstalled.ForeColor = Color.Red;
                lbl_wordinstalled.Text      = "not available";
            }
        }
Exemple #2
0
 public bool WordIsAvailable()
 {
     if (!checkedword)
     {
         try
         {
             if (wordApp == null)
             {
                 using (SingleWordApp tempWordApp = new SingleWordApp())
                 {
                     wordavailable = tempWordApp.WordIsAvailable;
                 }
             }
             else
             {
                 wordavailable = wordApp.WordIsAvailable;
             }
         }
         catch
         {
             wordavailable = false;
         }
         checkedword = true;
     }
     return(wordavailable);
 }
Exemple #3
0
 public void Dispose()
 {
     if (wordApp != null && !wordApp.IsBusy)
     {
         wordApp.Dispose();
         wordApp = null;
     }
 }
Exemple #4
0
 public string Convert(string source, out Exception ex)
 {
     if (wordApp == null)
     {
         wordApp = new SingleWordApp(30);
     }
     if (wordApp != null && !wordApp.IsBusy)
     {
         return(wordApp.ConvertToPdf(source, 15, out ex));
     }
     ex = new Exception("WordApp is null or Word is busy");
     return(null);
 }