Interface IFont
Represents the font attributes of the text.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Base.dll
Syntax
public interface IFont
Properties
Bold
Gets or sets a value that indicates whether the text is bold or not.
Declaration
bool Bold { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set text part with bold style
font.Bold = true;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set text part with bold style
font.Bold = True
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
CapsType
Gets or sets the caps type.
Declaration
TextCapsType CapsType { get; set; }
Property Value
Type |
---|
TextCapsType |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set the caps type for text part
font.CapsType = TextCapsType.Small;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set the caps type for text part
font.CapsType = TextCapsType.Small
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Color
Gets or sets the foreground color of the text.
Declaration
IColor Color { get; set; }
Property Value
Type |
---|
IColor |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Create instance to hold color properties of font
IColor color = font.Color;
//Set font color for text part
color = ColorObject.Green;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Create instance to hold color properties of font
Dim color As IColor = font.Color
'Set font color for text part
color = ColorObject.Green
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
FontName
Gets or sets the name of the font.
Declaration
string FontName { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set the font name
font.FontName = "Calibri";
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set the font name
font.FontName = "Calibri"
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
FontSize
Gets or sets the size of the font.
Declaration
float FontSize { get; set; }
Property Value
Type |
---|
System.Single |
Examples
///Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set font size of the text
font.FontSize = 32;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set font size of the text
font.FontSize = 32
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
HighlightColor
Gets or sets the Highlight color of the text.
Declaration
IColor HighlightColor { get; set; }
Property Value
Type |
---|
IColor |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Create instance to hold color properties of font
IColor color = ColorObject.Yellow;
//Set Highlight color for text part
font.HighlightColor = color;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Create instance to hold highlight color properties of font
Dim color As IColor = font.HighlightColor
'Set font color for text part
color = ColorObject.Yellow
'Save the presentation
presentation.Save("Sample.pptx")
'Close the presentation
presentation.Close()
Italic
Gets or sets a boolean value that indicates whether the text is italic or not.
Declaration
bool Italic { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set text part with italic style
font.Italic = true;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set text part with italic style
font.Italic = True
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
LanguageID
Gets or sets the language identifier (locale).
Declaration
short LanguageID { get; set; }
Property Value
Type | Description |
---|---|
System.Int16 | The short value that specifies the equivalent |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Sets a language as "Spanish (Argentina)" for TextPart
font.LanguageID = (short) LocaleIDs.es_AR;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Sets a language as "Spanish (Argentina)" for TextPart
font.LanguageID = CType(LocaleIDs.es_AR,Short)
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
StrikeType
Gets or sets the strike through type.
Declaration
TextStrikethroughType StrikeType { get; set; }
Property Value
Type |
---|
TextStrikethroughType |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set strike type for text part
font.StrikeType = TextStrikethroughType.None;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set strike type for text part
font.StrikeType = TextStrikethroughType.None
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Subscript
Gets or sets a boolean value that indicates whether the text is subscript or not.
Declaration
bool Subscript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set the subscript
font.Subscript = true;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set the subscript
font.Subscript = True
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Superscript
Gets or sets a boolean value that indicates whether the text is superscript or not.
Declaration
bool Superscript { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set the superscript
font.Superscript = true;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set the superscript
font.Superscript = True
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()
Underline
Gets or sets the underline type.
Declaration
TextUnderlineType Underline { get; set; }
Property Value
Type |
---|
TextUnderlineType |
Examples
//Create a new presentation.
IPresentation presentation = Presentation.Create();
//Add a blank slide to the presentation.
ISlide slide = presentation.Slides.Add(SlideLayoutType.Blank);
//Add a text box to the slide
IShape shape = slide.Shapes.AddTextBox(100, 150, 300, 200);
//Create instance by adding text part to the shape
ITextPart textPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart");
//Create font instance for text part
IFont font = textPart.Font;
//Set underline type of font
font.Underline = TextUnderlineType.Dash;
//Save the presentation
presentation.Save("Sample.pptx");
//Close the presentation
presentation.Close();
'Create a new presentation.
Dim presentation__1 As IPresentation = Presentation.Create()
'Add a blank slide to the presentation.
Dim slide As ISlide = presentation__1.Slides.Add(SlideLayoutType.Blank)
'Add a text box to the slide
Dim shape As IShape = slide.Shapes.AddTextBox(100, 150, 300, 200)
'Create instance by adding text part to the shape
Dim textPart As ITextPart = shape.TextBody.AddParagraph().AddTextPart("First Paragraph, second TextPart")
'Create font instance for text part
Dim font As IFont = textPart.Font
'Set underline type of font
font.Underline = TextUnderlineType.Dash
'Save the presentation
presentation__1.Save("Sample.pptx")
'Close the presentation
presentation__1.Close()