protected HSSFRichTextString escapeColumnValue(final Object rawValue){
  if (rawValue == null) {
    return null;
  }
  String returnString=ObjectUtils.toString(rawValue);
  returnString=StringEscapeUtils.escapeJava(StringUtils.trimToEmpty(returnString));
  returnString=StringUtils.replace(StringUtils.trim(returnString),"\\t","    ");
  returnString=StringUtils.replace(StringUtils.trim(returnString),"\\r"," ");
  returnString=StringEscapeUtils.unescapeJava(returnString);
  returnString=removeHtmlTagsAndSpaces(returnString);
  return new HSSFRichTextString(returnString);
}

protected HSSFRichTextString escapeColumnValue ( final Object rawValue ) { if ( rawValue == null ) { return null ; } String returnString = ObjectUtils . toString ( rawValue ) ; returnString = StringEscapeUtils . escapeJava ( StringUtils . trimToEmpty ( returnString ) ) ; returnString = StringUtils . replace ( StringUtils . trim ( returnString ) , "\\t" , "    " ) ; returnString = StringUtils . replace ( StringUtils . trim ( returnString ) , "\\r" , " " ) ; returnString = StringEscapeUtils . unescapeJava ( returnString ) ; returnString = removeHtmlTagsAndSpaces ( returnString ) ; return new HSSFRichTextString ( returnString ) ; }
escape certain values that are not permitted in excel cells .
