部署后Excel& ppt女士无法正常工作 [英] Ms Excel&ppt not working after deployment

查看:89
本文介绍了部署后Excel& ppt女士无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在研究几乎要达到极限的项目(使用C#语言).
我已经使用Microsoft Excel和Microsoft Power Point作为实用程序.
它在我的应用程序中可以正常运行,但是在部署项目后无法正常工作.

以下是相同的代码.
请帮帮我.

CODE

Hi I am working on a projec that is almost to an edge (its in C# language).
I have used microsoft Excel and Microsoft Power Point as an utility.
it works perfectly in my application but after deploying the project it was not working.

following is the code for the same.
please help me.

CODE

try
{
    //p = new Process();
    //p.StartInfo.FileName = "winword";
    //p.Start();


    System.Diagnostics.Process myProces = new System.Diagnostics.Process();
    myProces.StartInfo.FileName = "C:\\Program Files\\Microsoft Office\\Office12\\winword";
    myProces.Start();
    //myProces.Kill();
}
catch (Exception ex)
{
    Response.Write("<script>alert('Microsoft Word is not installed.');</script>");
}

推荐答案

最明显的问题:

您已将应用程序部署到要安装Office的计算机上吗?如果是这样,它是否已安装在您期望的位置?硬编码这样的位置是一个不好的举动,因为您不能保证安装目录是相同的...


"谢谢您的答复.
我刚刚给出了MS Excel& Ppt.so的默认路径,所以如果有其他方法请给我指导.如果可能,请给我相同的代码.
是的,我知道在某些情况下默认目录会有所不同,但是我不知道如何使用其他方法.
请帮助我."


根本不给路径!如果已安装,则Windows应该知道它在哪里:
The most obvious question:

Has the computer you deployed you application to got Office installed? If so, is it installed in the place you are expecting? Hardcoding locations like that is a bad move, since you cannot guarantee that the installation directory is the same...


"thank you for the reply.
i have just given the default path of MS Excel&Ppt.so plz guide me if there is some other way .if possible plz give the code for the same.
yes i know that there would a case were the default directory would be different in some cases but i dont know how to go the other way.
please help me."


Don''t give a path at all! If it is installed, Windows should know where it is:
ProcessStartInfo runMe = new ProcessStartInfo();
runMe.FileName = "WINWORD.EXE";
//runMe.Arguments = "myArguments";
Process.Start(runMe);

尝试一下:您将明白我的意思...:笑:

[edit]糟糕-今天我什至无法拼写"arguments" ...-OriginalGriff [/edit]

Try it: you will see what I mean...:laugh:

[edit]Oops - I can''t even spell "arguments" today... - OriginalGriff[/edit]


根据系统的不同,您可以找到安装位置,例如32位环境来自:
Depending on the system you can find the install location for example in 32 bit environment from:
HKLM\SOFTWARE\Microsoft\Office\14.0\Word\InstallRoot\Path


和64位


and 64 bit

HKLM\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Word\InstallRoot\Path


该路径取决于版本,因此请使用正确的版本号.


The path is version dependent so use the correct version number.


这篇关于部署后Excel&amp; ppt女士无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆