How to print multiple header lines with MessageFormat using a JTable

后端 未结 5 1935
故里飘歌
故里飘歌 2020-12-06 03:32

I have a table called table and its filled with data, I also have a MessageFormat header I want to use as a header to print the JTable

5条回答
  •  攒了一身酷
    2020-12-06 03:36

    If you use the getPrintable method instead without adding a header/footer text, you can then include/decorate the returned Printable in one where you have more control over the header, and where you can specify multi-line headers. See the javadoc of that method which mentions

    It is entirely valid for this Printable to be wrapped inside another in order to create complex reports and documents. You may even request that different pages be rendered into different sized printable areas. The implementation must be prepared to handle this (possibly by doing its layout calculations on the fly). However, providing different heights to each page will likely not work well with PrintMode.NORMAL when it has to spread columns across pages.

    I have not enough experience with Printables to help you further on how to actually do this

提交回复
热议问题