Aspose.Cells API 可用于方便地读取 XLSB 文件数据。除 XLSB 外,所有其他 Excel 格式如 XLS、XLSX、XLSM 等数据都可以用很少的代码轻松读取。
有关演示,请参阅以下C# 代码、代码内部使用的源 XLSB 文件和代码生成的控制台输出供您参考。
C#
// Print message on Console
Console.WriteLine("Reading XLSB file in C# using Aspose.Cells API.");
Console.WriteLine("----------------------------------------------");
// Directory path of input and output files.
string dirPath = "D:/Download/";
// Load your source XLSB file inside the Aspose.Cells Workbook object.
Workbook wb = new Workbook(dirPath + "Source.xlsb");
// Access first worksheet.
Worksheet ws = wb.Worksheets[0];
// Access cells enumarator
System.Collections.IEnumerator iEnum = ws.Cells.GetEnumerator();
// Print the cells data in while loop on console.
while(iEnum.MoveNext())
{
Cell cell = (Cell)iEnum.Current;
Console.WriteLine(cell.Value);
}
控制台输出
Reading XLSB file in C# using Aspose.Cells API.
----------------------------------------------
This is C3 data.
This is J4 data.
This is F6 data.
This is D9 data.
This is H10 data.
This is G15 data.
This is L17 data.
This is B20 data.
Aspose.Cells C# 代码中使用的源 XLSB 文件的快照

Aspose.Cells C# 代码生成的控制台输出快照
