Skip to content

Commit da09dca

Browse files
committed
Style.java
Style.java
1 parent 47762be commit da09dca

File tree

1 file changed

+63
-0
lines changed
  • itext-java-pdf-table/src/main/java/com/hmkcode

1 file changed

+63
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package com.hmkcode;
2+
3+
import com.itextpdf.text.BaseColor;
4+
import com.itextpdf.text.Element;
5+
import com.itextpdf.text.pdf.PdfPCell;
6+
7+
public class Style {
8+
9+
public static void headerCellStyle(PdfPCell cell){
10+
11+
// alignment
12+
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
13+
14+
// padding
15+
cell.setPaddingTop(0f);
16+
cell.setPaddingBottom(7f);
17+
18+
// background color
19+
cell.setBackgroundColor(new BaseColor(0,121,182));
20+
21+
// border
22+
cell.setBorder(0);
23+
cell.setBorderWidthBottom(2f);
24+
25+
}
26+
public static void labelCellStyle(PdfPCell cell){
27+
// alignment
28+
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
29+
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
30+
31+
// padding
32+
cell.setPaddingLeft(3f);
33+
cell.setPaddingTop(0f);
34+
35+
// background color
36+
cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
37+
38+
// border
39+
cell.setBorder(0);
40+
cell.setBorderWidthBottom(1);
41+
cell.setBorderColorBottom(BaseColor.GRAY);
42+
43+
// height
44+
cell.setMinimumHeight(18f);
45+
}
46+
47+
public static void valueCellStyle(PdfPCell cell){
48+
// alignment
49+
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
50+
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
51+
52+
// padding
53+
cell.setPaddingTop(0f);
54+
cell.setPaddingBottom(5f);
55+
56+
// border
57+
cell.setBorder(0);
58+
cell.setBorderWidthBottom(0.5f);
59+
60+
// height
61+
cell.setMinimumHeight(18f);
62+
}
63+
}

0 commit comments

Comments
 (0)