如何使用Apache POI(Java)在Excel中创建表单控件(单选按钮,复选框,按钮等)?

时间:2023-02-05 20:28:09

Is it possible for me to produce form controls for Excel with Apache POI library using Java? If this is not possible, what are the alternative?

我是否可以使用Java为Apache POI库生成Excel的表单控件?如果不可能,有什么替代方案?

I really need this to accomplish my works.

我真的需要这个来完成我的作品。

Thank in advance.

预先感谢。

1 个解决方案

#1


0  

For Excel 2007 or above, because Apache POI operates on OpenXML, you need to use VML Drawing. The fastest path to produce form controls is to do that manually, then open created xlsx or xlam as a zip archive and look at the /xl/drawings/vmldrawing.vml part. Then read about VML Drawing in OpenXML standard (ECMA-376) for basics on creating VML drawings. The approach is to create vmldrawing.vml part programmatically as regular XML container and fill it with XML code serialized from memory objects supported by Apache POI API appropriately.

对于Excel 2007或更高版本,由于Apache POI在OpenXML上运行,因此您需要使用VML绘图。生成表单控件的最快路径是手动执行,然后打开创建的xlsx或xlam作为zip存档,并查看/xl/drawings/vmldrawing.vml部分。然后阅读OpenXML标准(ECMA-376)中的VML绘图,了解有关创建VML绘图的基础知识。方法是以编程方式将vmldrawing.vml部件创建为常规XML容器,并使用从Apache POI API支持的内存对象序列化的XML代码进行适当填充。

#1


0  

For Excel 2007 or above, because Apache POI operates on OpenXML, you need to use VML Drawing. The fastest path to produce form controls is to do that manually, then open created xlsx or xlam as a zip archive and look at the /xl/drawings/vmldrawing.vml part. Then read about VML Drawing in OpenXML standard (ECMA-376) for basics on creating VML drawings. The approach is to create vmldrawing.vml part programmatically as regular XML container and fill it with XML code serialized from memory objects supported by Apache POI API appropriately.

对于Excel 2007或更高版本,由于Apache POI在OpenXML上运行,因此您需要使用VML绘图。生成表单控件的最快路径是手动执行,然后打开创建的xlsx或xlam作为zip存档,并查看/xl/drawings/vmldrawing.vml部分。然后阅读OpenXML标准(ECMA-376)中的VML绘图,了解有关创建VML绘图的基础知识。方法是以编程方式将vmldrawing.vml部件创建为常规XML容器,并使用从Apache POI API支持的内存对象序列化的XML代码进行适当填充。