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?

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
{
    ...
}
  • +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 :) – David Forster Apr 29 '13 at 15:35
  • Thanks Alex - exactly what I was looking for, very relieved its so simple. – Will Price Apr 30 '13 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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