class TaskJuggler::MspXmlRE

This specialization of ReportBase implements an export of the project data into Microsoft Project XML format. Due to limitations of MS Project and this implementation, only a subset of core data is being exported. The exported data is already a scheduled project with full resource/task assignment data.

Public Class Methods

new(report) click to toggle source

Create a new object and set some default values.

Calls superclass method
# File lib/taskjuggler/reports/MspXmlRE.rb, line 25
def initialize(report)

  # This report type currently only supports a single scenario. Use the
  # first specified one.
  @scenarioIdx = a('scenarios').first

  # Hash to map calendar names to UIDs (numbers).
  @calendarUIDs = {}
  @timeformat = "%Y-%m-%dT%H:%M:%S"

Public Instance Methods

generateIntermediateFormat() click to toggle source
Calls superclass method
# File lib/taskjuggler/reports/MspXmlRE.rb, line 37
def generateIntermediateFormat
to_mspxml() click to toggle source

Return the project data in Microsoft Project XML format.

# File lib/taskjuggler/reports/MspXmlRE.rb, line 42
    def to_mspxml
      @query = @project.reportContexts.last.query.dup

      # Prepare the resource list.
      @resourceList =
      @resourceList = filterResourceList(@resourceList, nil, a('hideResource'),
                                         a('rollupResource'), a('openNodes'))

      # Prepare the task list.
      @taskList =
      # The MSP XML format requires that the tasks are listed in 'tree' order.
      # We purposely ignore the user provided sorting criteria.
      @taskList.setSorting([ [ 'tree', true, -1 ],
                             [ 'seqno', true, -1 ] ])
      @taskList = filterTaskList(@taskList, nil, a('hideTask'), a('rollupTask'),

      @file =
      @file <<'<?xml version="1.0" encoding="UTF-8" ' +
      @file <<<<"EOT"
Generated by #{AppConfig.softwareName} v#{AppConfig.version} on #{}
For more information about #{AppConfig.softwareName} see #{}.
Project: #{@project['name']}
Date:    #{@project['now']}
      @file << (project =
                               'xmlns' =>

      calendars = generateProjectAttributes(project)
      generateResources(project, calendars)