Çalışma Sayfasındaki Boş Satır ve Sütunları Silme
Bir çalışma sayfasından tüm boş satır ve sütunları silmek mümkündür. Bu, örneğin, bir Microsoft Excel dosyasından bir PDF dosyası oluştururken yalnızca veri veya ilgili nesneler içeren satır ve sütunları dönüştürmek istediğinizde faydalıdır.
Boş satır ve sütunları silmek için aşağıdaki Aspose.Cells yöntemlerini kullanın:
- Boş satırları silmek için Cells.DeleteBlankRows() yöntemini kullanın. Silinecek boş satırlar için, Row.IsBlank sadece doğru olmalıdır, ayrıca bu satırlarda herhangi bir hücre için görünür bir yorum tanımlanmamış olmalı ve bunlarla kesişen bir pivota tablonun olmaması gerekir.
- Boş sütunları silmek için Cells.DeleteBlankColumns() yöntemini kullanın.
Boş Satırları Silme için C# kodu
// 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"); |
Boş Sütunları Silme için C# kodu
// 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"); |