Link Search Menu Expand Document

Get Cell Color - C#

Spreadsheet SDK sample in C# demonstrating ‘Get Cell Color’

Program.cs
using System;
using System.Collections.Generic;
using System.Text;

using Bytescout.Spreadsheet;

namespace GetCellColor
{
    class Program
    {
        static void Main(string[] args)
        {
            // Open existing XLS document
            Spreadsheet spreadSheet = new Spreadsheet();
	spreadSheet.LoadFromFile("input.xls");

            // Take existing worksheet
            Worksheet sheet = spreadSheet.Worksheet(0);

            // Take cell
            Cell cell = sheet.Cell(0,0);

            // Print back color of fill patter
            Console.WriteLine(cell.FillPatternBackColor.ToString());

            // Print fore color of fill pattern
            Console.WriteLine(cell.FillPatternForeColor.ToString());

            // Close spreadsheet
            spreadSheet.Close();
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore Spreadsheet SDK


Copyright © 2016 - 2021 ByteScout