使用ruby mpxj读取ASTA /电源项目文件时出现以下错误

/var/lib/gems/2.3.0/gems/mpxj-5.2.2/lib/mpxj/reader.rb:24:in `read': Failed to read file: Reading input file started. (RuntimeError)
java.lang.UnsupportedOperationException
        at net.sf.mpxj.asta.AstaFileReader.readDatabaseFile(AstaFileReader.java:126)
        at net.sf.mpxj.asta.AstaFileReader.read(AstaFileReader.java:74)
        at net.sf.mpxj.reader.AbstractProjectReader.read(AbstractProjectReader.java:49)
        at net.sf.mpxj.sample.MpxjConvert.process(MpxjConvert.java:81)
        at net.sf.mpxj.sample.MpxjConvert.main(MpxjConvert.java:56)
        from test.rb:3:in `<main>'


红宝石文件如下所示:

require 'mpxj'

project = MPXJ::Reader.read("asta.pp")

puts "There are #{project.all_tasks.size} tasks in this project"
puts "There are #{project.all_resources.size} resources in this project"

puts "The resources are:"
project.all_resources.each do |resource|
  puts resource.name
end

puts "The tasks are:"
project.all_tasks.each do |task|
  puts "#{task.name}: starts on #{task.start}, finishes on #{task.finish}, it's duration is #{task.duration}"
end


不知道为什么会出现此错误,因为我能够在Asta Project Viewer中查看程序,因此文件一定不要损坏。

最佳答案

问题是MPXJ不支持最新的Powerproject文件格式。我希望在未来几周内增加该支持。如果您看不到任何进展,请直接给我发送邮件以提醒我!

09-25 18:47