1

I have uploaded my MS word file in Database in binary format. I am able to retrive it back. But I am planning to open up the word file in read only mode. I have done much operations on the file which I have stored in databse like trackrevisions,protection etc. Now I just want only one thing to happen. I want to convert the binary data efficiently back to text(string) which was origianlly stored in the database. Here are some ways I am trying to get text back from binary but all of them return symbols(format not supported) rather than text.

string str1 = System.Text.ASCIIEncoding.ASCII.GetString(bytes);
string x = Encoding.ASCII.GetString(bytes).ToLower();

Any suggestions

3
  • Why are you trying to convert it to a string? Commented Jan 10, 2013 at 11:22
  • 1
    You saved a MS Word file. Why do you expect you can convert the binary data to text? Commented Jan 10, 2013 at 11:24
  • @ThorstenKranz : the problem is I have applied trackrevisons on the file which i stored in DB. But I was unable to convert MS Word file to pdf, so I am trying to display it in read only mode.But now when I retrieve it I can edit it. Commented Jan 10, 2013 at 11:28

2 Answers 2

1

MS Word files are not "plain text". You cannot read them by merely using a text decoder.

Sign up to request clarification or add additional context in comments.

Comments

0
  1. Making a Word document read only is something you do before saving it (Word.Document.Protect())
  2. If you are using .docx - it is xml, therefore already text (utf8)

1 Comment

yes kevin, I did it already but that was while uploading it in DB. Now I want to rule out the changes and put new readonly protection , previously i had put Only revisions chanages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.