Class CellValue

CellValue class

Represents the cell value and corresponding type.

public class CellValue

Constructors

NameDescription
CellValue()The default constructor.

Properties

NameDescription
Type { get; set; }Gets/sets the type of cell value.
Value { get; set; }Gets/sets the cell value.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class CellValueDemo
    {
        public static void CellValueExample()
        {
            // Create a new workbook and get the first worksheet
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Create a CellValue instance
            CellValue cellValue = new CellValue();

            // Set the type and value of the cell
            cellValue.Type = CellValueType.IsNumeric;
            cellValue.Value = 123.45;

            // Assign the CellValue to a cell in the worksheet
            Cell cell = worksheet.Cells["A1"];
            cell.PutValue(cellValue.Value);

            // Save the workbook
            workbook.Save("CellValueExample.xlsx");
            workbook.Save("CellValueExample.pdf");
            return;
        }
    }
}

See Also