انقل أوراق العمل داخل المصنف

يوفر Aspose.Cells طريقة ، Aspose.Cells.Worksheet.MoveTo () ، تُستخدم لنقل ورقة العمل إلى مكان آخر في جدول البيانات. تأخذ الطريقة فهرس ورقة العمل الهدف كمعامل.

يوضح المثال التالي كيفية نقل ورقة عمل إلى موقع آخر داخل المصنف.

 string FilePath = @"..\..\..\Sample Files\";

string FileName = FilePath + "Move Worksheet.xlsx";

//Open an existing excel file.

Workbook wb = new Workbook(FileName);

//Create a Worksheets object with reference to

//the sheets of the Workbook.

WorksheetCollection sheets = wb.Worksheets;

//Get the first worksheet.

Worksheet worksheet = sheets[0];

string test = worksheet.Name;

//Move the first sheet to the third position in the workbook.

worksheet.MoveTo(2);

//Save the excel file.

wb.Save(FileName);

تنزيل نموذج التعليمات البرمجية