Pregunta

I am trying to read a Word Doc in C#, and then display the result in a textbox. But I don't want to read just the text, but instead read the whole file, special characters included. I need it to exactly match the results shown when I open the same file in Notepad.

I've achieved the closest results by using StreamReader. Note that you have to follow the instructions in this link in order to display any result. However, the result is still not 100% correct - some of the characters are interpreted (?) differently than if I opened the Doc directly in Notepad. Any thoughts on how to approach this?

¿Fue útil?

Solución

Might depend on the enconding of the text: msdn.microsoft.com/en-us/library/system.text.encoding.aspx e.g.: Encoding.ASCII.GetString(text); using the example from your link.

Just posting this as it seemed to have helped in the end :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top