Mpp 的导入导出
可以选用现成的 Mpxj 已有丰富的APi可用了,但是唯一不足的是MPXJ只能读mpp文件,写不支持但是支持写mpx文件
只要不能写mpp的原因在这里
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.
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 的不可否认处理还算方便的 详细请参考 这里不做过多