使用 Apache POI 创建 excel 图表 [英] Create excel chart using Apache POI

查看:52
本文介绍了使用 Apache POI 创建 excel 图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 Apache POI 库从包含条形图、折线图等图表的 Java 代码创建 Excel 表格.是否可以?我找不到任何有用的代码示例.

I need to create excel sheet from my Java code which contains charts like Bar chart, Line Chart etc using the Apache POI library. Is it possible? I am not able to find any useful code example for the same.

除了用于 Java 的 POI 库之外,还有其他选择吗?

Is there any other alternative for this apart from POI library for Java?

推荐答案

您只能使用 Excel 模板来保存带有 POI 的图表.这意味着您创建一个带有图表的 Excel 模板文件并将图表的数据源链接到一个定义的名称,然后您可以从 POI 加载模板文件并使用代码更改定义的名称.当前 POI 不支持从头开始创建图表.

You can only use Excel template to preserve chart with POI. It mean you create an Excel template file with chart in it and link the chart's datasource to one definedName,then you can load the template file from POI and using code to change the definedName. Current POI does not support to create Chart from scratch.

这篇关于使用 Apache POI 创建 excel 图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆