العثور على الصفوف والأعمدة القصوى المدعومة من قبل تنسيقات XLS و XLSX

سيناريوهات الاستخدام المحتملة

هناك عدد مختلف من الصفوف والأعمدة المدعومة من تنسيقات Excel. على سبيل المثال، يدعم ملف XLS 65536 صف و 256 عمودًا بينما يدعم ملف XLSX 1048576 صف و 16384 عمودًا. إذا كنت ترغب في معرفة كم صف وعمود يتم دعمه في التنسيق المعطى، يمكنك استخدام خصائص Workbook.Settings.MaxRow و Workbook.Settings.MaxColumn.

العثور على الصفوف والأعمدة القصوى المدعومة من قبل تنسيقات XLS و XLSX

يقوم الشفرة النموذجية التالية بإنشاء دفتر عمل أولاً في تنسيق XLS ثم في تنسيق XLSX. بعد الإنشاء، تقوم بطباعة قيم خصائص Workbook.Settings.MaxRow و Workbook.Settings.MaxColumn. يرجى الرجوع إلى إخراج وحدة التحكم في الشفرة أدناه للرجوع إليه.

الكود المثالي

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Print message about XLS format.
Console.WriteLine("Maximum Rows and Columns supported by XLS format.");
// Create workbook in XLS format.
Workbook wb = new Workbook(FileFormatType.Excel97To2003);
// Print the maximum rows and columns supported by XLS format.
int maxRows = wb.Settings.MaxRow + 1;
int maxCols = wb.Settings.MaxColumn + 1;
Console.WriteLine("Maximum Rows: " + maxRows);
Console.WriteLine("Maximum Columns: " + maxCols);
Console.WriteLine();
// Print message about XLSX format.
Console.WriteLine("Maximum Rows and Columns supported by XLSX format.");
// Create workbook in XLSX format.
wb = new Workbook(FileFormatType.Xlsx);
// Print the maximum rows and columns supported by XLSX format.
maxRows = wb.Settings.MaxRow + 1;
maxCols = wb.Settings.MaxColumn + 1;
Console.WriteLine("Maximum Rows: " + maxRows);
Console.WriteLine("Maximum Columns: " + maxCols);

مخرجات الوحدة

Maximum Rows and Columns supported by XLS format.

Maximum Rows: 65536

Maximum Columns: 256

Maximum Rows and Columns supported by XLSX format.

Maximum Rows: 1048576

Maximum Columns: 16384