本文へ移動

@eightkk/vue-weave / core / toMsProjectXml

Function: toMsProjectXml() ​

toMsProjectXml(project, options?): string

Defined in: src/core/interchangeMsProject.ts:374

Build a Microsoft Project XML (MSPDI) document that Microsoft Project and compatible tools can open. Each task becomes a manually scheduled task (so its dates are kept as given) with a UID and ID from 1 in input order, its name, start, finish, elapsed duration, outline level and number, milestone and summary flags and percent complete. Dependencies become PredecessorLink elements with the MSPDI link type (FF 0, FS 1, SF 2, SS 3) and the lag in tenths of a minute as elapsed minutes. Dates are wall-clock times at utcOffsetMinutes without an offset suffix. Start and finish are rounded to the nearest whole second, and the duration is the difference of the rounded times.

Task baselines become Baseline elements (after the predecessor links) with their number, start, finish and elapsed duration, rounded like the task dates.

A task with exactly one constraint in constraints gets ConstraintType (2 Must Start On for fixedStart, 4 to 7 for start no earlier, start no later, finish no earlier and finish no later than) and ConstraintDate, rounded like the task dates. A task can hold only one constraint in Microsoft Project, so a task with several gets none, except one whose constraints are exactly finishNoEarlierThan and finishNoLaterThan at the same time: it gets 3 (Must Finish On) with that time.

A task with inactive: true is written with Active 0, and one with manual: false as automatically scheduled (Manual 0); without them every task is active and manually scheduled.

Optional calendars, resources and assignments are written as Calendars, Resources and Assignments with UIDs from 1 in input order. Every calendar is written as a base calendar with its complete weekly pattern (DayType 1 to 7, Sunday first) and each exception date as a DayType 0 entry with a TimePeriod. defaultCalendarId and a task's calendarId become CalendarUID. A resource gets Type (0 material, 1 work; a cost resource 0 with IsCostResource 1), MaxUnits (when set) and CalendarUID, an assignment Units (default 1). These elements follow the MSPDI schema order but have not been opened in Microsoft Project itself.

Not exported: a second constraint of a task (other than the Must Finish On pair), notes, custom fields, baseline work or cost and the base-calendar inheritance and time zone of a calendar. Task, calendar and resource IDs of the input are not written; the UIDs follow the input order.

Throws an Error for empty or duplicate task IDs, a missing project or task name, unknown dependency ends, a dependency from a task to itself, unknown link types, a duplicate baseline number on a task and inactive or manual flags that are not booleans, and a RangeError for non-finite or unordered dates (also of baselines), an invalid outline level, percent complete, lag, baseline number or constraint time. Calendars, resources and assignments throw an Error for empty or duplicate IDs, missing names, unknown references and duplicate assignments, and a RangeError for invalid shifts, exception dates, maxUnits or units.

Parameters ​

project ​

MsProjectInput

options? ​

MsProjectXmlOptions = {}

Returns ​

string

MIT ライセンスで公開しています。