Class MsoLineFormatHelper

MsoLineFormatHelper class

Represents line and arrowhead formatting.

public class MsoLineFormatHelper

Properties

NameDescription
BackColor { get; set; }Gets and sets the border line back color.
DashStyle { get; set; }Gets or sets the dash style for the specified line.
ForeColor { get; set; }Gets and sets the border line fore color.
IsVisible { get; set; }Indicates whether the object is visible.
Style { get; set; }Returns a Style object that represents the style of the specified range.
Transparency { get; set; }Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear).
Weight { get; set; }Returns or sets the weight of the line ,in units of pt.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Drawing;
    using System;
    using System.Drawing;

    public class DrawingClassMsoLineFormatHelperDemo
    {
        public static void Run()
        {
            // Create a new workbook for demonstration
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            try
            {
                // Create a shape to demonstrate line formatting
                Shape shape = worksheet.Shapes.AddLine(10, 10, 100, 100, 0, 0);

                // Get the line format directly from the shape
                MsoLineFormat lineFormat = shape.LineFormat;

                // Set properties directly on the line format
                lineFormat.IsVisible = true;
                lineFormat.Style = MsoLineStyle.Single;
                lineFormat.ForeColor = Color.Blue;
                lineFormat.BackColor = Color.LightGray;
                lineFormat.DashStyle = MsoLineDashStyle.Solid;
                lineFormat.Transparency = 0.2;
                lineFormat.Weight = 2.5;

                // Display the configured properties
                Console.WriteLine($"Line is visible: {lineFormat.IsVisible}");
                Console.WriteLine($"Line style: {lineFormat.Style}");
                Console.WriteLine($"Fore color: {lineFormat.ForeColor}");
                Console.WriteLine($"Back color: {lineFormat.BackColor}");
                Console.WriteLine($"Dash style: {lineFormat.DashStyle}");
                Console.WriteLine($"Transparency: {lineFormat.Transparency}");
                Console.WriteLine($"Weight: {lineFormat.Weight}");

                // Save the workbook
                workbook.Save("MsoLineFormatHelperDemo.xlsx");
                Console.WriteLine("Workbook saved successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error working with MsoLineFormatHelper: {ex.Message}");
            }
        }
    }
}

See Also