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
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
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 ExcelDxfFontBase : DxfStyleBase<ExcelDxfFontBase>
    {
        public ExcelDxfFontBase(ExcelStyles styles)
            : base(styles)
        {
            Color = new ExcelDxfColor(styles);
        }
        /// <summary>
        /// Font bold
        /// </summary>
        public bool? Bold
        {
            get;
            set;
        }
        /// <summary>
        /// Font Italic
        /// </summary>
        public bool? Italic
        {
            get;
            set;
        }
        /// <summary>
        /// Font-Strikeout
        /// </summary>
        public bool? Strike { get; set; }
        //public float? Size { get; set; }
        public ExcelDxfColor Color { get; set; }
        //public string Name { get; set; }
        //public int? Family { get; set; }
        ///// <summary>
        ///// Font-Vertical Align
        ///// </summary>
        //public ExcelVerticalAlignmentFont? VerticalAlign
        //{
        //    get;
        //    set;
        //}
 
        public ExcelUnderLineType? Underline { get; set; }
 
        protected internal override string Id
        {
            get
            {
                return GetAsString(Bold) + "|" + GetAsString(Italic) + "|" + GetAsString(Strike) + "|" + (Color ==null ? "" : Color.Id) + "|" /*+ GetAsString(VerticalAlign) + "|"*/ + GetAsString(Underline);
            }
        }
 
        protected internal override void CreateNodes(XmlHelper helper, string path)
        {
            helper.CreateNode(path);
            SetValueBool(helper, path + "/d:b/@val", Bold);
            SetValueBool(helper, path + "/d:i/@val", Italic);
            SetValueBool(helper, path + "/d:strike", Strike);
            SetValue(helper, path + "/d:u/@val", Underline);
            SetValueColor(helper, path + "/d:color", Color);
        }
        protected internal override bool HasValue
        {
            get
            {
                return Bold != null ||
                       Italic != null ||
                       Strike != null ||
                       Underline != null ||
                       Color.HasValue;
            }
        }
        protected internal override ExcelDxfFontBase Clone()
        {
            return new ExcelDxfFontBase(_styles) { Bold = Bold, Color = Color.Clone(), Italic = Italic, Strike = Strike, Underline = Underline };
        }
    }
}