小编Jay*_*ash的帖子

如何使用 .NET 从 URL 读取 docx 文件

我想在.NET core 2.2框架中使用Web HTTP请求读取word文件的内容。

我尝试了以下代码:

// Create a new WebClient instance.
using (WebClient myWebClient = new WebClient())
{
    // Download the Web resource and save it into a data buffer.
    byte[] myDataBuffer = myWebClient.DownloadData(body.SourceUrl);

    // Display the downloaded data.
    string download = Encoding.ASCII.GetString(myDataBuffer);
}
Run Code Online (Sandbox Code Playgroud)

输出: 在此输入图像描述

无法从 URL 读取 .docx 文件的内容。如何在没有任何付费库或使用 HTTP Web 请求的情况下读取 docx 文件。

c# openxml-sdk asp.net-core

1
推荐指数
1
解决办法
3479
查看次数

标签 统计

asp.net-core ×1

c# ×1

openxml-sdk ×1