Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3945902
By: boly38
it's OK, i found an alternate way to display string values starting with a
special
char :
=> by replacing <value> to ="<value>".
In JSP, i declare a decorator like this :
---
<display:column title="MyColumn" property="val"
decorator="com.blahblahblah.util.StringExcelExportDisplayTagWrapper"/>
And this is the source of my decorator
(StringExcelExportDisplayTagWrapper.java):
---
import java.util.regex.Pattern;
import javax.servlet.jsp.PageContext;
import org.apache.log4j.Logger;
import org.displaytag.decorator.DisplaytagColumnDecorator;
import org.displaytag.exception.DecoratorException;
import org.displaytag.properties.MediaTypeEnum;
public class StringExcelExportDisplayTagWrapper implements
DisplaytagColumnDecorator
{
final static Logger log =
Logger.getLogger(StringExcelExportDisplayTagWrapper.class);
public Object decorate(Object columnValue, PageContext pageContext,
MediaTypeEnum
media) throws DecoratorException {
String s = (String) columnValue;
if ((s != null) && s.length()>0) {
if (!Pattern.matches("[a-zA-Z]", s.substring(0,1))) {
log.debug("decorate(...) : Cell [" + s + "]
contain special char => replaced
by [=\"" + s + "\"]");
s = (Object) "=\"" + s + "\"";
}
}
return s;
}
}
Regards
Boly
______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:
https://sourceforge.net/forum/unmonitor.php?forum_id=249318
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user