mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
create a static method in xlnt::fill to create a solid fill with a particular color to be the cell's background color
This commit is contained in:
parent
3b17675bd1
commit
0f7dc72070
|
@ -163,6 +163,14 @@ enum class XLNT_API fill_type
|
||||||
class XLNT_API fill : public hashable
|
class XLNT_API fill : public hashable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method for the most common use case, setting the fill color of a cell to a single solid color.
|
||||||
|
/// The foreground and background colors of a fill are not the same as the foreground and background colors
|
||||||
|
/// of a cell. When setting a fill color in Excel, a new fill is created with the given color as the fill's
|
||||||
|
/// fgColor and index color number 64 as the bgColor. This method creates a fill in the same way.
|
||||||
|
/// </summary>
|
||||||
|
static fill solid(const color &fill_color);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a fill initialized as a none-type pattern fill with no
|
/// Constructs a fill initialized as a none-type pattern fill with no
|
||||||
/// foreground or background colors.
|
/// foreground or background colors.
|
||||||
|
|
|
@ -194,6 +194,14 @@ std::unordered_map<double, color> gradient_fill::stops() const
|
||||||
|
|
||||||
// fill
|
// fill
|
||||||
|
|
||||||
|
fill fill::solid(const color &fill_color)
|
||||||
|
{
|
||||||
|
return fill(xlnt::pattern_fill()
|
||||||
|
.type(xlnt::pattern_fill_type::solid)
|
||||||
|
.foreground(fill_color)
|
||||||
|
.background(indexed_color(64)));
|
||||||
|
}
|
||||||
|
|
||||||
fill::fill() : type_(fill_type::pattern)
|
fill::fill() : type_(fill_type::pattern)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user