Adding a macro to an Excel spreadsheet with Java
I'm developping an app that creates an Excel spreadsheet. I'm using Java with docx4j library, but it does not have Macro support since it is not provided through Open XML API. I was just wondering if anyone knew of a workaround to add a macro to an existing Excel spreadsheet u开发者_运维百科sing Java (even with another library).
Thanks
If it's the same macro in all Workbooks you might be able to use a template? Meaning you have an empty workbook which contains the generalized makro and this will be copied for each "new" Workbook your need to create from Java.
I don't think you'll find anything java-based that will be able to do this for you. However I guess native MS technologies (.NET, c# etc) will be able to do this. Although (AFAIK) you can't actually execute c# in the JVM, you can make system calls from java to execute another program using Runtime.exec().
精彩评论