Link to home
Start Free TrialLog in
Avatar of johnsheen
johnsheen

asked on

Richtext in a Listview

Hi All,

Got a Question! I have richtext boxes on a form that accept unicode characters such as the Ù symbol as well as ordinary Characters (A standard RichtextBox).

I send the Data to a database for storage. All selections of text sent to the database in RTF format.

I display the various information a a listview. But when bringing out the RTF the Text comes out all coded for RTF. I need the actual text - basically can the Listview handle these characters? I can seem to work it.

Should there be a string conversion or what?

Or and API that will allow the Listview to display Richtext?

Thanks
Johnsheen
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Try use the ChrW() function ..
Avatar of johnsheen
johnsheen

ASKER

Doesnt Work. I rtfText format is stored in the Database an looks like this:

"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil\fcharset2 Symbol;}}"

I need what this string actually means in real text, without any of that Format shown above.

Have to display it in a Listview. Liske the Windows search Results listview - it can display characters that are in Richtext format.
I guess you've tried ListView1.Font = "Arial Unicode MS"
How about this approach:
Instead of using a RTB, what about a webbrowser in edit mode? You can do just about anything with a webbrowser that you can do with a RTB.
You then save the text (WebBrowser1.Document.All(0).innerText) to the database, and then retrieve it and send it to your ListView.
To make a webbrowser window editable use:

WebBrowser1.Navigate2 ("about:blank")
WebBrowser1.Document.designMode = "On"

If this doesn't work, let me know, since then there is more that can be done. (Basically, you use a dll to convert all the 'dodgy' characters into numeric entities, and save the text as ascii. Then it is a relatively simple matter to convert the numeric entities back into unicode. More on this if the above doesn't work.)

Kindest regards,
Rhaedes
Cant seem to get that working at all.

Is there a listview that can except UNICODE characters?

In my Desktop I created a new TextFile. I opened the CharMap and Copied the Ohms symbol a few times and copied and pasted it into the name of the New Textfile. This means that the textfile name has unicode characters.

When I open windows explorer I can see the Name of the NewFile displaying the Unicode Chars. I was thinking that the Windows explorer uses a Listview to display Files and folders. If the Listview in Win Explorer can display these characters then surely this can be setup for a listview in VB.

This is very important design feature for my app and has to be fixed... Any help would be really really important. If i can get a fix I am forever in debt to the expert that has helped...

Thanks..
Sorry to be the bearer of bad news, but Microsoft seems to be saying this is not possible:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconUnicodeCharacterDisplayInWFCProjects.asp
...But maybe you can find a thrid party control to overcome the problem. Here's one a quick google search turned up:
http://www.eldos.org/elpack/eltree.html
One final comment: What about creating/editing your own font? You could make a copy of say, Times New Roman or whatever, and then change some of the characters which you don't use into the Ohm symbol etc. To make this work you simply have to set the font property of your RTB and listview to the new font.

In fact you could probably copy most of the symbols you need from other fonts. 'W' in the symbol font is the Ohm, for example. All you need is a font editor.

Kindest regards,
Rhaedes
Just found out that the Listview used in the Windows Explorer has the SysListView32 Class. This is an extended class of the Listview.

What i need to do is implement these classes on the listview.

Any ideas on how I could do this?

The basic problem appears to be that the listview inherits from the Common Control Library. As I understand it, the recent versions of the comctl32.dll do support unicode, but the listview still won't accept the font. Your problem is the same as that of people who want to use, say, Japanese characters in a ListView, using a machine in English. As such, the problem is relatively common, but I can find no solutions on the net.

You could check out
http://www.developer.com/net/cplus/article.php/627681
and see if it is of any help, but in your situation I think that I would do one of the following:

1) Create an activeX control.
2) Create a new font (easiest?).
3) Re-install Windows in say, Japanese.
4) Use a third party control.
5) Simulate the functionality of the listview using other controls.

Kindest regards,
Rhaedes
johnsheen:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
johnsheen, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of YensidMod
YensidMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial