gpt4 book ai didi

c# - ShellEx : Starting Excel minimized or hidden

转载 作者:行者123 更新时间:2023-12-02 15:50:46 25 4
gpt4 key购买 nike

使用以下代码,我可以在 C# 中运行 Excel:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "cmd.exe";
p.Start();

我可以使用任何命令行参数使 Excel 启动隐藏或最小化吗?

(编辑:尝试了p.StartInfo.WindowStyle,但没有效果。)

我需要在不使用 COM 的情况下启动 Excel,因为通过 COM 启动 Excel 时,none of the XLA add-ins are loaded .

最佳答案

您可以设置 WindowStyle属性设置为最小化隐藏。就像下面这样:

ProcessStartInfo p = new ProcessStartInfo("excel.exe");
p.WindowStyle = ProcessWindowStyle.Minimized;
Process.Start(p);

关于c# - ShellEx : Starting Excel minimized or hidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3719579/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com