Package io.github.dornol.excelkit.excel
Class ExcelRichText
java.lang.Object
io.github.dornol.excelkit.excel.ExcelRichText
Fluent builder for creating rich text content with mixed formatting within a single Excel cell.
Supports partial bold, italic, underline, strikethrough, font color, and font size applied to individual text segments.
Example usage:
ExcelRichText rt = new ExcelRichText()
.text("Hello ")
.bold("World")
.text(" — ")
.styled("red text", s -> s.color(ExcelColor.RED).italic(true));
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStyle configuration for a rich text segment. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppends bold text.Appends italic text.styled(String text, Consumer<ExcelRichText.FontStyle> configurer) Appends text with fully customized font styling.Appends plain (unstyled) text.toString()Returns the plain text content (without formatting) for display or width calculation.
-
Constructor Details
-
ExcelRichText
public ExcelRichText()Creates a new empty rich text instance.
-
-
Method Details
-
text
Appends plain (unstyled) text.- Parameters:
text- the text to append- Returns:
- this builder
-
bold
Appends bold text.- Parameters:
text- the text to append in bold- Returns:
- this builder
-
italic
Appends italic text.- Parameters:
text- the text to append in italic- Returns:
- this builder
-
styled
Appends text with fully customized font styling.- Parameters:
text- the text to appendconfigurer- a consumer that configures theExcelRichText.FontStyle- Returns:
- this builder
-
toString
Returns the plain text content (without formatting) for display or width calculation.
-