C# 中的 MPXJ 库示例
连接到 Microsoft Project 文件时,我很难找到任何使用 MPXJ 库的 C# 代码示例。有人可以发布一段片段,演示如何将 .mpp 文件中的表格内容写入屏幕吗?
任何链接/参考的奖励积分!
谢谢!
~丹
I'm having a heckuva time finding any C# code examples using the MPXJ library when connecting to a Microsoft Project file. Can someone please post a snippet demonstrating how to write the contents of a table in an .mpp file to screen?
Bonus points for any links/references!
Thanks!
~Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望这会有所帮助。
首先,您需要打开项目文件:
这假设您在 inputFile 字符串中有一个文件名。
下面的方法应该被视为伪代码(即我还没有编译它,摆脱其中的错误等等,并且它不是我写过的最优雅的东西),但它说明了该方法:
这个想法是您正在检索文件中存在的表列表,并为每个表确定它是任务表还是资源表。在此基础上,您将获取任务或资源列表,对其进行迭代,并为每个实例提取列值并显示它。请注意,我没有尝试以任何特定方式订购任务或资源。我将把它作为练习留给读者!
希望有帮助!
乔恩
hopefully this will help.
First you need to open your project file:
This assumes that you have a file name in the inputFile string.
The method below should be treated as pseudocode (i.e. I haven't compiled it, shaken the bugs out of it and so on, and it's not the most elegant thing I've ever written), but it illustrates the approach:
The idea is that you are retrieving the list of tables present in the file, and for each one working out if it is a Task or Resource table. Based on this you'll grab the list of tasks or resources, iterate through that, and for each instance pull out the column value and display it. Note that I've not made any attempt to order the tasks or resources in any particular way. I'll leave that as an exercise for the reader!
Hope that helps!
Jon