namespace com.azkoss.excellite
{
using System;
using System.Drawing;
///
///Contains font related settings.
///
public class ExcelFont
{
// Methods
internal ExcelFont(CellStyle parent)
{
this.parent = parent;
}
internal void CopyTo(CellStyle destination)
{
destination.Element.FontData = new ExcelFontData(this.parent.Element.FontData);
destination.UseFlags &= ((CellStyleData.Properties) (-1044481));
destination.UseFlags |= (this.parent.UseFlags & CellStyleData.Properties.FontRelated);
}
// Properties
public System.Drawing.Color Color
{
get
{
return this.parent.Element.FontData.Color;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.Color = value;
this.parent.UseFlags |= CellStyleData.Properties.FontColor;
}
}
///
///Gets or sets if the font is italic.
///
///
///Default value of this property is false.
///
public bool Italic
{
get
{
return this.parent.Element.FontData.Italic;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.Italic = value;
this.parent.UseFlags |= CellStyleData.Properties.FontItalic;
}
}
///
///Gets or sets name of the font.
///
///
///Default value for this property is "Arial".
///
public string Name
{
get
{
return this.parent.Element.FontData.Name;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.Name = value;
this.parent.UseFlags |= CellStyleData.Properties.FontName;
}
}
public com.azkoss.excellite.ScriptPosition ScriptPosition
{
get
{
return this.parent.Element.FontData.ScriptPosition;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.ScriptPosition = value;
this.parent.UseFlags |= CellStyleData.Properties.FontScriptPosition;
}
}
///
///Gets or sets font size.
///
///
///
Unit is twip (1/20th of a point).
///
Default value of this property is 200.
///
public int Size
{
get
{
return this.parent.Element.FontData.Size;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.Size = value;
this.parent.UseFlags |= CellStyleData.Properties.FontSize;
}
}
///
///Gets or sets if the font is struck out.
///
///
///Default value of this property is false.
///
public bool Strikeout
{
get
{
return this.parent.Element.FontData.Strikeout;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.Strikeout = value;
this.parent.UseFlags |= CellStyleData.Properties.FontStrikeout;
}
}
public com.azkoss.excellite.UnderlineStyle UnderlineStyle
{
get
{
return this.parent.Element.FontData.UnderlineStyle;
}
set
{
this.parent.BeforeChange();
this.parent.Element.FontData.UnderlineStyle = value;
this.parent.UseFlags |= CellStyleData.Properties.FontUnderlineStyle;
}
}
///
///Gets or sets font weight (font boldness).
///
///
///
Font weight is an integer value between
///MinWeight and MaxWeight.
///
If you want font to have standard boldness, set this property to
///BoldWeight.
///
Default value of this property is NormalWeight.
///
///Thrown if font weight is out of allowed range.
public int Weight
{
get
{
return this.parent.Element.FontData.Weight;
}
set
{
if ((value < 100) || (value > 0x3e8))
{
throw new ArgumentOutOfRangeException("value", value, "Font weight is out of allowed range.");
}
this.parent.BeforeChange();
this.parent.Element.FontData.Weight = value;
this.parent.UseFlags |= CellStyleData.Properties.FontWeight;
}
}
// Fields
///
///Default bold font weight.
///
///
public const int BoldWeight = 700;
///
///Maximum font weight.
///
///
public const int MaxWeight = 0x3e8;
///
///Minimum font weight.
///
///
public const int MinWeight = 100;
///
///Normal font weight.
///
///
public const int NormalWeight = 400;
private CellStyle parent;
}
}