internal static XFRecrod GetXFBiffRecord(IExtendedFormat style, ushort fontID, IExcelWriter writer) { XFRecrod recrod = new XFRecrod { FontIndex = fontID, FillPatternBackgroundColor = (byte)writer.GetPaletteColor(style.PatternBackgroundColor), FillPatternColor = (byte)writer.GetPaletteColor(style.PatternColor), FillPatternIndex = (byte)style.FillPattern, HAlignment = (byte)style.HorizontalAlign, VAlignment = (byte)style.VerticalAlign, IndentLevel = style.Indent, IsF123Prefix = style.IsFirstSymbolApostrophe, IsHidden = style.IsHidden, JustifyLastCharacter = style.IsJustfyLastLine, IsLocked = style.IsLocked, IsShrinkContent = style.IsShrinkToFit, IsWordWrap = style.IsWordWrap, Direction = (byte)style.ReadingOrder, TextRotation = (byte)style.Rotation, LeftBorderColorIndex = (byte)writer.GetPaletteColor(style.Border.Left.Color), LeftBorderLine = (byte)style.Border.Left.LineStyle, RightBorderColorIndex = (byte)writer.GetPaletteColor(style.Border.Right.Color), RightBorderLine = (byte)style.Border.Right.LineStyle, TopBorderColorIndex = (byte)writer.GetPaletteColor(style.Border.Top.Color), TopBorderLine = (byte)style.Border.Top.LineStyle, BottomBorderColorIndex = (byte)writer.GetPaletteColor(style.Border.Bottom.Color), BottomBorderLine = (byte)style.Border.Bottom.LineStyle, ApplyAlignment = style.ApplyAlignment, ApplyBorder = style.ApplyBorder, ApplyFont = style.ApplyFont, ApplyFill = style.ApplyFill, ApplyNumberFormat = style.ApplyNumberFormat, ApplyProtection = style.ApplyProtection }; if ((style is ExtendedFormat) && (style as ExtendedFormat).IsStyleFormat) { recrod.IsStyleXF = true; recrod.ParentXFIndex = 0xfff; } else { recrod.IsStyleXF = false; if (style.ParentFormatID.HasValue) { recrod.ParentXFIndex = (ushort)style.ParentFormatID.Value; } else { recrod.ParentXFIndex = 15; } } if (style.NumberFormat != null) { recrod.FormatIndex = (ushort)style.NumberFormat.NumberFormatId; return(recrod); } recrod.FormatIndex = (ushort)style.NumberFormatIndex; return(recrod); }
internal static FONTRecord GetFontBiffRecord(IExcelFont font, IExcelWriter writer) { return(new FONTRecord { CharacterSet = font.CharSetIndex, ColorIndex = (ushort)writer.GetPaletteColor(font.FontColor), FontFamily = (byte)font.FontFamily, FontName = font.FontName, FontHeight = (ushort)(font.FontSize * 20.0), IsBold = font.IsBold, IsItalic = font.IsItalic, IsOutline = font.IsOutlineStyle, IsShadow = font.IsShadowStyle, IsStrikeOut = font.IsStrikeOut, UnderlineStyle = (byte)font.UnderLineStyle, SuperScript = (ushort)font.VerticalAlignRun }); }