NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: joep on January 10, 2018, 06:25:50 AM

Title: xml string not resulting in an correct word document
Post by: joep on January 10, 2018, 06:25:50 AM
Hi There,
I have build a webservice which recieves xml's containing images, word ducuments and pdf's.
In my code I decode the base64 encoded string and save it as blob in the database:
     If Clip(fo:data)
         LenCoded = len(clip(fo:data))
         Clear(StringDecoded)
         str.SetValue(Clip(StringDecoded))
       NetBase64DecodeEx(fo:data,StringDecoded,LenCoded)
         str.SetValue(Clip(StringDecoded))
       str.ToBlob(Upl:ImageBlock)       
     END
When I save this later to a file from the database only images show themselves correctly.
The pdf and the word document are complaining about damaged content.
If I click a few times in word, word resolves this problems and shows correctly afterall.
If I take the strings out of the xml and feed them to an bas64 decode website tool they both show correctly.
Can someone tell me what I'm doing wrong?
Regards Joep
Title: Re: xml string not resulting in an correct word document
Post by: Bruce on January 10, 2018, 10:20:20 PM
Hi Joep,

Let's start by simplifying the code a bit;
Make sure you are using the latest stringtheory.

str.SetValue(clip(fo:data))
if str.Length()
  str.Base64Decode()
  str.ToBlob(Upl:ImageBlock)
end

cheers
Bruce

Title: Re: xml string not resulting in an correct word document
Post by: joep on January 12, 2018, 01:39:24 AM
Hi Bruce,

It works.
I got to use more StringTheory.

Thanks again,
Joep