Word加载项正在开发PC而不是其他人

时间:2014-10-07 12:35:32

标签: c# ms-word office-addins

我创建了一个单词加载项,它正在开发我正在开发的PC,但是当我在其他人处尝试它时,它会失败。

加载项包含一个单词加载项部分,然后是一个windowsForm应用程序 单词加载项部分将当前word文档保存为htm文档,然后windows窗体部分与该文档一起使用。
当我在其他PC上安装加载项时,它一直工作到那一点。我可以单击按钮并保存文件,但之后它只是一个灰色屏幕并停止而不打开窗体。然后在我的电脑上打开Windows窗体,我可以使用该程序。

namespace WordHilfeUpdaterAddin
{
    public partial class Ribbon1
    {
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
        }
        private void button1_Click(object sender, RibbonControlEventArgs e)
        {
            ReaderWriter readwriter = new ReaderWriter();
            // deletes the folder if exists
            readwriter.Ordnerloschen(@"C:\temphilfeupdate");
            // creates temp folder
            readwriter.erstelleoernder(@"C:\temphilfeupdate");
            //saves the doc as filtered html document
            Globals.ThisAddIn.Application.ActiveDocument.SaveAs(@"C:\temphilfeupdate\Wordhtm",WdSaveFormat.wdFormatFilteredHTML);
            // security save
            Globals.ThisAddIn.Application.ActiveDocument.Save();
            // nessecary to get word of the file
            Globals.ThisAddIn.Application.ActiveDocument.Close();
            //starts the program
            MainClass main = new MainClass();
            main.start();
            //deletes the temp folder
            readwriter.Ordnerloschen(@"C:\temphilfeupdate");            
        }
    }
}

namespace HilfeUpdater
{
    class MainClass
    {
        [STAThread]        
        //starts the windows form
        public void start()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new HilfeUpdater());
        }
    }
}

0 个答案:

没有答案
相关问题