internal void FromColorScale(X14.ColorScale cs)
        {
            this.SetAllNull();

            SLConditionalFormattingValueObject2010 cfvo;
            SLColor clr;

            using (OpenXmlReader oxr = OpenXmlReader.Create(cs))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(X14.ConditionalFormattingValueObject))
                    {
                        cfvo = new SLConditionalFormattingValueObject2010();
                        cfvo.FromConditionalFormattingValueObject((X14.ConditionalFormattingValueObject)oxr.LoadCurrentElement());
                        this.Cfvos.Add(cfvo);
                    }
                    else if (oxr.ElementType == typeof(X14.Color))
                    {
                        clr = new SLColor(new List <System.Drawing.Color>(), new List <System.Drawing.Color>());
                        clr.FromExcel2010Color((X14.Color)oxr.LoadCurrentElement());
                        this.Colors.Add(clr);
                    }
                }
            }
        }
Exemple #2
0
        internal SLColor Clone()
        {
            SLColor clr = new SLColor(this.listThemeColors, this.listIndexedColors);

            clr.clrDisplay = this.clrDisplay;
            clr.Auto       = this.Auto;
            clr.Indexed    = this.Indexed;
            clr.Rgb        = this.Rgb;
            clr.Theme      = this.Theme;
            clr.Tint       = this.Tint;

            return(clr);
        }
        internal void FromBorderPropertiesType(HorizontalBorder border)
        {
            if (border.Color != null)
            {
                this.clrReal = new SLColor(this.listThemeColors, this.listIndexedColors);
                this.clrReal.FromSpreadsheetColor(border.Color);
                HasColor = !this.clrReal.IsEmpty();
            }
            else
            {
                RemoveColor();
            }

            if (border.Style != null)
            {
                this.BorderStyle = border.Style.Value;
            }
            else
            {
                RemoveBorderStyle();
            }
        }
 private void SetAllNull()
 {
     this.FontName           = null;
     this.CharacterSet       = null;
     this.FontFamily         = null;
     this.Bold               = null;
     this.Italic             = null;
     this.Strike             = null;
     this.Outline            = null;
     this.Shadow             = null;
     this.Condense           = null;
     this.Extend             = null;
     this.clrFontColor       = new SLColor(this.listThemeColors, this.listIndexedColors);
     HasFontColor            = false;
     this.FontSize           = null;
     this.vUnderline         = UnderlineValues.None;
     HasUnderline            = false;
     this.vVerticalAlignment = VerticalAlignmentRunValues.Baseline;
     HasVerticalAlignment    = false;
     this.vFontScheme        = FontSchemeValues.None;
     HasFontScheme           = false;
 }
Exemple #5
0
        private void SetAllNull()
        {
            this.clrTabColor = new SLColor(this.listThemeColors, this.listIndexedColors);
            this.HasTabColor = false;

            this.ApplyStyles        = false;
            this.SummaryBelow       = true;
            this.SummaryRight       = true;
            this.ShowOutlineSymbols = true;

            this.AutoPageBreaks = true;
            this.FitToPage      = false;

            this.SyncHorizontal       = false;
            this.SyncVertical         = false;
            this.SyncReference        = string.Empty;
            this.TransitionEvaluation = false;
            this.TransitionEntry      = false;
            this.Published            = true;
            this.CodeName             = string.Empty;
            this.FilterMode           = false;
            this.EnableFormatConditionsCalculation = true;
        }
 /// <summary>
 /// Remove any existing color.
 /// </summary>
 public void RemoveColor()
 {
     this.clrReal = new SLColor(this.listThemeColors, this.listIndexedColors);
     HasColor     = false;
 }
        internal void FromFont(Font f)
        {
            this.SetAllNull();

            if (f.FontName != null && f.FontName.Val != null)
            {
                this.FontName = f.FontName.Val.Value;
            }

            if (f.FontCharSet != null && f.FontCharSet.Val != null)
            {
                this.CharacterSet = f.FontCharSet.Val.Value;
            }

            if (f.FontFamilyNumbering != null && f.FontFamilyNumbering.Val != null)
            {
                this.FontFamily = f.FontFamilyNumbering.Val.Value;
            }

            if (f.Bold != null)
            {
                if (f.Bold.Val == null)
                {
                    this.Bold = true;
                }
                else if (f.Bold.Val.Value)
                {
                    this.Bold = true;
                }
            }

            if (f.Italic != null)
            {
                if (f.Italic.Val == null)
                {
                    this.Italic = true;
                }
                else if (f.Italic.Val.Value)
                {
                    this.Italic = true;
                }
            }

            if (f.Strike != null)
            {
                if (f.Strike.Val == null)
                {
                    this.Strike = true;
                }
                else if (f.Strike.Val.Value)
                {
                    this.Strike = true;
                }
            }

            if (f.Outline != null)
            {
                if (f.Outline.Val == null)
                {
                    this.Outline = true;
                }
                else if (f.Outline.Val.Value)
                {
                    this.Outline = true;
                }
            }

            if (f.Shadow != null)
            {
                if (f.Shadow.Val == null)
                {
                    this.Shadow = true;
                }
                else if (f.Shadow.Val.Value)
                {
                    this.Shadow = true;
                }
            }

            if (f.Condense != null)
            {
                if (f.Condense.Val == null)
                {
                    this.Condense = true;
                }
                else if (f.Condense.Val.Value)
                {
                    this.Condense = true;
                }
            }

            if (f.Extend != null)
            {
                if (f.Extend.Val == null)
                {
                    this.Extend = true;
                }
                else if (f.Extend.Val.Value)
                {
                    this.Extend = true;
                }
            }

            if (f.Color != null)
            {
                this.clrFontColor = new SLColor(this.listThemeColors, this.listIndexedColors);
                this.clrFontColor.FromSpreadsheetColor(f.Color);
                HasFontColor = !this.clrFontColor.IsEmpty();
            }

            if (f.FontSize != null && f.FontSize.Val != null)
            {
                this.FontSize = f.FontSize.Val.Value;
            }

            if (f.Underline != null)
            {
                if (f.Underline.Val != null)
                {
                    this.Underline = f.Underline.Val.Value;
                }
                else
                {
                    this.Underline = UnderlineValues.Single;
                }
            }

            if (f.VerticalTextAlignment != null && f.VerticalTextAlignment.Val != null)
            {
                this.VerticalAlignment = f.VerticalTextAlignment.Val.Value;
            }

            if (f.FontScheme != null && f.FontScheme.Val != null)
            {
                this.FontScheme = f.FontScheme.Val.Value;
            }
        }