Supprimer les lignes et colonnes vides dans une feuille de calcul

Code C# pour supprimer les lignes vides

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Open an existing excel file.
Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx");
// Create a Worksheets object with reference to
// The sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection
Worksheet sheet = sheets[0];
// Delete the Blank Rows from the worksheet
sheet.Cells.DeleteBlankRows();
// Save the excel file.
wb.Save(dataDir+ "mybook.out.xlsx");

Code C# pour supprimer les colonnes vides

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Open an existing excel file.
Workbook wb = new Workbook(dataDir+ "SampleInput.xlsx");
// Create a Worksheets object with reference to
// The sheets of the Workbook.
WorksheetCollection sheets = wb.Worksheets;
// Get first Worksheet from WorksheetCollection
Worksheet sheet = sheets[0];
// Delete the Blank Columns from the worksheet
sheet.Cells.DeleteBlankColumns();
// Save the excel file.
wb.Save(dataDir+ "mybook.out.xlsx");