We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

junk characters as string while reading from streamreader

Hi  all,
I am not able to download the file using chrome (notwork error). I understand it can happen due to security settings in chrome. So, I am saving the file  to database and retrieving from the DB. But  when saving the created document to memorystream and then reading from it, I see a bunch of junk characters.

here are the stops:
1. create document object through createdoc method.
2. Load it into memorystream:

Dim stream As New System.IO.MemoryStream()

objWordDocument.Save(stream, Syncfusion.DocIO.FormatType.Docx)


3.get the binary data :

        Dim b() As Byte
        Using br As New System.IO.BinaryReader(stream)
            b = br.ReadBytes(stream.Length)
        End Using

save into database and retrieve it. But it has junk characters. Please help.

          Dim Response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
            Response.ClearContent()

            Response.ContentType = "application/Doc"
            Response.BinaryWrite(attachmentInfo)


This one has the junk characters.

Thanks a lot.

Anandi





End Using


How can I


1 Reply

VR Vijay Ramachandran Syncfusion Team January 6, 2017 01:36 PM UTC

Hi Anandi,

Thank you for contacting Syncfusion support.

We are unable to reproduce the mentioned issue with the given details. Please find the sample which we have used at our end to test the given scenario.
http://www.syncfusion.com/downloads/support/forum/128165/ze/GenerateWord-DocIOApplication1546926520.zip

In that sample we have done the following things:
   1. Created Word document and saved as a memory stream using DocIO.
   2. Inserted that memory stream as byte array into the Data base.
   3. Retrieved the binary data from the database and it downloaded as a Word document in a web browser.

Kindly use the above sample to meet your requirement, if you are still facing the issue then kindly provide us your sample or modify the above sample along with the following details.
   1. Provide the input Word document and Data base details which you are used in your sample
   2. Provide screen shots of your current output (highlight the junk characters) and expected output.

So, that we can analyze further and provide you the possible solutions as much early as possible


Let us know if you have any concern.

Regards,
Vijay R
 


Loader.
Live Chat Icon For mobile
Up arrow icon