Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
959 views
in Technique[技术] by (71.8m points)

excel - How to call a Macro from Apache POI library in Java?

I have :

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

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

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

:: Note ::

  • I am using import org.apache.poi.ss.usermodel in Apache POI.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...