Class PdfCell
java.lang.Object
cloud.opencode.base.pdf.content.PdfCell
PDF Table Cell - Single cell in a PDF table
PDF 表格单元格 - PDF 表格中的单个单元格
Supports text content, alignment, colspan/rowspan, and styling.
支持文本内容、对齐、跨列/跨行和样式。
Features | 主要功能:
- Cell content and font configuration - 单元格内容和字体配置
- Horizontal and vertical alignment - 水平和垂直对齐
- Colspan and rowspan support - 跨列和跨行支持
- Border and background styling - 边框和背景样式
Usage Examples | 使用示例:
PdfCell cell = PdfCell.of("Hello")
.fontSize(14)
.bold(true)
.align(Alignment.CENTER)
.backgroundColor(PdfColor.LIGHT_GRAY);
Security | 安全性:
- Thread-safe: No — mutable builder pattern - 线程安全: 否 — 可变构建器模式
- Null-safe: No — callers must ensure non-null values - 空值安全: 否 — 调用方需确保非空值
- Since:
- JDK 25, opencode-base-pdf V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHorizontal Alignment 水平对齐方式static enumVertical Alignment 垂直对齐方式 -
Method Summary
Modifier and TypeMethodDescriptionalign(PdfCell.Alignment alignment) Sets horizontal alignment 设置水平对齐backgroundColor(PdfColor color) Sets background color 设置背景颜色Sets border 设置边框static PdfCellbuilder()Creates a cell builder 创建单元格构建器colspan(int colspan) Sets colspan 设置跨列数Sets cell content 设置单元格内容static PdfCellempty()Creates empty cell 创建空单元格Sets font 设置字体fontSize(float size) Sets font size 设置字体大小floatintgetFont()floatfloatintstatic PdfCellCreates cell with content 创建带内容的单元格padding(float padding) Sets padding 设置内边距rowspan(int rowspan) Sets rowspan 设置跨行数Sets text color 设置文本颜色valign(PdfCell.VerticalAlignment alignment) Sets vertical alignment 设置垂直对齐
-
Method Details
-
of
-
empty
-
builder
Creates a cell builder 创建单元格构建器- Returns:
- new PdfCell instance | 新 PdfCell 实例
-
content
-
font
-
fontSize
Sets font size 设置字体大小- Parameters:
size- font size | 字体大小- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
textColor
-
backgroundColor
-
align
Sets horizontal alignment 设置水平对齐- Parameters:
alignment- horizontal alignment | 水平对齐- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
valign
Sets vertical alignment 设置垂直对齐- Parameters:
alignment- vertical alignment | 垂直对齐- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
colspan
Sets colspan 设置跨列数- Parameters:
colspan- number of columns to span | 跨越的列数- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
rowspan
Sets rowspan 设置跨行数- Parameters:
rowspan- number of rows to span | 跨越的行数- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
padding
Sets padding 设置内边距- Parameters:
padding- padding in points | 内边距(点)- Returns:
- this cell for chaining | 当前单元格用于链式调用
-
border
-
getContent
-
getFont
-
getFontSize
public float getFontSize() -
getTextColor
-
getBackgroundColor
-
getHorizontalAlignment
-
getVerticalAlignment
-
getColspan
public int getColspan() -
getRowspan
public int getRowspan() -
getPadding
public float getPadding() -
getBorderWidth
public float getBorderWidth() -
getBorderColor
-