MS-Project 文件堆积在任务栏上
目前我有一个程序,它将包含 .MPP 文件(Microsoft Project 文件)的文件夹作为输入,重新格式化信息并将每个转换后的文件拆分到一个新文件夹中(由用户选择)。
问题在于,应用程序处理的每个文件都会从任务栏中看到并累积。因此,如果目录中有 N 个文件,就会打开 N 个项目文件。有人知道如何隐藏这些任务吗?本来我以为visible属性默认设置为true,但是显式设置为false后我仍然遇到问题。
projectApp.Visible = false;
这是我的应用程序的伪代码
For each File in Folder
Open File
Format File
Save As File
End for each
Quit application
这是我传递的打开和保存参数(如果有帮助的话) 打开:
projectApp.FileOpen(txtBrowse.Text + @"\" + file.Name, false, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, PjPoolOpen.pjDoNotOpenPool, missingValue, missingValue, true, missingValue);
正在保存:
projectApp.FileSaveAs(txtSave.Text + @"\" + file.Name, PjFileFormat.pjMPP, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue);
且missingValue 为Type.Missing
请随时索取任何其他信息,感谢您的帮助!
PS我正在使用 Microsoft.Office.Interop.MSProject 参考
Currently I have a program that takes as input a folder that contains .MPP file (Microsoft Project files), reformats the information and splits out the each convertered file into a new folder (Selected by the user).
The problem is that with each file that it processes the application is seen from the task bar and accumulates. So if I had N files in the directory there will be N project files opened. Anyone know how to keep these tasks hidden? Originally I thought the visible property was set to true by default, but after explicitly setting it to false I still get the problem.
projectApp.Visible = false;
Here is the pseudocode for my application
For each File in Folder
Open File
Format File
Save As File
End for each
Quit application
Here are the open and save parameters I have passed (If that helps at all)
Open:
projectApp.FileOpen(txtBrowse.Text + @"\" + file.Name, false, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, PjPoolOpen.pjDoNotOpenPool, missingValue, missingValue, true, missingValue);
Saving:
projectApp.FileSaveAs(txtSave.Text + @"\" + file.Name, PjFileFormat.pjMPP, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue, missingValue);
and missingValue is Type.Missing
Feel free to request any additional information and thanks for the help!
P.S I'm using the Microsoft.Office.Interop.MSProject reference
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对该界面不太熟悉,但似乎您想要在 FileSaveAs 之后执行 FileClose 作为循环的最后一行。
I'm not fluent with that interface, but it seems like you'd want to do a FileClose as the last line of the loop, right after the FileSaveAs.
我和你有同样的问题。最初,我无法保存文件。但是在另一个目录中再次测试代码后,它起作用了,但它没有像您的那样关闭项目文件。正如另一个人提到的,解决方案非常简单。您忘记关闭文件。使用以下行关闭文件:
I had the same problem as you. Initially, I couldn't save the file. But after testing the code out again in another directory, it worked, but it didn't close the project file like yours. The solution is quite easy as mentioned by the other guy. You forgot to close the file. Close the file with the following line: