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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//!
//! This module contains the [`FormatFill`] struct, which used to set the fill of a format.
//! [`FormatFill`] is used for fields that having both foreground color and background color,
//! mainly applied in the [`Row`], [`Column`] and [`Cell`]'s [`Format`] fill color.
//! # Examples
//!
//! Use [`FormatFill`] to fill columns' 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 white = Format::default();
//! white.fill.fg_color = FormatColor::RGB(255, 255, 255);
//! white.fill.bg_color = FormatColor::RGB(0, 0, 200);
//! white.fill.pattern_type = "lightGrid".to_string();
//! worksheet.set_columns_width_with_format("A:XFD", 8.12, &white).unwrap();
//! workbook.save_as("./examples/fill_fill_columns_color.xlsx").unwrap();
//! ```
//!
//! Use [`FormatFill`] to fill row's color
//!
//! ```
//! use edit_xlsx::{Format, FormatColor, FormatFill, Row, Workbook, WorkSheetCol, WorkSheetRow, Write};
//! let mut workbook = Workbook::from_path("./examples/xlsx/accounting.xlsx").unwrap();
//! let worksheet = workbook.get_worksheet_mut_by_name("worksheet").unwrap();
//! let mut white = Format::default();
//! white.fill.fg_color = FormatColor::RGB(255, 255, 255);
//! white.fill.bg_color = FormatColor::RGB(200, 0, 0);
//! white.fill.pattern_type = "lightGrid".to_string();
//! worksheet.set_row_height_with_format(1, 15.0, &white).unwrap();
//! worksheet.set_row_height_with_format(2, 15.0, &white).unwrap();
//! worksheet.set_row_height_with_format(3, 15.0, &white).unwrap();
//! workbook.save_as("./examples/fill_fill_rows_color.xlsx").unwrap();
//! ```
//!
//! Use [`FormatFill`] to fill cell's color
//!
//! ```
//! use edit_xlsx::{Format, FormatColor, FormatFill, Workbook, Write};
//! let mut workbook = Workbook::from_path("./examples/xlsx/accounting.xlsx").unwrap();
//! let worksheet = workbook.get_worksheet_mut_by_name("worksheet").unwrap();
//! let mut yellow = Format::default();
//! yellow.fill.fg_color = FormatColor::RGB(255, 255, 0);
//! yellow.fill.bg_color = FormatColor::RGB(0, 255, 0);
//! yellow.fill.pattern_type = "lightGrid".to_string();
//! worksheet.write_with_format("B6", "Yellow fg and green bg", &yellow).unwrap();
//! workbook.save_as("./examples/fill_fill_cells_color.xlsx").unwrap();
//! ```
use crateFormatColor;
use crateFromFormat;
use crateColor;
use crateFill;
use crate::;
///
/// [`FormatFill`] is used for fields that having both foreground color and background color,
/// It's mainly applied in the [`Row`], [`Column`] and [`Cell`]'s [`Format`] fill color.
/// # Fields
/// | field | type | meaning |
/// | ------------ | ----------- | ------------------------------------------------------------ |
/// | `pattern_type` | [`String`] | The color filling method, the contents of which can be referred to the [official documentation](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.patternvalues?view=openxml-3.0.1) |
/// | `fg_color` | [`FormatColor`] | The foreground color of filling |
/// | `bg_color` | [`FormatColor`] | The background color of filling |
///