[OfficeUtils] Word export corrupted (possibly due to special characters)

[OfficeUtils] Word export corrupted (possibly due to special characters)

  
Forge Component
(24)
Published on 2017-04-26 by Elena Novozhilova
24 votes
Published on 2017-04-26 by Elena Novozhilova

I am creating a document that pulls data from an Oracle DB, with the columns set to NVARCHAR2. I use the LISTAGG function in custom SQL to concatenate the data into a single value (name, title, phone, email). The data was entered by international employees using who knows what kind of keyboard.

When I download the file and open it in Word, I get an "Illegal XML character" (see photo). I open the 'document.xml' and find a strange character inserted in between every character of the LISTAGG value. 

Not sure if this is an OfficeUtils problem, but I did find a solution. Instead of using the LISTAGG in my custom SQL, I query the 4 columns and use either:

  1. A loop widget to run through the rows of the query and concatenate them together into a Text variable, then assigning the variable to the Word_Export_SetText / Text argument.
  2. the String_Join function in the Word_Export_SetText  / Text argument. I pass in the custom SQL output to this function.