Home > other >  how to parse base64 string column to plain text to populate XRRichText?
how to parse base64 string column to plain text to populate XRRichText?

Time:09-22

what I am trying to achieve is to show in the xtrareport a plain text from a base64 string (or a byte array of an XML), this is the data that's saved to the db:

byte[] fileContents = System.Convert.FromBase64String(obj.column);
obj.rtf_handler = fileContents;

and what I have achieved instead is this long string of un-parsed(?) rtf content. So how do you parse the 64base string from obj.rtf_handler to a plain text in xtrareport?

CodePudding user response:

In DevExpress you can load RTF from a datasource but it seems that your base64 string representing a file and not its RTF content (which is similar to this).

A possible solution could be save your file using FileStream class and then read its RTF content using File.ReadAllText.

CodePudding user response:

After some research I have found that I needed to pass the value of the data as a string and then to base64 string and pass it to Memory Stream to get the file. Source: https://supportcenter.devexpress.com/ticket/details/t678278/xrrichtext-and-openxml

  • Related