pub struct FontConfig {
pub name: Option<String>,
pub size: Option<u32>,
pub bold: bool,
pub italic: bool,
pub underline: bool,
pub color: Option<Color>,
}Expand description
文本片段的字体配置。
用于段落文本和表格单元格内容。
对应 Java: com.alibaba.excel.write.metadata.style.WriteFont
Fields§
§name: Option<String>Font family name (e.g. “Arial”, “Times New Roman”, “宋体”).
size: Option<u32>Font size in half-points (e.g. 24 = 12pt).
bold: boolWhether the text is bold.
italic: boolWhether the text is italic.
underline: boolWhether the text is underlined.
color: Option<Color>Text color. None means auto/inherit.
Implementations§
Source§impl FontConfig
impl FontConfig
Sourcepub fn new() -> FontConfig
pub fn new() -> FontConfig
Creates default font configuration.
Sourcepub fn bold() -> FontConfig
pub fn bold() -> FontConfig
Creates a bold font.
Sourcepub fn header() -> FontConfig
pub fn header() -> FontConfig
Creates a font for table headers (bold, white on blue).
Sourcepub fn name(self, name: impl Into<String>) -> FontConfig
pub fn name(self, name: impl Into<String>) -> FontConfig
Sets the font family.
Sourcepub fn size(self, size: u32) -> FontConfig
pub fn size(self, size: u32) -> FontConfig
Sets the font size in half-points.
Sourcepub fn with_bold(self, bold: bool) -> FontConfig
pub fn with_bold(self, bold: bool) -> FontConfig
Sets bold on or off.
Sourcepub fn with_italic(self, italic: bool) -> FontConfig
pub fn with_italic(self, italic: bool) -> FontConfig
Sets italic on or off.
Sourcepub fn with_underline(self, underline: bool) -> FontConfig
pub fn with_underline(self, underline: bool) -> FontConfig
Sets underline on or off.
Sourcepub fn color(self, color: Color) -> FontConfig
pub fn color(self, color: Color) -> FontConfig
Sets the text color.
Trait Implementations§
Source§impl Clone for FontConfig
impl Clone for FontConfig
Source§fn clone(&self) -> FontConfig
fn clone(&self) -> FontConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FontConfig
impl Debug for FontConfig
Source§impl Default for FontConfig
impl Default for FontConfig
Source§fn default() -> FontConfig
fn default() -> FontConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FontConfig
impl RefUnwindSafe for FontConfig
impl Send for FontConfig
impl Sync for FontConfig
impl Unpin for FontConfig
impl UnsafeUnpin for FontConfig
impl UnwindSafe for FontConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more