Beispiel #1
0
 private void ReadBytes(Bytes bytes)
 {
     byte[] byteArray = bytes.ByteArray;
     _height = BitConverter.ToUInt16(byteArray, 0);
     SetOptionsValue(bytes.Get(2, 2));
     _colorIndex   = BitConverter.ToUInt16(byteArray, 4);
     _weight       = FontWeightConverter.Convert(BitConverter.ToUInt16(byteArray, 6));
     _escapement   = (EscapementTypes)BitConverter.ToUInt16(byteArray, 8);
     _underline    = (UnderlineTypes)byteArray[10];
     _fontFamily   = (FontFamilies)byteArray[11];
     _characterSet = (CharacterSets)byteArray[12];
     //skip byte index 13
     _fontName = UnicodeBytes.Read(bytes.Get(14, bytes.Length - 14), 8);
 }
Beispiel #2
0
        private void SetDefaults()
        {
            _height       = 200;
            _italic       = false;
            _underlined   = false;
            _struckOut    = false;
            _colorIndex   = 32767;
            _weight       = FontWeight.Normal;
            _escapement   = EscapementTypes.Default;
            _underline    = UnderlineTypes.Default;
            _fontFamily   = FontFamilies.Default;
            _characterSet = CharacterSets.Default;
            _notUsed      = 0;
            _fontName     = "Arial";

            OnChange();
        }
Beispiel #3
0
        private void SetDefaults()
        {
            _height = 200;
            _italic = false;
            _underlined = false;
            _struckOut = false;
            _color = new Color(32767);
            _weight = FontWeight.Normal;
            _escapement = EscapementTypes.Default;
            _underline = UnderlineTypes.Default;
            _fontFamily = FontFamilies.Default;
            _characterSet = CharacterSets.Default;
            _notUsed = 0;
            _fontName = "Arial";

            OnChange();
        }
Beispiel #4
0
 private void ReadBytes(Bytes bytes)
 {
     byte[] byteArray = bytes.ByteArray;
     _height = BitConverter.ToUInt16(byteArray, 0);
     SetOptionsValue(bytes.Get(2, 2));
     _color = _doc.Workbook.Palette.GetColor(BitConverter.ToUInt16(byteArray, 4));
     _weight = FontWeightConverter.Convert(BitConverter.ToUInt16(byteArray, 6));
     _escapement = (EscapementTypes) BitConverter.ToUInt16(byteArray, 8);
     _underline = (UnderlineTypes) byteArray[10];
     _fontFamily = (FontFamilies) byteArray[11];
     _characterSet = (CharacterSets) byteArray[12];
     //skip byte index 13
     _fontName = UnicodeBytes.Read(bytes.Get(14, bytes.Length - 14), 8);
 }
Beispiel #5
0
        /// <summary>
        /// 创建一个表格单元格的样式,fontSize=0表示使用默认大小11,默认居中
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="cellLine">是否使用边框线</param>
        /// <param name="underline">字体是下划线样式,默认没有下划线</param>
        /// <param name="fontSize">字体大小,0表示11</param>
        /// <returns></returns>
        public static AppLibrary.WriteExcel.XF NewXf(XlsDocument doc, CellLine cellLine, UnderlineTypes underline = UnderlineTypes.None, int fontSize = 0)
        {
            int size = fontSize;

            if (fontSize == 0)
            {
                size = 10;
            }
            AppLibrary.WriteExcel.XF xf = doc.NewXF();
            xf.Font.FontName       = "宋体";
            xf.Font.Height         = (ushort)(size * 20);
            xf.Font.Underline      = underline;
            xf.TextWrapRight       = true;
            xf.HorizontalAlignment = AppLibrary.WriteExcel.HorizontalAlignments.Centered;
            xf.VerticalAlignment   = AppLibrary.WriteExcel.VerticalAlignments.Centered;
            if (cellLine.ShowTop)
            {
                xf.TopLineStyle = 1;
            }
            if (cellLine.ShowRight)
            {
                xf.RightLineStyle = 1;
            }
            if (cellLine.ShowBottom)
            {
                xf.BottomLineStyle = 1;
            }
            if (cellLine.ShowLeft)
            {
                xf.LeftLineStyle = 1;
            }
            return(xf);
        }