[英]Can't read an .xlsx file with [BlobInput]
I'm trying to read an .xlsx
file from blob storage but the only option I have is to read it as a string from the binding parameter.我正在尝试从 blob 存储中读取.xlsx
文件,但我唯一的选择是从绑定参数中将其作为字符串读取。
[BlobInput("templates/myTemplate.xlsx", Connection = "StorageAccountConnStr")] string template
To load the .xlsx
file I need to make a MemoryStream.要加载.xlsx
文件,我需要创建一个 MemoryStream。 Thus I wrote:于是我写道:
var templateBytes = Encoding.Unicode.GetBytes(template);
var templateStream = new MemoryStream(templateBytes);
It fails and tells me the file might be corrupt.它失败并告诉我文件可能已损坏。
Any ideas how to read properly an .xlsx file from blob storage as an input?任何想法如何从 blob 存储中正确读取 .xlsx 文件作为输入?
Turns out, except string
, byte[]
is supported.事实证明,除了string
, byte[]
是受支持的。 Therefore I could be able to read and open my file.因此,我可以读取和打开我的文件。 Azure documentation does not mention it yet. Azure 文档尚未提及它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.