How to skip ONLY an OLE object in an Object Text?

I am trying to add "objID" in front of each Object Text. However, I had to search for the string "objID" before placing the string.

If the object contains only OLE object, I donot want to search for the string in an object Text which ONLY contains OLE, and I want to skip the OLE objects to speed up the process. Otherwise it takes long time searching for "objID" in a OLE object.

In order to skip the OLE objects, I used chunking. Here is an example:

ot = richTextWithOle(o.TEXT_ATT) // load object text
// print ot "\n"

if (!null(ot)) //check object text is not empty
{
for rt in ot do
{
if(rt.isOle)
{
hasOLE=true
break
}
}
if(!hasOLE)
{
........
}
}
However, this method back fires when an object Text has a text paragraph with an OLE object (algorith formula). And I donot want to skip this object because it has text paragraph.

Is there any other way to avoid ONLY an OLE object WITHOUT any text.

Any suggestion is apprecited.

FZ
faisal.zahidi@boeing.com - Thu Jul 01 22:24:01 EDT 2010

Re: How to skip ONLY an OLE object in an Object Text?
faisal.zahidi@boeing.com - Thu Jul 01 22:26:00 EDT 2010

There is a square bracket before and after ObjID string.

Re: How to skip ONLY an OLE object in an Object Text?
a_vestlin - Fri Jul 02 02:30:58 EDT 2010

I'm not sure if I understand what you try to do, but this function will check if a string only contains OLE and nothing else. Note that blank links are ignored.

bool onlyOle(string s)
{
    RichText rt
    bool b
    
    b = false
    for rt in s do
    {
        if ( !rt.isOle )
        {
            return(false)
        }
        b = true
    }
    return(b)
}


/Anders

Re: How to skip ONLY an OLE object in an Object Text?
Mathias Mamsch - Fri Jul 02 06:02:43 EDT 2010

I would differentiate between searching the text and adding the objID string. You can use obj."Object Text" (without any richText) and findPlainText to search if the string is already present and if not get the richTextWithOle and add the text.

I guess normally most objects will already have the objID so this will speedup searching a lot.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS