查找 XLS 和 XLSX 格式支持的最大行数和列数
Contents
[
Hide
]
可能的使用场景
Excel 格式支持的行数和列数不同。例如,XLS 支持 65536 行和 256 列,而 XLSX 支持 1048576 行和 16384 列。如果您想知道给定格式支持多少行和列,您可以使用工作簿.设置.MaxRow和工作簿.设置.MaxColumn特性。
查找 XLS 和 XLSX 格式支持的最大行数和列数
以下示例代码首先以 XLS 格式创建工作簿,然后以 XLSX 格式创建工作簿。创建后,它打印值工作簿.设置.MaxRow和工作簿.设置.MaxColumn特性。请查看下面给出的代码的控制台输出以供参考。
示例代码
This file contains 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
// 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