1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//!
//! This module contains the [`FormatFont`] struct, which used to set the fill of a format.
//! [`FormatFont`] is used to handle font-related fields, mainly applied to [`Cell`].
//! # Examples
//!
//! Use [`FormatFont`] to set text's font name, size, and color
//! ```
//! use edit_xlsx::{Format, FormatColor, FormatFill, Workbook, WorkSheetCol, Write};
//! let mut workbook = Workbook::from_path("./examples/xlsx/accounting.xlsx").unwrap();
//! let worksheet = workbook.get_worksheet_mut_by_name("worksheet").unwrap();
//! let mut format = Format::default();
//! format.font.name = "Wide Latin".to_string();
//! format.font.size = 30.0;
//! format.font.color = FormatColor::Index(4);
//! worksheet.write_with_format("A1", "It's so fun", &format).unwrap();
//! workbook.save_as("./examples/font_write_with_font.xlsx").unwrap();
//! ```
use crate::;
use crateCell;
///
/// [`FormatFont`] is used to handle font-related fields, mainly applied to [`Cell`].
/// # Fields
/// | field | type | meaning |
/// | --------- | ----------- | -------------------------------------- |
/// | `bold` | bool | Whether the font is bold. |
/// | `italic` | bool | Whether the font is italic. |
/// | `underline` | bool | Whether the font is underlined. |
/// | `size` | f64 | Font size in point. |
/// | `color` | [`FormatColor`] | Font color. |
/// | `name` | [`String`] | Font name, same as displayed in Excel. |
///