Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Table split in apache poi

I am facing an issue while generating the docx file using apache poi library. I have multiple tables of variable sizes to be included dynamically in the document.The issue is that table gets splited between the pages.My requirement is to prevent the table from splitting between the pages.In poi library i found the method table.getRow(0).setCantSplitRow(true); but does not changes anything.Any suggestions for how to implement this.Thanks in advance.

like image 757
Ravi Brahmbhatt Avatar asked Feb 28 '26 08:02

Ravi Brahmbhatt


1 Answers

Try using Table Row Function :

**setCantSplitRow(boolean split)

This attribute controls whether to allow table rows to split across pages.**

tableRow.setCantSplitRow(true);

like image 157
Rahul khanvani Avatar answered Mar 01 '26 22:03

Rahul khanvani