Page 1 of 1
Empty RichView
Posted: Fri Jul 29, 2011 8:15 pm
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
Posted: Sat Jul 30, 2011 7:11 am
by Alexander_Dober
Posted: Sat Jul 30, 2011 8:55 am
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)=''))
Posted: Tue Aug 02, 2011 11:04 am
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?
Posted: Wed Aug 03, 2011 5:27 pm
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)