【发布时间】:2020-09-06 16:51:48
【问题描述】:
我正在将 Word 文档转换为 varbinary 并将其保存到 SQL Server 数据库。我可以保存数据。我想将上传的 Word 文档显示给用户,就像简历在 Word 中的样子一样,就好像实际的 Word 文档嵌入在网页本身中一样。
我有以下代码,它将保存的 Word 文档下载为 Word 文件。请告诉我哪个是在浏览器中显示 word 文档的最佳控件。
byte[] fileContent = new byte[fuResume.PostedFile.ContentLength];
fuResume.PostedFile.InputStream.Read(fileContent, 0, fuResume.PostedFile.ContentLength);
//lblAppliedMessage.Text = ByteArrayToString(fileContent);
//lblAppliedMessage.Text = BitConverter.ToString(fileContent).Replace("-", string.Empty);
byte[] btYourDoc;
btYourDoc = fileContent;
Response.ContentType = "application/ms-word";
Response.AddHeader("Content-Disposition",
"inline;filename=yourfilename.doc");
Response.BinaryWrite(btYourDoc);
Response.End();
【问题讨论】:
标签: asp.net sql-server ms-word