ReadingSamplesCS

 
using System;

using GemBox.Spreadsheet;

namespace Samples
{
	/// <summary>
	/// Reading sample.
	/// </summary>
	class ReadingSamplesCS
	{
		[STAThread]
		static void Main(string[] args)
		{
            // TODO: If using GemBox.Spreadsheet Professional, put your serial key below.
            // Otherwise, if you are using GemBox.Spreadsheet Free, comment out the 
            // following line (Free version doesn't have SetLicense method). 
            // SpreadsheetInfo.SetLicense("YOUR-SERIAL-KEY-HERE");

            ExcelFile ef = new ExcelFile();

            ef.LoadXls("..\\..\\TestWorkbook.xls");
            // Uncomment if you want to read from XLSX.
            // ef.LoadXlsx("..\\..\\TestWorkbook.xlsx", XlsxOptions.None);

			foreach(ExcelWorksheet sheet in ef.Worksheets)
			{
				Console.WriteLine("--------- {0} ---------", sheet.Name);

				foreach(ExcelRow row in sheet.Rows)
				{
					foreach(ExcelCell cell in row.AllocatedCells)
					{
						if(cell.Value != null)
							Console.Write("{0}({1})", cell.Value, cell.Value.GetType().Name);

						Console.Write("\t");
					}

					Console.WriteLine();
				}
			}

			Console.ReadLine();
		}
	}
}

 

Export Data To XLSX Files With .NET Component