Aspose.cell处理Excel2

 

 

 

 

(二)从excel中读取数据写到控制台中

 

using System;
using System.Collections.Generic;
using System.Text;
using Aspose.Cells;
namespace FromExcelToDB
{
    class Program
    {
        static void Main(string[] args)
        {
            Workbook book = new Workbook();
            book.Open("student.xlsx");
            Worksheet sheet = book.Worksheets[0];
            Cells cell = sheet.Cells;
           
            for (int row = 0; row < cell.MaxDataRow+1; row++)
            {
                for (int column = 0; column < cell.MaxDataColumn+1; column++)
                {
                    Console.WriteLine(cell[row , column].Value);
                }
            }

        }
    }
}

 

注:若想导入数据库中参照(一);数据库是SQLServer

你可能感兴趣的:(Excel,cells)