开发者

how to convert binary array to word format and display it to textarea using c#

I have binary stored in database. Now I开发者_StackOverflow中文版 want to convert it to a word doc. I have tried with ASCII encoding but it adds some special characters or symbols in between and doesn't look good.

For example I have resumes in doc and I have saved them in an sql database in binary[] format. Now what I want is to convert that binary to word compatible format and display it in an editor/textarea.


A Word .doc document is not a text file. It contains lots of binary data, the stuff that keeps track of styles, fonts, paragraph formatting, etcetera, etcetera. Which is the junk you see. You cannot realistically read such a file yourself, or for that matter display the document accurately, you have to use Word. You can automate it with the classes in the Microsoft.Office.Interop.Word namespace.

An intermediary solution is to store Word documents in the RTF file format. As long as the formatting doesn't get too fancy, a RichTextBox can display it accurately. Storing it in a dbase column isn't hard either, it is text.


Word document is pretty much Proprietary and closed format, operating with meaning there is no such an interface to pass an array of bites that word understands and get a string out of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜