如何从 Java 中的 Apache POI 库调用宏? [英] How to call a Macro from Apache POI library in Java?

查看:55
本文介绍了如何从 Java 中的 Apache POI 库调用宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:

  • 名为process"的宏它为我的工作表完成所有处理工作.

  • Macro named "process" that does all the processing work for my worksheets.

我希望使用 Apache POI 的 Java 代码调用此宏,以便它可以为我处理工作表.

I want my Java code that uses Apache POI, to call this macro so that it can process the sheets for me.

如何在 Java 中调用 Apache POI 中的宏?

How can I call a Macro in Apache POI in Java ?

:: 注意::

  • 我在 Apache POI 中使用 import org.apache.poi.ss.usermodel.

请给出示例代码.(我是 Apache POI 和 Java 本身的新手.)

Please, give sample code. (I am new to Apache POI and Java itself.)

推荐答案

我不认为这是可能的.POI 是一个用于读取/编辑 Office 文件的库,而宏则完全不同.您必须将 Visual Basic for Applications Interpreter 实施到 POI 中才能完成此操作.已在 Excel 工作簿中的宏会保留,但您无法添加新宏或调用现有宏.

I don't think this is possible. POI is a library to read/edit Office files, macros are a whole other beast. You would have to implement a Visual Basic for Applications Interpreter into POI to accomplish this. Macros that are already in your Excel workbook are preserved, but you cannot add new ones or call existing ones.

这篇关于如何从 Java 中的 Apache POI 库调用宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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