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");

猜你喜欢

转载自blog.csdn.net/qq_35106907/article/details/84773316