Beispiel #1
0
 /// <summary>
 /// Set the font, given a font name and font size.
 /// </summary>
 /// <param name="FontName">The name of the font to be used.</param>
 /// <param name="FontSize">The size of the font in points.</param>
 public void SetFont(string FontName, double FontSize)
 {
     this.FontName     = FontName;
     this.FontSize     = FontSize;
     this.CharacterSet = null;
     this.FontFamily   = null;
     this.vFontScheme  = FontSchemeValues.None;
     HasFontScheme     = false;
 }
 private void SetAllNull()
 {
     FontName             = null;
     CharacterSet         = null;
     FontFamily           = null;
     Bold                 = null;
     Italic               = null;
     Strike               = null;
     Outline              = null;
     Shadow               = null;
     Condense             = null;
     Extend               = null;
     clrFontColor         = new SLColor(listThemeColors, listIndexedColors);
     HasFontColor         = false;
     FontSize             = null;
     vUnderline           = UnderlineValues.None;
     HasUnderline         = false;
     vVerticalAlignment   = VerticalAlignmentRunValues.Baseline;
     HasVerticalAlignment = false;
     vFontScheme          = FontSchemeValues.None;
     HasFontScheme        = false;
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        /// <summary>
        /// Set the font, given a font scheme and font size.
        /// </summary>
        /// <param name="FontScheme">The font scheme. If None is given, the current theme's minor font will be used (but if the theme is changed, the text remains as of the old theme's minor font instead of the new theme's minor font).</param>
        /// <param name="FontSize">The size of the font in points.</param>
        public void SetFont(FontSchemeValues FontScheme, double FontSize)
        {
            switch (FontScheme)
            {
            case FontSchemeValues.Major:
                this.FontName   = this.MajorFont;
                this.FontScheme = FontSchemeValues.Major;
                break;

            case FontSchemeValues.Minor:
                this.FontName   = this.MinorFont;
                this.FontScheme = FontSchemeValues.Minor;
                break;

            case FontSchemeValues.None:
                this.FontName    = this.MinorFont;
                this.vFontScheme = FontSchemeValues.None;
                HasFontScheme    = false;
                break;
            }
            this.FontSize     = FontSize;
            this.CharacterSet = null;
            this.FontFamily   = null;
        }
Beispiel #5
0
        public static Font CreateFont(
            Fonts fonts,
            DoubleValue fontSize,
            UInt32Value color,
            StringValue fontName,
            Int32Value fontFamilyNumbering,
            Int32Value fontCharSet,
            bool isBold,
            bool isItalic,
            bool isUnderline,
            FontSchemeValues? fontScheme = null)
        {
            var font = new Font();

            font.Append(new FontSize { Val = fontSize });
            font.Append(new Color { Theme = color });
            font.Append(new FontName { Val = fontName });
            font.Append(new FontFamilyNumbering { Val = fontFamilyNumbering });
            font.Append(new FontCharSet { Val = fontCharSet });

            if (fontScheme.HasValue)
            {
                font.Append(new FontScheme { Val = fontScheme.Value });
            }
            if (isBold)
            {
                font.Append(new Bold());
            }
            if (isItalic)
            {
                font.Append(new Italic());
            }
            if (isUnderline)
            {
                font.Append(new Underline());
            }

            fonts.Append(font);

            return font;
        }
Beispiel #6
0
        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;
            }
        }
Beispiel #7
0
 /// <summary>
 /// Set the font, given a font scheme and font size.
 /// </summary>
 /// <param name="FontScheme">The font scheme. If None is given, the current theme's minor font will be used (but if the theme is changed, the text remains as of the old theme's minor font instead of the new theme's minor font).</param>
 /// <param name="FontSize">The size of the font in points.</param>
 public void SetFont(FontSchemeValues FontScheme, double FontSize)
 {
     this.Font.SetFont(FontScheme, FontSize);
 }
Beispiel #8
0
        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;
            }
        }
Beispiel #9
0
 /// <summary>
 /// Set the font, given a font scheme and font size.
 /// </summary>
 /// <param name="FontScheme">The font scheme. If None is given, the current theme's minor font will be used (but if the theme is changed, the text remains as of the old theme's minor font instead of the new theme's minor font).</param>
 /// <param name="FontSize">The size of the font in points.</param>
 public void SetFont(FontSchemeValues FontScheme, double FontSize)
 {
     switch (FontScheme)
     {
         case FontSchemeValues.Major:
             this.FontName = this.MajorFont;
             this.FontScheme = FontSchemeValues.Major;
             break;
         case FontSchemeValues.Minor:
             this.FontName = this.MinorFont;
             this.FontScheme = FontSchemeValues.Minor;
             break;
         case FontSchemeValues.None:
             this.FontName = this.MinorFont;
             this.vFontScheme = FontSchemeValues.None;
             HasFontScheme = false;
             break;
     }
     this.FontSize = FontSize;
     this.CharacterSet = null;
     this.FontFamily = null;
 }
Beispiel #10
0
 /// <summary>
 /// Set the font, given a font name and font size.
 /// </summary>
 /// <param name="FontName">The name of the font to be used.</param>
 /// <param name="FontSize">The size of the font in points.</param>
 public void SetFont(string FontName, double FontSize)
 {
     this.FontName = FontName;
     this.FontSize = FontSize;
     this.CharacterSet = null;
     this.FontFamily = null;
     this.vFontScheme = FontSchemeValues.None;
     HasFontScheme = false;
 }
Beispiel #11
0
 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;
 }