Я хочу создать таблицу с двумя разными массивами с разным измерением, но после ее выполнения я не получу правильный вывод.
У меня есть код ниже:
String rowHeadingkeys[] = new String[] {"heading1","heading2","heading3","heading4","heading5","heading6","heading7","heading8"};
String rowValuekeys[] = new String[] {"Text1","Text2","Text3","Text4","Text5",
"Text6","Text7","Text8","Text9","Text10",
"Text11","Text12","Text13","Text14","Text15",
"Text16","Text17","Text18","Text19","Text20",
"Text21","Text22","Text23","Text24"};
for(int i = 0;i<rowHeadingkeys.length;i++) {
if(rowHeadingkeys!=null) {
patientMonitoringTable.addCell(createCell(rowHeadingkeys[i],
PDFUtil.BOLD_FONT,1,Element.ALIGN_LEFT));
for(int j = 0;j<rowValuekeys.length/rowHeadingkeys.length;j++) {
patientMonitoringTable.addCell(createCell(svo.getFields().get(rowValuekeys[j]).getValue(),
PDFUtil.FONT,1,Element.ALIGN_LEFT));
}
}
}
и я хочу сделать это как показано ниже:
| heading1 | Text1 | Text2 | Text3 |
| heading2 | Text4 | Text5 | Text6 |
| heading3 | Text7 | Text8 | Text9 |
| heading4 | Text10 | Text12 | Text13 |
| heading5 | Text14 | Text15 | Text16 |
| heading6 | Text17 | Text18 | Text19 |
| heading7 | Text20 | Text21 | Text22 |
| heading8 | Text23 | Text24 | Text24 |
Как этого добиться?