gpt4 book ai didi

c# - 将工作簿保存到流而不是文件中

转载 作者:太空宇宙 更新时间:2023-11-03 14:15:52 24 4
gpt4 key购买 nike

是否可以(以及如何)将 Microsoft Excel 工作簿保存到而不是文件中?

我现在拥有的是:

using System.Runtime.InteropServices; // Microsoft Excel 14.0 Object Library
.......
workbook.SaveAs(Filename: fileName, FileFormat: XlFileFormat.xlWorkbookNormal);

但是作为 intellisense 的文档都没有告诉我如何将其放入 stream 并使用 BinaryWriter 编写它,例如通过浏览器输出。

最佳答案

Office Automation 提供了一个 API 来控制 tge office UI。它不提供将工作簿存储到流中的方法。为此,您需要一些较低级别的东西,例如二进制编写器 (POI) 或 Office Open XML SDK。

关于c# - 将工作簿保存到流而不是文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6596521/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com