In DXL is there an easy way to identify whether object text contains any formatting, e.g words bolded, subscripted, italic, etc |
Re: Identifying Formatted Items in Object Text There's no doubt a better way, but you may need to find each richtext chunk and query it for each and every formatting option. Didn't try this, but it may get you started.
bool HasRichTextFormatting(string Text)
{ // Does the text contain rich text chunks?
if (null Text or
!isRichText(Text)) return(false) // bad input
RichTextParagraph rtp
RichText rt
for rtp in Text do
{ for rt in rtp do
{ if (rt.bold) return(true)
if (rt.italic) return(true)
if (rt.newline) return(true)
if (rt.strikethru) return(true)
if (rt.subscript) return(true)
if (rt.superscript) return(true)
if (rt.underline) return(true)
} // end for rt
} // end for rtp
return(false) // No formatting found
} // end HasRichTextFormatting(Text)
bool HasRichTextFormatting(Object obj, string NameAttr)
{ // does the obj-attr have rich text formatting?
if (null obj or null NameAttr) return(false) // bad input
string Text = probeRichAttr_(obj, NameAttr)
return(HasRichTextFormatting(Text))
} // end HasRichTextFormatting(Obj, Attr)
Object oCurr = current
print (identifier(oCurr)) "\thas rich text? " (HasRichTextFormatting(oCurr, "Object Text")) "\n"
|