// Source directory path.
StringPtr srcDir = new String("SourceDirectory\\");

// Output directory path.
StringPtr outDir = new String("OutputDirectory\\");

// Load the input Excel file
intrusive_ptr<IWorkbook> workbook = Factory::CreateIWorkbook(srcDir->StringAppend(new String("Sample1.xlsx")));

// Access the first worksheet in the Excel file
intrusive_ptr<IWorksheet> worksheet = workbook->GetIWorksheets()->GetObjectByIndex(0);

// Delete 2 rows starting from the 3rd row
worksheet->GetICells()->DeleteRows(2, 2, true);

// Path of output Excel file
StringPtr outputDeleteRows = outDir->StringAppend(new String("outputDeleteRows.xlsx"));

// Save the Excel file.
workbook->Save(outputDeleteRows);