问题描述
当用户将 Microsoft 项目文件上传到我已经创建的 Web 应用程序时,我需要找到一种方法来自动化该过程.该过程基本上需要使用从项目另存为保存到 .csv 文件,以便我可以使用它来将数据导入 SQL 数据库(这是我们已经使用 SQL 设置的自定义报告所需要的).我需要自动化这个过程,因为我会收到大量的项目文件,如果这个过程是自动化的,那么用户将能够立即看到结果.
I need to find a way to automate the process when a user uploads a microsoft project file to a web application I already have created. The process will need to basically use the save as from project to save into a .csv file so I can use this to import the data to an SQL database (this is needed for custom reporting we already have set up using SQL). I need to automate this process because I will be receiving tons of project files, and if the process is automated the users will then be able to instantly see results.
基本上,有什么方法可以创建或运行将这些项目文件另存为 .csv 文件的自动化流程?即使 csv 文件格式不正确,我也可以找到解决方法,只需要先将它们放入 .csv 文件中即可.
Basically, is there any way to create or run an automated process that will save these project files as .csv files? Even if the csv files are not formatted correctly, I can find a way around that, just need to first get them into .csv files.
谢谢.
编辑 - 我能想到的唯一方法是按照下面列出的说明进行操作,但是然后我需要自动化一个过程来打开文件并点击保存,这样就可以了……还有其他建议吗?
edit - the only way i could think of this is to follow the instructions listed below, butI would then need to automate a process to open the file and hit save so this works... any other suggestions?
编辑 2 - 也在寻找使用 Microsoft.Office.Interop.MSProject 的方法,但没有找到任何运气.
edit 2 - also looking into ways using Microsoft.Office.Interop.MSProject but not finding any luck.
现在使用 mpxj 编辑 3 0 - 我遇到的唯一问题是下面列出的.将他们的例子转换为 vb.
edit 3 0 now using mpxj - the only issue I am having is the following listed below. Converting their example to vb.
Private Shared Function ToEnumerable(ByVal javaCollection As Collection) As EnumerableCollection
Return New EnumerableCollection(javaCollection)
End Function
错误出在 EnumberableCollection - Visual Studio 没有将其作为有效类型 - 我做错了什么还是应该替换?
the error is with EnumberableCollection - visual studio is not picking it up as a valid type - anything I am doing wrong or should substitute?
推荐答案
如果您不习惯使用 MS Project 本身从项目文件中提取数据,您可以考虑使用 MPXJ 库.这将允许您编写一个简单的实用程序来打开您提供的 MPP 文件,提取您感兴趣的数据项,并将它们直接写入您的数据库(或中间 CSV 文件,根据需要).MPXJ 有 Java 和 .Net 两种版本,因此您可以使用您喜欢的语言来完成这项工作.
If you aren't wedded to using MS Project itself to extract data from the project files, you could consider using the MPXJ library. This would allow you to write a simple utility to open the MPP files you are given, extract the data items you are interested in, and write them directly to your database (or an intermediate CSV file, as required). MPXJ comes in Java and .Net flavours, so you can use your preferred language to do the work.
乔恩
附言免责声明:我维护 MPXJ
p.s. Disclaimer: I maintain MPXJ
这篇关于有什么方法可以自动化打开 .mpp 文件并将其另存为 .csv 的过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!