Exemplo n.º 1
0
 public void SetUnderline(FontUnderline underline)
 {
     if (underline == FontUnderline.NONE && this._ctFont.sizeOfUArray() > 0)
     {
         this._ctFont.SetUArray((CT_UnderlineProperty[])null);
     }
     else
     {
         (this._ctFont.sizeOfUArray() == 0 ? this._ctFont.AddNewU() : this._ctFont.GetUArray(0)).val = (ST_UnderlineValues)underline.Value;
     }
 }
Exemplo n.º 2
0
 internal Font(Workbook wb, FontRecord f) : base(wb)
 {
     _height       = f.FontHeight;
     _options      = f.Options;
     _color        = wb.Palette.GetColor(f.ColorIdx);
     _boldNess     = f.Boldness;
     _escapement   = f.Escapement;
     _underline    = f.Underline;
     _family       = f.FontFamily;
     _characterSet = f.CharacterSet;
     _fontName     = f.FontName;
 }
Exemplo n.º 3
0
 /**
  * set an enumeration representing the style of underlining that is used.
  * The none style is equivalent to not using underlining at all.
  * The possible values for this attribute are defined by the FontUnderline
  *
  * @param underline - FontUnderline enum value
  */
 internal void SetUnderline(FontUnderlineType underline)
 {
     if (underline == FontUnderlineType.None)
     {
         _ctFont.SetUArray(null);
     }
     else
     {
         CT_UnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.AddNewU() : _ctFont.GetUArray(0);
         ST_UnderlineValues   val         = (ST_UnderlineValues)FontUnderline.ValueOf(underline).Value;
         ctUnderline.val = val;
     }
 }
Exemplo n.º 4
0
 /**
  * set an enumeration representing the style of underlining that is used.
  * The none style is equivalent to not using underlining at all.
  * The possible values for this attribute are defined by the FontUnderline
  *
  * @param underline - FontUnderline enum value
  */
 public void SetUnderline(FontUnderline underline)
 {
     if (underline == FontUnderline.NONE && _ctFont.sizeOfUArray() > 0)
     {
         _ctFont.SetUArray(null);
     }
     else
     {
         CT_UnderlineProperty ctUnderline = _ctFont.sizeOfUArray() == 0 ? _ctFont.AddNewU() : _ctFont.GetUArray(0);
         ST_UnderlineValues   val         = (ST_UnderlineValues)underline.Value;
         ctUnderline.val = val;
     }
 }
Exemplo n.º 5
0
		/// <summary>
		/// The constructor for the record.
		/// </summary>
		/// <param name="biff">The GenericBiff record that should contain the correct type and data for the FONT record.</param>
		/// <exception cref="InvalidRecordIdException">
		/// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
		/// </exception>
		public FontRecord(GenericBiff biff)
		{
			if(biff.Id == (ushort)RecordType.Font)
			{
				BinaryReader reader = new BinaryReader(biff.GetDataStream());

				_fontHeight = reader.ReadUInt16();
				_options = (FontOptions)reader.ReadUInt16();
				_colorIdx = reader.ReadUInt16();
				_boldness = new FontBoldness(reader.ReadUInt16());
				_escapement = (FontEscape)reader.ReadUInt16();
				_underline = (FontUnderline)reader.ReadByte();
				_fontFamily = (FontFamily)reader.ReadByte();
				_characterSet = (FontCharacterSet)reader.ReadByte();
				/* byte reserved = */ reader.ReadByte();
				byte len = reader.ReadByte();
				_fontName = Reader.ReadComplexString(reader, len);
			}
			else
				throw new InvalidRecordIdException(biff.Id, RecordType.Font);
		}
Exemplo n.º 6
0
        /// <summary>
        /// The constructor for the record.
        /// </summary>
        /// <param name="biff">The GenericBiff record that should contain the correct type and data for the FONT record.</param>
        /// <exception cref="InvalidRecordIdException">
        /// An InvalidRecordIdException is thrown if biff contains an invalid type or invalid data.
        /// </exception>
        public FontRecord(GenericBiff biff)
        {
            if (biff.Id == (ushort)RecordType.Font)
            {
                BinaryReader reader = new BinaryReader(biff.GetDataStream());

                _fontHeight   = reader.ReadUInt16();
                _options      = (FontOptions)reader.ReadUInt16();
                _colorIdx     = reader.ReadUInt16();
                _boldness     = new FontBoldness(reader.ReadUInt16());
                _escapement   = (FontEscape)reader.ReadUInt16();
                _underline    = (FontUnderline)reader.ReadByte();
                _fontFamily   = (FontFamily)reader.ReadByte();
                _characterSet = (FontCharacterSet)reader.ReadByte();
                byte reserved = reader.ReadByte();
                byte len      = reader.ReadByte();
                _fontName = Reader.ReadComplexString(reader, len);
            }
            else
            {
                throw new InvalidRecordIdException(biff.Id, RecordType.Font);
            }
        }
Exemplo n.º 7
0
 public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, FontWeight fnWeight, FontItalic fdwItalic, FontUnderline fdwUnderline, FontStrikeOut fdwStrikeOut,
                                        FontCharSet fdwCharSet, FontOutputPrecision fdwOutputPrecision, FontClipPrecision fdwClipPrecision, FontQuality fdwQuality, FontPitchAndFamily fdwPitchAndFamily, string lpszFace);