Class RenderingFont

RenderingFont class

Font for rendering.

public class RenderingFont

Constructors

NameDescription
RenderingFont(string, float)Initializes a new instance of the RenderingFont

Properties

NameDescription
Bold { get; set; }Gets or sets bold for the font.
Color { get; set; }Gets or sets color for the font.
Italic { get; set; }Gets or sets italic for the font.
Name { get; }Gets name of the font.
Size { get; }Gets size of the font in points.

Examples

[C#]

using Aspose.Cells;
using Aspose.Cells.Rendering;
using System;
using System.Drawing;

namespace Demos
{
    public class RenderingFontDemo
    {
        public static void RenderingFontExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Add some sample data
            sheet.Cells["A1"].PutValue("Hello World!");

            // Create a RenderingFont object
            RenderingFont renderingFont = new RenderingFont("Arial", 12)
            {
                Bold = true,
                Italic = true,
                Color = Color.Blue
            };

            // Create a RenderingWatermark object using the RenderingFont
            RenderingWatermark watermark = new RenderingWatermark("Sample Watermark", renderingFont)
            {
                Rotation = 45,
                ScaleToPagePercent = 100,
                Opacity = 0.5f,
                IsBackground = true,
                HAlignment = TextAlignmentType.Center,
                VAlignment = TextAlignmentType.Center,
                OffsetX = 0,
                OffsetY = 0
            };

            // Create PdfSaveOptions and set the watermark
            PdfSaveOptions pdfSaveOptions = new PdfSaveOptions
            {
                Watermark = watermark,
                EmbedStandardWindowsFonts = true,
                CalculateFormula = true,
                ExportDocumentStructure = true,
                DisplayDocTitle = true
            };

            // Save the workbook to PDF with the watermark
            workbook.Save("RenderingFontExample.pdf", pdfSaveOptions);
        }
    }
}

See Also