9

From within my (2011 SP1) TBB I need to know when a TextField object is rich text or plain text so I can process the contents differently, but I dont see any simple way to find this out. Is this possible without going into the schema XSD?

1 Answer 1

12

You could check to see if the ItemField type is a XhtmlField.

if (itemField is XHtmlField)
{
    // Is Rich Text Field
} 
else if (itemField is TextField)
{
    // Is Text Field
}
else
{
    ...
}
2
  • +1! I'd never noticed this ItemField subclass - probably because it's at the bottom of the list. I was poking around in MultiLineTextField and MultiLineTextFieldDefinition for a property of some kind to find an answer to this :) Apr 29, 2013 at 15:35
  • Thanks Alex - exactly what I was looking for, very relieved its so simple.
    – Will Price
    Apr 30, 2013 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.