Skip to main content

import-data

PRO

The functionality is available in PRO Edition only

Description​

Triggers import of MS Project XML data to Gantt

You need to handle file upload, read file contents as text and send the resulting string to the action

Usage​

"import-data": ({
data: string,
}) => void;

Parameters​

  • string - (required) XML string from the uploaded XML file

Example​

<script setup>
import { Gantt } from "@svar/vue-gantt";
import { ref } from "vue";

const api = ref();

function importMSProject() {
// your uploader control
const file = document.getElementById("import-file").files[0];
const reader = new FileReader();
reader.onload = e => {
const xml = e.target.result;
api.value.exec("import-data", {
data: xml,
});
};
reader.readAsText(file);
}
</script>

<template>
<Gantt ref="api"/>
</template>

Related articles: