Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Showing RTF-content in QlikView

I have some information stored as RTF/blob/image (I do not have the exact word for it) and have come this far in extracting the information in a visible format:



CONVERT(Varchar(8000),CONVERT(BINARY(8000),Notebook))

This gives me the following result for example:

{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}}
{\colortbl\red0\green0\blue0;}
\deflang1053\pard\plain\f2\fs20 Talked about or products. Intererested client.
\par }

Is there a way to get it more visible? Or cleaned out of formatting.

I have tried the "Blob viewer" and Info-field instead, but no proper result there...

Kind regards

Niklas Hedborg

4 Replies
Not applicable
Author

Nik,

Here is what you want to do to laod image:

1. Define Image Key and Image path in the data source (inline/excel/rdbms...)

2. INFO LOAD to QV table

3. Add the image reference in a text box with display type 'Image'.

A pseudo code:

Photos:

INFO LOAD

xxx as Image_Key,

yyy as Image // image path

FROM qqq.qvd (qvd);

-----Layout-----

In the text Box (Presentation - Image):

In Place of Text:

='qmem://Image_Key/'&Image_Key

Hope this will help u.

-Arun

Anonymous
Not applicable
Author

Arun,

Thank you for your advice and it works really well for an image-image.

My problem is that the field type (called Notebook) in the database is indeed "image" but the content is binary RTF (rich text format).

(I am probably using words that I do not really understand Embarrassed)

So the only thing that pops out of the info-field is "links" similar to this one:

qmem://<6>/<145>

No images, no RTF-documents, no texts...

With


CONVERT(Varchar(8000),CONVERT(BINARY(8000),Notebook)) AS ShowMeWhatsStoredInThisField


I can att least get some text information that I can put and paste into Notepad and saves as .rtf and voila I can open a nice formatted document, but unfortunately that is not really what I want...

Kind regards

Niklas

marcel_olmo
Partner Ambassador
Partner Ambassador

Hi Arunpaduva, I'm trying to do the same but with no result. What I'm doing wrong?

Here's my post :

http://community.qlik.com/message/679796#679796

Regards, Marcel.

Not applicable
Author

Hi All,

I am beginner with QlikView and I had to face a challenge of extracting the plain text by parsing  RTF/RichText. Seems to be an easy problem and the solution is even easier ,but it took me some time to arrive at the solution, hence i would like to share it with the community. 

I created a custom function in QlikView  by writing a JScript  in the Edit Module (CTRL +M) space. The function is as shown below

function convertToPlain(rtf)

{

    rtf = rtf.replace(/\\par?/g, "");

    return rtf.replace(/\{\\[^{}]+;\}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?|[{\\\*}]/g, "");

}

All this function does is replaces the string which matches the regex expression marked in bold with a empty string  "" . I am sure that some of you can write a better Regex Expression, but this was the one which worked for me(there are lot of posts where you find different regex expression which might work for you but you need to do thorough testing). You can use websites such as https://regex101.com/‌ to build your own Regex Exp and test it.

Now all  you have to do is to call this function in your load script as shown below

Load  convertToPlain(<YourRTFColumn>) from <YourSource>;

Please feel free to contribute if you think there is a better way to do it or someone wants to add on to this.