We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert Byte Array to String

Hi,

We are having issue while reading the bytes from the document created using aspose and convet that to string.

This Code Works:

byteArray = System.IO.File.ReadAllBytes(Docpath) --> Normal word Document without Aspose

byteString = System.Text.Encoding.UTF8.GetString(byteArray);

Below code is not working:

Document doc = new Document(Docpath) // Using Aspose

/* Lock the document */

doc.Protect(ProtectionType.ReadOnly);

/*Save the document back */

doc.Save(docPath);

Now read the bytes and convert to string:

byteArray = System.IO.File.ReadAllBytes(Docpath) --> Aspose word Document

byteString = System.Text.Encoding.UTF8.GetString(byteArray); --> Not Working

Can you please assist?

Thanks,

Hari

Hi Hari,

Thanks for your inquiry. I was unable to reproduce this issue on my side. Please upgrade to latest version of Aspose.Words i.e. 13.4.0 and let us know how does it go on your side? You can download it from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

In case the problem still remains, please create/attach a simple ConsoleApplication that helps me in reproducing the same problem on my side. I will investigate your issue further on my end and provide you more information. Thanks for your cooperation.

Best regards,