NetTalk Central

Author Topic: xml string not resulting in an correct word document  (Read 4344 times)

joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
xml string not resulting in an correct word document
« 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: xml string not resulting in an correct word document
« Reply #1 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


joep

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Email
Re: xml string not resulting in an correct word document
« Reply #2 on: January 12, 2018, 01:39:24 AM »
Hi Bruce,

It works.
I got to use more StringTheory.

Thanks again,
Joep