In your case, we suggest you please use Table.autoFit method as shown below to get the desired output. We have attached the output DOCX with this post for your kind reference. output.docx (7.4 KB)
Code to Resize Table Cells in Word
private static void CreateTable(DocumentBuilder builder) throws Exception {
Table table = builder.startTable();
insertRow(builder);
insertMergeRow("Test1", builder);
for (int i = 0; i < 3; i++){
insertRow(builder);
}
insertMergeRow("II. Test2", builder);
for (int i = 0; i < 3; i++) {
insertRow(builder);
}
insertMergeRow("III. Test3", builder);
for (int i = 0; i < 3; i++){
insertRow(builder);
}
builder.endTable();
table.autoFit(AutoFitBehavior.AUTO_FIT_TO_WINDOW);
}