Class FontImpl
Contains the font attributes (font name, font size, color, and so on) for an object.
Implements
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public class FontImpl : CommonObject, ICloneable, IComparable, IInternalFont, IFont, IParentApplication, IOptimizedUpdate, ICloneParent, IDisposable
Constructors
FontImpl(IApplication, Object)
Creates font and sets its Application and Parent properties to specified values.
Declaration
public FontImpl(IApplication application, object parent)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the font. |
System.Object | parent | Parent object for the font. |
FontImpl(IApplication, Object, FontImpl)
Creates FontImpl from FontRecord.
Declaration
[CLSCompliant(false)]
public FontImpl(IApplication application, object parent, FontImpl font)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the font. |
System.Object | parent | Parent object for the font. |
FontImpl | font |
FontImpl(IApplication, Object, FontRecord)
Creates FontImpl from FontRecord.
Declaration
[CLSCompliant(false)]
public FontImpl(IApplication application, object parent, FontRecord record)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the font. |
System.Object | parent | Parent object for the font. |
FontRecord | record | Record with font data. |
FontImpl(IApplication, Object, BiffReader)
Reads font from the stream.
Declaration
[CLSCompliant(false)]
public FontImpl(IApplication application, object parent, BiffReader reader)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the font. |
System.Object | parent | Parent object for the font. |
BiffReader | reader | Reader with font data. |
FontImpl(IApplication, Object, Font)
Creates font based on native font and sets its Application and Parent properties to specified values.
Declaration
public FontImpl(IApplication application, object parent, Font nativeFont)
Parameters
Type | Name | Description |
---|---|---|
IApplication | application | Application object for the font. |
System.Object | parent | Parent object for the font. |
System.Drawing.Font | nativeFont | Native font to create from. |
FontImpl(IFont)
Creates font using data from baseFont.
Declaration
public FontImpl(IFont baseFont)
Parameters
Type | Name | Description |
---|---|---|
IFont | baseFont | IFont that will be copied. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When baseFont is not FontImpl and not FontImplWrapper. |
Properties
Bold
True if the font is bold. Read/write Boolean.
Declaration
public bool Bold { get; set; }
Property Value
Type |
---|
System.Boolean |
BookGraphics
Returns workbook graphics. Read-only.
Declaration
protected Graphics BookGraphics { get; }
Property Value
Type |
---|
System.Drawing.Graphics |
CharSet
Gets/sets font charset.
Declaration
public byte CharSet { get; set; }
Property Value
Type |
---|
System.Byte |
Color
Returns or sets the primary color of the object. Read / write ExcelKnownColors.
Declaration
public ExcelKnownColors Color { get; set; }
Property Value
Type |
---|
ExcelKnownColors |
ColorObject
Returns color object.
Declaration
public ColorObject ColorObject { get; }
Property Value
Type |
---|
ColorObject |
Font
Returns current font. Read-only.
Declaration
public FontImpl Font { get; }
Property Value
Type |
---|
FontImpl |
FontName
Returns or sets the font name. Read/write string.
Declaration
public string FontName { get; set; }
Property Value
Type |
---|
System.String |
IsAutoColor
Indicates whether color is automatically selected. Read-only.
Declaration
public bool IsAutoColor { get; }
Property Value
Type |
---|
System.Boolean |
Italic
True if the font style is italic. Read/write Boolean.
Declaration
public bool Italic { get; set; }
Property Value
Type |
---|
System.Boolean |
Language
Gets or sets font's language.
Declaration
public string Language { get; set; }
Property Value
Type |
---|
System.String |
MacOSOutlineFont
True if the font is an outline font. Read/write Boolean.
Declaration
public bool MacOSOutlineFont { get; set; }
Property Value
Type |
---|
System.Boolean |
MacOSShadow
True if the font is a shadow font or if the object has a shadow. Read/write Boolean.
Declaration
public bool MacOSShadow { get; set; }
Property Value
Type |
---|
System.Boolean |
Record
Returns wrapped FontRecord. Read-only.
Declaration
[CLSCompliant(false)]
public FontRecord Record { get; }
Property Value
Type |
---|
FontRecord |
RGBColor
Gets / sets font color. Searches for the closest color in the workbook palette.
Declaration
public Color RGBColor { get; set; }
Property Value
Type |
---|
System.Drawing.Color |
Size
Returns or sets the size of the font in points. Read / write Variant.
Declaration
public double Size { get; set; }
Property Value
Type |
---|
System.Double |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | When size is less than 1 or greater than 409. |
Strikethrough
True if the font is struck through with a horizontal line. Read/write Boolean.
Declaration
public bool Strikethrough { get; set; }
Property Value
Type |
---|
System.Boolean |
Subscript
True if the font is formatted as subscript. False by default. Read/write Boolean.
Declaration
public bool Subscript { get; set; }
Property Value
Type |
---|
System.Boolean |
Superscript
True if the font is formatted as superscript; False by default. Read/write Boolean.
Declaration
public bool Superscript { get; set; }
Property Value
Type |
---|
System.Boolean |
Underline
Returns or sets the type of underline applied to the font. Can be one of the following ExcelUnderlineStyle constants. Read/write ExcelUnderline.
Declaration
public ExcelUnderline Underline { get; set; }
Property Value
Type |
---|
ExcelUnderline |
VerticalAlignment
Gets / sets font vertical alignment.
Declaration
public ExcelFontVertialAlignment VerticalAlignment { get; set; }
Property Value
Type |
---|
ExcelFontVertialAlignment |
Methods
BeginUpdate()
This method should be called before several updates to the object will take place.
Declaration
public void BeginUpdate()
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of the current instance. |
Clone(Object)
Clones FontImpl.
Declaration
public FontImpl Clone(object parent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parent | Parent object. |
Returns
Type | Description |
---|---|
FontImpl | Returns cloned object. |
CompareTo(Object)
Compares the current instance with another object of the same type.
Declaration
public int CompareTo(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Int32 | Less than zero - This instance is less than obj. Zero - This instance is equal to obj. Greater than zero - This instance is greater than obj. |
CopyTo(FontImpl)
Copies data from this instance to another.
Declaration
public void CopyTo(FontImpl twin)
Parameters
Type | Name | Description |
---|---|---|
FontImpl | twin | Font impl that will receive data from this font. |
EndUpdate()
This method should be called after several updates to the object took place.
Declaration
public void EndUpdate()
Equals(Object)
Determines whether the specified Object is equal to the current Object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The Object to compare with the current Object. |
Returns
Type | Description |
---|---|
System.Boolean | True if the specified Object is equal to the current Object; otherwise, False. |
Overrides
GenerateNativeFont()
Generates .Net font object corresponding to the current font.
Declaration
public Font GenerateNativeFont()
Returns
Type | Description |
---|---|
System.Drawing.Font | Generated .Net font. |
GenerateNativeFont(Single)
Generates .Net font object corresponding to the current font.
Declaration
public Font GenerateNativeFont(float size)
Parameters
Type | Name | Description |
---|---|---|
System.Single | size | Desired font size. |
Returns
Type | Description |
---|---|
System.Drawing.Font | Generated .Net font. |
GetHashCode()
Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for the current Object. |
Overrides
GetSupportedFontStyle(String)
Find and returns the supported font font style by the respective font.
Declaration
public FontStyle GetSupportedFontStyle(string fontName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fontName |
Returns
Type |
---|
System.Drawing.FontStyle |
MeasureCharacter(Char)
Declaration
public SizeF MeasureCharacter(char value)
Parameters
Type | Name | Description |
---|---|---|
System.Char | value |
Returns
Type |
---|
System.Drawing.SizeF |
MeasureCharacterRanges(String, CharacterRange[])
Declaration
public SizeF[] MeasureCharacterRanges(string strValue, CharacterRange[] ranges)
Parameters
Type | Name | Description |
---|---|---|
System.String | strValue | |
System.Drawing.CharacterRange[] | ranges |
Returns
Type |
---|
System.Drawing.SizeF[] |
MeasureString(String)
Measures the specified string when drawn with this font.
Declaration
public SizeF MeasureString(string strValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | strValue | String to measure. |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | String size. |
MeasureStringSpecial(String)
Measures the specified string in special way (as close as possible to MS Excel).
Declaration
public SizeF MeasureStringSpecial(string strValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | strValue | String to measure. |
Returns
Type | Description |
---|---|
System.Drawing.SizeF | String size. |
Parse(Font)
Parses native font.
Declaration
public void Parse(Font nativeFont)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Font | nativeFont | Font to parse. |
Serialize(OffsetArrayList)
Saves all range cells into OffsetArrayList.
Declaration
[CLSCompliant(false)]
public void Serialize(OffsetArrayList records)
Parameters
Type | Name | Description |
---|---|---|
OffsetArrayList | records | Array that will receive font record. |
SetChanged()
This method should be called after any changes. Sets Saved property of the parent workbook to false.
Declaration
public void SetChanged()
SizeInPoints(Int32)
Declaration
public static double SizeInPoints(int twipsSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | twipsSize |
Returns
Type |
---|
System.Double |
SizeInTwips(Double)
Converts size of the font to the twips.
Declaration
public static int SizeInTwips(double fontSize)
Parameters
Type | Name | Description |
---|---|---|
System.Double | fontSize | Size of the font. |
Returns
Type | Description |
---|---|
System.Int32 | Size of the font in twips. |
TypedClone()
Creates a new object that is a copy of the current instance.
Declaration
public FontImpl TypedClone()
Returns
Type | Description |
---|---|
FontImpl | A new object that is a copy of the current instance. |
UpdateFontIndexes(Int32, Dictionary<Int32, Int32>, ExcelParseOptions)
Updates font indexes in different workbooks.
Declaration
public static int UpdateFontIndexes(int iOldIndex, Dictionary<int, int> dicNewIndexes, ExcelParseOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | iOldIndex | Index to update. |
System.Collections.Generic.Dictionary<System.Int32, System.Int32> | dicNewIndexes | Dictionary with new indexes. |
ExcelParseOptions | options | Parse options. |
Returns
Type | Description |
---|---|
System.Int32 | Returns new index. |
Explicit Interface Implementations
ICloneParent.Clone(Object)
Creates a new object that is a copy of the current instance.
Declaration
object ICloneParent.Clone(object parent)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parent | Parent object for a copy of this instance. |
Returns
Type | Description |
---|---|
System.Object | A new object that is a copy of this instance. |
IDisposable.Dispose()
Declaration
void IDisposable.Dispose()