@@ -2324,6 +2324,78 @@ public void tableMinMaxWidthTest05() throws IOException, InterruptedException {
2324
2324
Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2325
2325
}
2326
2326
2327
+ @ Test
2328
+ public void cellsWithEdgeCaseLeadingTest01 () throws IOException , InterruptedException {
2329
+ String testName = "cellsWithEdgeCaseLeadingTest01.pdf" ;
2330
+ String outFileName = destinationFolder + testName ;
2331
+ String cmpFileName = sourceFolder + "cmp_" + testName ;
2332
+
2333
+ PdfWriter writer = new PdfWriter (outFileName );
2334
+ PdfDocument pdf = new PdfDocument (writer );
2335
+ Document document = new Document (pdf );
2336
+
2337
+ SolidBorder border = new SolidBorder (1f );
2338
+
2339
+ Table table = new Table (UnitValue .createPointArray (new float [] {20 , 20 , 20 , 20 }));
2340
+
2341
+ Paragraph paragraph5 = new Paragraph (new Text ("Cell5" ));
2342
+ Paragraph paragraph6 = new Paragraph (new Text ("Cell6" ));
2343
+ Paragraph paragraph7 = new Paragraph (new Text ("Cell7" ));
2344
+ Paragraph paragraph8 = new Paragraph (new Text ("Cell8" ));
2345
+
2346
+ Paragraph paragraph13 = new Paragraph ("Cell13" );
2347
+ Paragraph paragraph14 = new Paragraph (new Text ("" ));
2348
+ Paragraph paragraph15 = new Paragraph (new Text ("Cell15VVVVVVVVV" ));
2349
+ Paragraph paragraph16 = new Paragraph (new Text ("" ));
2350
+
2351
+ Cell cell1 = new Cell ().add (new Paragraph ().add ("Cell1" )).setBorder (border );
2352
+ Cell cell2 = new Cell ().add (new Paragraph ().add ("Cell2" )).setBorder (border );
2353
+ Cell cell3 = new Cell ().add (new Paragraph ().add ("Cell3" )).setBorder (border );
2354
+ Cell cell4 = new Cell ().add (new Paragraph ().add ("Cell4" )).setBorder (border );
2355
+ Cell cell5 = new Cell ().add (paragraph5 .setFixedLeading (8 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2356
+ Cell cell6 = new Cell ().add (paragraph6 .setFixedLeading (0 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2357
+ Cell cell7 = new Cell ().add (paragraph7 .setFixedLeading (8 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2358
+ Cell cell8 = new Cell ().add (paragraph8 .setFixedLeading (-4 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2359
+ Cell cell9 = new Cell ().add (new Paragraph ().add ("Cell9" )).setBorder (border );
2360
+ Cell cell10 = new Cell ().add (new Paragraph ().add ("Cell10" )).setBorder (border );
2361
+ Cell cell11 = new Cell ().add (new Paragraph ().add ("Cell11" )).setBorder (border );
2362
+ Cell cell12 = new Cell ().add (new Paragraph ().add ("Cell12" )).setBorder (border );
2363
+ Cell cell13 = new Cell ().add (paragraph13 .setMultipliedLeading (-1 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2364
+ Cell cell14 = new Cell ().add (paragraph14 .setMultipliedLeading (4 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2365
+ Cell cell15 = new Cell ().add (paragraph15 .setMultipliedLeading (8 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2366
+ Cell cell16 = new Cell ().add (paragraph16 .setMultipliedLeading (-4 )).setBorder (border ).setBackgroundColor (ColorConstants .LIGHT_GRAY );
2367
+ Cell cell17 = new Cell ().add (new Paragraph ().add ("Cell17" )).setBorder (border );
2368
+ Cell cell18 = new Cell ().add (new Paragraph ().add ("Cell18" )).setBorder (border );
2369
+ Cell cell19 = new Cell ().add (new Paragraph ().add ("Cell19" )).setBorder (border );
2370
+ Cell cell20 = new Cell ().add (new Paragraph ().add ("Cell20" )).setBorder (border );
2371
+
2372
+ table .addCell (cell1 );
2373
+ table .addCell (cell2 );
2374
+ table .addCell (cell3 );
2375
+ table .addCell (cell4 );
2376
+ table .addCell (cell5 );
2377
+ table .addCell (cell6 );
2378
+ table .addCell (cell7 );
2379
+ table .addCell (cell8 );
2380
+ table .addCell (cell9 );
2381
+ table .addCell (cell10 );
2382
+ table .addCell (cell11 );
2383
+ table .addCell (cell12 );
2384
+ table .addCell (cell13 );
2385
+ table .addCell (cell14 );
2386
+ table .addCell (cell15 );
2387
+ table .addCell (cell16 );
2388
+ table .addCell (cell17 );
2389
+ table .addCell (cell18 );
2390
+ table .addCell (cell19 );
2391
+ table .addCell (cell20 );
2392
+
2393
+ document .add (table );
2394
+ document .close ();
2395
+
2396
+ Assert .assertNull (new CompareTool ().compareByContent (outFileName , cmpFileName , destinationFolder , testName + "_diff" ));
2397
+ }
2398
+
2327
2399
static class CustomRenderer extends TableRenderer {
2328
2400
public CustomRenderer (Table modelElement , Table .RowRange rowRange ) {
2329
2401
super (modelElement , rowRange );
0 commit comments