dhtmlxGantt库可以让您以Excel和iCal格式从甘特图中导出数据。您还可以将数据从 Excel文件导入甘特图。
1、导出到 Excel
要将甘特图中的数据导出到Excel文档,请执行以下操作:
- 在页面中包含“https://export.dhtmlx.com/gantt/api.js”文件以启用在线导出服务:
<script src="codebase/dhtmlxgantt.js"></script> <script src="https://export.dhtmlx.com/gantt/api.js"></script> <link rel="stylesheet" href="codebase/dhtmlxgantt.css" type="text/css">
- 调用exportToExcel方法从甘特图中导出数据:
<input value="Export to Excel" type="button" onclick='gantt.exportToExcel()'>
<script>
gantt.init("gantt_here");
gantt.parse(demo_tasks);
</script>
使用可选属性调用导出方法
gantt.exportToExcel({
name:"document.xlsx",
columns:[
{ id:"text", header:"Title", width:150 },
{ id:"start_date", header:"Start date", width:250, type:"date" }
],
server:"https://myapp.com/m

本文介绍了如何使用dhtmlxGantt库将甘特图数据导出到Excel和iCal格式,并详细阐述了导出过程,包括设置自定义模板、添加任务颜色等。同时,文章还讲解了从Excel导入数据的步骤,强调了导入服务返回的JSON数据结构及工作表处理。最后,提到了exportToICal方法用于导出到iCal格式。
最低0.47元/天 解锁文章
6651

被折叠的 条评论
为什么被折叠?



