MiniExcel
MiniExcel copied to clipboard
[FeatureRequest]Support parse and write .et / .xls format
Excel Type
- [ ] XLS
- [ ] ET
Upload Excel File
MiniExcel Version
N/A
Description
希望能探究下是否可以 支援 金山WPS的 .et 格式的excel ,以及 早期版本的 .xls 格式的excel 文件。 目前这两种格式底层用的都是二进制的形态, 只能通过NPOI 来解析出来,由于是OOM的方式, 在运行期间会占用大量的内存。
Sample code to write .et file by NPOI
using NPOI.XSSF.UserModel;
using var streamWriter = new StreamWriter("file.et");
var workbook = new XSSFWorkbook();
var sheet = workbook.CreateSheet("sheet1");
var columns = new[] { "Id", "Name", "Age", "Birthday", "Salary" };
var rowIndex = 0;
var row = sheet.CreateRow(rowIndex);
var colIndex = 0;
for (int j = 0; j < 5; j++)
{
row.CreateCell(colIndex++).SetCellValue(columns[j]);
}
for (int i = 0; i < 100_000; i++)
{
rowIndex++;
colIndex = 0;
var rowData = sheet.CreateRow(rowIndex);
rowData.CreateCell(colIndex++).SetCellValue(i);
rowData.CreateCell(colIndex++).SetCellValue($"Forest_{i}");
rowData.CreateCell(colIndex++).SetCellValue($"{i%100}");
rowData.CreateCell(colIndex++).SetCellValue($"{DateTime.Now.AddDays(-i):yyyy-MM-dd)}");
rowData.CreateCell(colIndex++).SetCellValue($"80_000+{i}");
}
workbook.Write(streamWriter.BaseStream);
Console.WriteLine("ok");

100,000条数据为啥不用csv呢?plain text不香?