حذف الصفوف والأعمدة الفارغة في ورقة العمل
Contents
[
Hide
]
من الممكن حذف جميع الصفوف والأعمدة الفارغة من ورقة العمل. هذا مفيد عندما ترغب في إنشاء ملف PDF من ملف Microsoft Excel وترغب في تحويل الصفوف والأعمدة التي تحتوي على بيانات أو كائن مرتبط فقط.
استخدم وسائل Aspose.Cells التالية لحذف الصفوف والأعمدة الفارغة:
- لحذف الصفوف الفارغة، استخدم الطريقة Cells.delete_blank_rows(). يرجى ملاحظة أنه من الضروري للصفوف الفارغة التي سيتم حذفها أن يكون Row.is_blank صحيحًا، وأيضًا يجب ألا يكون هناك تعليق مرئي معرف لأي خلية في تلك الصفوف، ولا جدول محوري يتقاطع نطاقه معها.
- لحذف الأعمدة الفارغة، استخدم الطريقة Cells.delete_blank_columns().
كود C# لحذف الصفوف الفارغة
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Open an existing excel file. | |
wb = Workbook(dataDir + "SampleInput.xlsx") | |
# Create a Worksheets object with reference to | |
# The sheets of the Workbook. | |
sheets = wb.worksheets | |
# Get first Worksheet from WorksheetCollection | |
sheet = sheets[0] | |
# Delete the Blank Rows from the worksheet | |
sheet.cells.delete_blank_rows() | |
# Save the excel file. | |
wb.save(dataDir + "mybook.out.xlsx") |
كود C# لحذف الأعمدة الفارغة
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Open an existing excel file. | |
wb = Workbook(dataDir + "SampleInput.xlsx") | |
# Create a Worksheets object with reference to | |
# The sheets of the Workbook. | |
sheets = wb.worksheets | |
# Get first Worksheet from WorksheetCollection | |
sheet = sheets[0] | |
# Delete the Blank Columns from the worksheet | |
sheet.cells.delete_blank_columns() | |
# Save the excel file. | |
wb.save(dataDir + "mybook.out.xlsx") |