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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…