Empty RichView

General TRichView support forum. Please post your questions here
Post Reply
BennieC
Posts: 28
Joined: Sat Jun 18, 2011 7:00 pm

Empty RichView

Post by BennieC »

How can I determine if a Richview document is empty of any characters, excluding control characters. I need to know if there are any visible characters in a document. Checking for no characters may result in counting control characters.
Bennie
Alexander_Dober
Posts: 130
Joined: Fri Mar 04, 2011 3:44 am

Post by Alexander_Dober »

Hi Bennie,

maybe this will help you:

http://www.trichview.com/forums/viewtop ... view+empty
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRichView does not use control characters. Even line break characters (#13 and #10) are not stored.
An empty formatted editor contains one empty text item, so the check is:
IsEmpty := (rv.ItemCount=0) or ((rv.ItemCount=1) and (rv.GetItemStyle(0)>=0) and (rv.GetItemText(0)=''))
Alexander_Dober
Posts: 130
Joined: Fri Mar 04, 2011 3:44 am

Post by Alexander_Dober »

When working with DBRichViewEdits the content is saved in blobfields and sometimes it's necessary to check for "empty RichView content" without a RichView but based on the corresponding blobfield.

What would be the best way to do so? Save the blobfield to a stream, create a RichView, load from stream and then check like showed here?

Code: Select all

IsEmpty := (rv.ItemCount=0) or ((rv.ItemCount=1) and (rv.GetItemStyle(0)>=0) and (rv.GetItemText(0)=''))
Or is there a better way?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, if you do not want to parse RVF yourself
(RVF specification - http://www.trichview.com/help/rvf_specification.html
Detecting if RVF contains item-records other than one empty text item is not very difficult, but still requires some efforts)
Post Reply