1. 程式人生 > >C# Aspose.Cells拷貝Excel

C# Aspose.Cells拷貝Excel

Workbook workBook = new Workbook(OFD.FileName);
                    
Cells cells = workBook.Worksheets[0].Cells;

if (cells == null)
    return;

DataTable dt = cells.ExportDataTable(1, 1, cells.MaxDataRow + 1, cells.MaxColumn, true);
this.dataGridView1.DataSource = dt;
                   
               
workBook.Save(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop) + "\\" + "1.xls");