java mpxj mpxwriter_Mpp 的一种 java 读写解决方案

本文介绍了如何利用Java库Mpxj读取MPP文件,然后通过Jacob库结合ActiveXComponent将MXP文件转换为MPP。由于MPXJ不支持直接写入MPP,作者提供了转换过程,涉及jni、Jawin、自定义JNI封装和Jacob的ActiveXComponent。转换依赖于系统中安装的Microsoft Project 2003。
摘要由CSDN通过智能技术生成

Mpp 的导入导出

可以选用现成的 Mpxj 已有丰富的APi可用了,但是唯一不足的是MPXJ只能读mpp文件,写不支持但是支持写mpx文件

只要不能写mpp的原因在这里

31617e6f1f18c516d54dea8ca26df54e.png

Can I use MPXJ to write MPP files?

Not at present. Although it is technically feasible to generate an MPP file, the knowledge we have of the file structure is still relatively incomplete, despite the amount of data we are able to correctly extract. It is therefore likely to take a considerable amount of development effort to make this work, and it is conceivable that we will not be able to write the full set of attributes that MPXJ supports back into the MPP file - simply because we don't understand the format well enough. You are therefore probably better off using MSPDI which does support the full range of data items present in an MPP file.

43913d000ed615c4c6e501ab3263b1c3.png

ex:

File in = new File(m_basedir + "/sample.mpx");

ProjectFile mpx = new MPXReader().read(in);

out = File.createTempFile("junit", ".mpx");

MPXWriter writer = new MPXWriter();

writer.setUseLocaleDefaults(false);

writer.write(mpx, out);

实际上这里的ProjectFile 的成功读取MPP文件接下来 通过它你就可以得心应手的获取该Mpp文件的各种信息了

既然读比较方便下面重点说说写吧,毕竟这个才是大头,好多人搞不定的地方。

基本上是一个思路 jni 处理,但是虽是用jni 也有不同的选择的

1.  网上有人用 Jawin 的不可否认处理还算方便的 详细请参考 这里不做过多

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值