trichview.com

trichview.support




Re: Has a RichViewEdit content / text


Return to index


Author

Message

Pieter E.

Posted: 10/14/2004 20:15:06


I've tried the following code (C++):


bool bEmpty;


bEmpty = (RichViewEdit1->ItemCount == 0) ||

                ((RichViewEdit1->ItemCount == 1) &&

                (RichViewEdit1->GetItemStyle(0) == 0) &&

                (RichViewEdit1->GetItemText(0).Trim() == "") &&

                (RichViewEdit1->GetItemStyle(0) >= 0) &&

                (RichViewEdit1->GetItemPara(0) == 0));



if(bEmpty == true) Caption = "RichViewEdit is empty";

else Caption = "RichViewEdit isn't empty";

//---------


It doesn't work when I copy an Image, table and text from MS Word with CTRL+C

to RichViewEdit. And then delete the text from RichViewEdit.


What I want is as follow:


I want to save documents automatic. But I don't want to save empty documents.

With empty documents I mean: no visible text, images, tables, etc..


In the past I used RichEdit. I used the following code:


if(RichEdit1->Text.Trim() != "") Bla, Bla, savemyfile...;



Thanks.


Pieter E.


"Sergey Tkachenko" <[email protected]> wrote:

>IsEmpty := (RichViewEdit1->ItemCount==0) ||

>  ((RichViewEdit->ItemCount==1) && (RichViewEdit->GetItemStyle(0)==0) &&

>   (RichViewEdit->GetItemText(0)=="") && (RichViewEdit->GetItemPara(0)==0));

>

>Checking for (RichViewEdit->GetItemStyle(0)==0) &&

>(RichViewEdit->GetItemText(0)=="") may be replaced with

>(RichViewEdit->GetItemStyle(0)>=0). It depends on what do you mean by "empty

>document". The initial code assumes that document with modified text and

>paragraph attributes is not empty, even if contains no text and other

>content.

>

>

>>

>> Before I save a document I'd like to know if the document is completely

>empty.

>> I don't want to save empty documents.

>>

>

>





Powered by ABC Amber Outlook Express Converter