We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please attach your issue file by dragging or droppng, selecting or pasting them.
test.csv
1.34.0.0
照示例写了CSV追加的程序,但似乎只能从第一行开始追加,会覆盖原有的数据。
string filePath = Path.Combine(CommonHelper.GetBaseDataDirectory(), "test.csv"); var objList = new[] { new { ID=1,Name ="Frank",InDate=new DateTime(2021,06,07)}, new { ID=2,Name ="Gloria",InDate=new DateTime(2022,05,03)}, }; using (var stream = File.OpenWrite(filePath)) { MiniExcel.SaveAs(stream, objList, true, "data", ExcelType.CSV); } objList = new[] { new { ID=3,Name ="Frank",InDate=new DateTime(2021,06,07)}, new { ID=4,Name ="Gloria",InDate=new DateTime(2022,05,03)}, }; using (var stream = File.OpenWrite(filePath)) { MiniExcel.Insert(stream, objList, "data", ExcelType.CSV); }
执行的结果:
而且这里的 Insert 必须指明是 ExcelType.CSV ,不然会报错: System.NotImplementedException:“未实现该方法或操作。”
The text was updated successfully, but these errors were encountered:
在insert前加语句将流的当前位置设置到流的末尾:
stream.Seek(0, SeekOrigin.End);
或者不要用File.OpenWrite,改为:
var stream = new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, 4096, FileOptions.SequentialScan)
Sorry, something went wrong.
No branches or pull requests
Excel Type
Upload Excel File
Please attach your issue file by dragging or droppng, selecting or pasting them.
test.csv
MiniExcel Version
1.34.0.0
Description
照示例写了CSV追加的程序,但似乎只能从第一行开始追加,会覆盖原有的数据。
执行的结果:
而且这里的 Insert 必须指明是 ExcelType.CSV ,不然会报错: System.NotImplementedException:“未实现该方法或操作。”
The text was updated successfully, but these errors were encountered: