zhao
2021-07-07 2fdf959ac739edd6de84aa8053b8b9683dce8e8b
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Xml;
 
namespace HH.WMS.Utils.EPPlus.Style.Dxf
{
    public class ExcelDxfFill : DxfStyleBase<ExcelDxfFill>
    {
        public ExcelDxfFill(ExcelStyles styles)
            : base(styles)
        {
            PatternColor = new ExcelDxfColor(styles);
            BackgroundColor = new ExcelDxfColor(styles);
        }
        public ExcelFillStyle? PatternType { get; set; }
        /// <summary>
        /// The color of the pattern
        /// </summary>
        public ExcelDxfColor PatternColor { get; internal set; }
        /// <summary>
        /// The background color
        /// </summary>
        public ExcelDxfColor BackgroundColor { get; internal set; }
 
        protected internal override string Id
        {
            get
            {
                return GetAsString(PatternType) + "|" + (PatternColor == null ? "" : PatternColor.Id) + "|" + (BackgroundColor == null ? "" : BackgroundColor.Id);
            }
        }
        protected internal override void CreateNodes(XmlHelper helper, string path)
        {
            helper.CreateNode(path);
            SetValueEnum(helper, path + "/d:patternFill/@patternType", PatternType);
            SetValueColor(helper, path + "/d:patternFill/d:fgColor", PatternColor);
            SetValueColor(helper, path + "/d:patternFill/d:bgColor", BackgroundColor);
        }
 
        protected internal override bool HasValue
        {
            get 
            {
                return PatternType != null ||
                    PatternColor.HasValue ||
                    BackgroundColor.HasValue;
            }
        }
        protected internal override ExcelDxfFill Clone()
        {
            return new ExcelDxfFill(_styles) {PatternType=PatternType, PatternColor=PatternColor.Clone(), BackgroundColor=BackgroundColor.Clone()};
        }
    }
}