How to print a Workbook file made using Apache Poi

2019-03-02 18:54发布

问题:

I create one page workbook files in eclipse and need to open the print dialog box and print these files off. I understand how to open the print dialog box and everything, i just can't find how to tell the system that it is the workbook file "wb" that is what i'm wanting to print. So opening the dialog just doesn't work unless it knows what i'm trying to print with it. Could someone at least send me in the right direction Without telling me to read the java print dialog tutorials. I've read them three times now and i don't understand how to make my situation work :/ I'm not handling graphic objects, i'm handling workbook objects.

回答1:

Although there are some rumors around here that say it's not possible to do it directly, you might want to convert it first to PDF (1,2) and then print it.

I haven't tried pdfbox printing, if the results are disappointing, it might be possible to use libre office not only as a converter, but also as the printing engine ...