Excel 的导出和导入
dhtmlxGantt 库允许将甘特图数据导出为 Excel 格式。你也可以从 Excel 文件将数据导入到甘特图中。如需导出为 iCal 格式,请参阅导出为 iCal。
注释
在线导出服务是免费的。有关许可条款,请参阅许可证和水印。
有多种导出服务可用。你可以在本地计算机上安装它们,并将甘特图导出为 Excel。本地导出服务并不包含在 Gantt 包中,请阅读 相应文章 以了解每种服务的使用条款。
在线导出服务的限制
注释
在线导出服务对时间和请求大小有限制。请参阅在线导出服务的限制。
使用导出模块
要导出较大的图表、在不受在线导出服务限制的情况下导出,或将数据保留在你的网络内,请在自己的服务器上安装导出模块。有关用于 PDF、PNG 、Excel 和 iCal 的导出模块的用法,请阅读相应文章。
导出到 Excel
要将甘特图的数据导出到 Excel 文档,请执行以下操作:
- 要使用导出/导入功能,请通过 plugins 方法启用 export_api 插件:
gantt.plugins({
export_api: true
});
它允许你使用在线导出服务或本地导出模块。
注释
如果你使用的 Gantt 版本低于 8.0,需要在页面中包含 https://export.dhtmlx.com/gantt/api.js 以启用导出功能,例如:
<script src="codebase/dhtmlxgantt.js"></script>
<script src="https://export.dhtmlx.com/gantt/api.js"></script>
- 调用 exportToExcel 方法以从 Gantt 图导出数据到 Excel:
<input value="Export to Excel" type="button" onclick='gantt.exportToExcel()'/>
<script>
gantt.init("gantt_here");
gantt.parse(demo_tasks);
</script>
相关示例: Export data : MS Project, PrimaveraP6, Excel & iCal
相关示例: Export data: store online