如何只读取二进制数据中的文本。 [英] How to read only text from the binary data.
问题描述
我将doc文件作为二进制数据上传到数据库,
现在我想从二进制数据中读取文本,再次编辑并保存到数据库。
如何实现这一点,
请建议。
我尝试过:
MemoryStream mm = new MemoryStream((byte [])[Column Name]);
string htmlWebPageRow = Encoding.GetEncoding(65001).GetString(mm.ToArray());
Editor1.Text = htmlWebPageRow.ToString()。Trim();
Hi,
I was uploaded the doc file to data base as binary data,
now i want to read the text from the binary data, edit and save to database again.
How to achieve this,
please suggest.
What I have tried:
MemoryStream mm = new MemoryStream((byte[])["Column Name"]);
string htmlWebPageRow = Encoding.GetEncoding(65001).GetString(mm.ToArray());
Editor1.Text = htmlWebPageRow.ToString().Trim();
推荐答案
您不能将.doc文件直接转换为字符串。
但是你使用以下库之一来读取.doc文件中的文本数据
1. 欢迎使用适用于Microsoft Office的Open XML SDK 2.0 [ ^ ]
2. 用于DOC DOCX RTF HTML PDF EPUB的C#.NET Word文档处理API [ ^ ]
希望,有帮助:)
You can't convert a .doc file directly to string.
However you make use of one of the following library to read text data from a .doc file
1. Welcome to the Open XML SDK 2.0 for Microsoft Office[^]
2. C# .NET Word Document Processing API for DOC DOCX RTF HTML PDF EPUB[^]
Hope, it helps :)
这篇关于如何只读取二进制数据中的文本。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!