We have already shown you how to set font for the text on Chart legend and Chart Axis in C# by using Spire.Presentation. This article will focus on demonstrating how to set font for text on chart title in C#.

Here comes the code snippets:

Step 1: Create a presentation instance and load the document from file.

Presentation presentation = new Presentation();
presentation.LoadFromFile("sample.pptx", FileFormat.Pptx2010);

Step 2: Get the chart that need to be formatted the font for the text on chart title.

IChart chart = presentation.Slides[0].Shapes[0] as IChart;

Step 3: Set the font for the text on chart title area.

chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Arial Unicode MS");
chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.SolidColor.KnownColor = KnownColors.Blue;
chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 50;

Step 4: Save the document to file:

presentation.SaveToFile("result.pptx", FileFormat.Pptx2010);

Effective screenshot after formatting the font for the chart title.

Set font for the text on Chart title in C#

Full codes:

using Spire.Presentation;
using Spire.Presentation.Charts;

namespace SetFont
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("sample.pptx", FileFormat.Pptx2010);

            IChart chart = presentation.Slides[0].Shapes[0] as IChart;

            chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.LatinFont = new TextFont("Arial Unicode MS");
            chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.Fill.SolidColor.KnownColor = KnownColors.Blue;
            chart.ChartTitle.TextProperties.Paragraphs[0].DefaultCharacterProperties.FontHeight = 50;

            presentation.SaveToFile("result.pptx", FileFormat.Pptx2010);
        }
    }
}

Create Spot Color in PDF in C#/VB.NET

2017-01-19 08:25:09 Written by Koohji

Colors created without screens or dots are referred to in the industry as spot or solid colors. Spot colors are the preferred method of producing stationery inexpensively, and also the method used where color accuracy is deemed essential, for instance a company logo.

This article presents how to define a spot color based on RGB color spaces, create variations of a spot color with different tint value, and how to apply the spot color to text and graphic objects using Spire.PDF.

Step 1: Create a PdfDcoument object and add a page to it.

PdfDocument pdf = new PdfDocument();
PdfPageBase page = pdf.Pages.Add();

Step 2: Define the spot color "MySpotColor" from the built-in color.

PdfSeparationColorSpace cs = new PdfSeparationColorSpace("MySpotColor", Color.Purple);

Step 3: Set the spot color with a tint value of 1.

PdfSeparationColor color = new PdfSeparationColor(cs, 1f);

Step 4: Apply the spot color while drawing content on the page.

PdfSolidBrush brush = new PdfSolidBrush(color);
page.Canvas.DrawPie(brush, 10, 30, 60, 60, 360, 360);
page.Canvas.DrawString("1.0 tint!", new PdfFont(PdfFontFamily.Helvetica, 10f), brush, new PointF(20,100));

Step 5: Set the spot color with a tint value of 0.5 and apply it to some other content.

color = new PdfSeparationColor(cs, 0.5f);
brush = new PdfSolidBrush(color);
page.Canvas.DrawPie(brush, 80, 30, 60, 60, 360, 360);
page.Canvas.DrawString("Tint=0.5", new PdfFont(PdfFontFamily.Helvetica, 10f), brush, new PointF(92,100));

Step 6: Save the file.

pdf.SaveToFile("SpotColor.pdf");

Output:

How to Create Spot Color in PDF in C#, VB.NET

Full Code:

[C#]
using Spire.Pdf;
using Spire.Pdf.ColorSpace;
using Spire.Pdf.Graphics;
using System.Drawing;


namespace SpotColor
{
    class Program
    {
        static void Main(string[] args)
        {
            PdfDocument pdf = new PdfDocument();
            PdfPageBase page = pdf.Pages.Add();

            PdfSeparationColorSpace cs = new PdfSeparationColorSpace("MySpotColor", Color.Purple);
            PdfSeparationColor color = new PdfSeparationColor(cs, 1f);
            PdfSolidBrush brush = new PdfSolidBrush(color);
            page.Canvas.DrawPie(brush, 10, 30, 60, 60, 360, 360);
            page.Canvas.DrawString("Tint=1.0", new PdfFont(PdfFontFamily.Helvetica, 10f), brush, new PointF(22, 100));

            color = new PdfSeparationColor(cs, 0.5f);
            brush = new PdfSolidBrush(color);
            page.Canvas.DrawPie(brush, 80, 30, 60, 60, 360, 360);
            page.Canvas.DrawString("Tint=0.5", new PdfFont(PdfFontFamily.Helvetica, 10f), brush, new PointF(92, 100));

            color = new PdfSeparationColor(cs, 0.25f);
            brush = new PdfSolidBrush(color);
            page.Canvas.DrawPie(brush, 150, 30, 60, 60, 360, 360);
            page.Canvas.DrawString("Tint=0.25", new PdfFont(PdfFontFamily.Helvetica, 10f), brush, new PointF(162, 100));
            pdf.SaveToFile("SpotColor.pdf");
        }
    }
}
[VB.NET]
Imports Spire.Pdf
Imports Spire.Pdf.ColorSpace
Imports Spire.Pdf.Graphics
Imports System.Drawing


Namespace SpotColor
	Class Program
		Private Shared Sub Main(args As String())
			Dim pdf As New PdfDocument()
			Dim page As PdfPageBase = pdf.Pages.Add()

			Dim cs As New PdfSeparationColorSpace("MySpotColor", Color.Purple)
			Dim color__1 As New PdfSeparationColor(cs, 1F)
			Dim brush As New PdfSolidBrush(color__1)
			page.Canvas.DrawPie(brush, 10, 30, 60, 60, 360, _
				360)
			page.Canvas.DrawString("Tint=1.0", New PdfFont(PdfFontFamily.Helvetica, 10F), brush, New PointF(22, 100))

			color__1 = New PdfSeparationColor(cs, 0.5F)
			brush = New PdfSolidBrush(color__1)
			page.Canvas.DrawPie(brush, 80, 30, 60, 60, 360, _
				360)
			page.Canvas.DrawString("Tint=0.5", New PdfFont(PdfFontFamily.Helvetica, 10F), brush, New PointF(92, 100))

			color__1 = New PdfSeparationColor(cs, 0.25F)
			brush = New PdfSolidBrush(color__1)
			page.Canvas.DrawPie(brush, 150, 30, 60, 60, 360, _
				360)
			page.Canvas.DrawString("Tint=0.25", New PdfFont(PdfFontFamily.Helvetica, 10F), brush, New PointF(162, 100))
			pdf.SaveToFile("SpotColor.pdf")
		End Sub
	End Class
End Namespace

Spire.Presentation for .NET offers classes of InnerShadowEffect and OuterShadowEffect to enable developers to set the shadow effects for the Text on the presentation slides. This article will focus on how to apply the Font outer shadow effects for the Text in C#.

Firstly, view the effective screenshot for the Text after apply the outer shadow effects via Spire.Presentation.

Set Shadow Effects for the Text on the Presentation Slides

Step 1: Create an instance of Presentation class.

Presentation presentation = new Presentation();

Step 2: Get reference of the slide.

ISlide slide = presentation.Slides[0];

Step 3: Add a new rectangle shape to the first slide.

IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(120, 70, 450, 300));
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;

Step 4: Add the text to the shape and set the font for the text.

shape.AppendTextFrame("Text shading on slides");
shape.TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial Black");
shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.FillType = FillFormatType.Solid;
shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.SolidColor.Color = Color.Black;

Step 5: Add outer shadow and set all necessary parameters.

Spire.Presentation.Drawing.OuterShadowEffect Shadow = new Spire.Presentation.Drawing.OuterShadowEffect();

Shadow.BlurRadius = 0;
Shadow.Direction = 50;
Shadow.Distance = 10;
Shadow.ColorFormat.Color = Color.Green;

Step 6: Apply the shadow effects to the shape.

shape.TextFrame.TextRange.EffectDag.OuterShadowEffect = Shadow;

Step 7: Save the document.

presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);

We can also use the code as below to set the inner shadow for the text font. It is almost the same as how to set the outer shadow effects.

Spire.Presentation.Drawing.InnerShadowEffect Shadow = new Spire.Presentation.Drawing.InnerShadowEffect();

Full codes of how to apply the shadow effects for the text font:

using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace SetShadowEffect
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            ISlide slide = presentation.Slides[0];

            IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(120, 70, 450, 300));
            shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;

            shape.AppendTextFrame("Text shading on slides");
            shape.TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial Black");
            shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.FillType = FillFormatType.Solid;
            shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.SolidColor.Color = Color.Black;

            //Spire.Presentation.Drawing.InnerShadowEffect Shadow = new Spire.Presentation.Drawing.InnerShadowEffect();

            //Add Outer shadow and set all necessary parameters
            Spire.Presentation.Drawing.OuterShadowEffect Shadow = new Spire.Presentation.Drawing.OuterShadowEffect();

            Shadow.BlurRadius = 0;
            Shadow.Direction = 50;
            Shadow.Distance = 10;
            Shadow.ColorFormat.Color = Color.Green;

            shape.TextFrame.TextRange.EffectDag.OuterShadowEffect = Shadow;

            presentation.SaveToFile("Result.pptx", FileFormat.Pptx2010);

        }
    }
}
page 207