问题描述
我可以使用Java为Apache POI库生成Excel的表单控件吗?如果这是不可能的,有什么可选择的?
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?
我真的需要这样才能完成我的作品。
I really need this to accomplish my works.
提前谢谢
推荐答案
对于Excel 2007或更高版本,由于Apache POI在OpenXML上运行,您需要使用VML绘图。生成表单控件的最快路径是手动执行,然后打开创建的xlsx或xlam作为zip存档,并查看 /xl/drawings/vmldrawing.vml
部分。然后阅读中的VML绘图了解创建VML图纸的基础知识。该方法是通过编程方式将 vmldrawing.vml
部分作为常规XML容器创建,并将其从适当的Apache POI API支持的内存对象序列化的XML代码填充。
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.
这篇关于如何使用Apache POI(Java)在Excel中创建表单控件(收音机,复选框,按钮等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!