在一个colume 里,文字上有链接,如:<a href="....">内容</a>,在输出到excel中时,我只想得到“内容”二字,各位有什莫办法吗?

解决方案 »

  1.   

    把取得的字符串截掉你不要的塞。
    String test = "<a herf="adfasd">testme</a>";
    String temp = "";
    int position = test.indexOf(">");
    temp = test.subString(position+1);
    position = test.indexOf("<");
    temp = temp.subString(0, position); ///temp is testme now
    不知道是不是楼主的意思。
      

  2.   

    LZ如何将URL也导入进去的呢 想学习
      

  3.   

    呵呵,怪我没说清楚。我在页面输出表格时使用了displaytag这个库,它可以将整个表格输出成excel表保存,如下:
    <display:table name="${userList}" cellspacing="0" cellpadding="0"
        requestURI="" defaultsort="1"
        pagesize="2" styleClass="list" export="true">
      
        <display:column property="username" sort="true" 
         headerClass="sortable" width="20%"
            url="/admin/editUser.html?from=list" 
            paramId="username" paramProperty="username"
            titleKey="user.username"/>
        <display:column property="firstName" sort="true" 
         headerClass="sortable" width="25%"
            titleKey="user.firstName" />
        <display:column property="userinf" sort="true" headerClass="sortable" 
         width="31%"  titleKey="user.userinf"><a href="http://www.aa.com/bb.jsp">详情</a></display:column>    <display:setProperty name="export.excel.filename" value="User List.xls"/>
    </display:table>这时,表格下方会出现输出为excel的按钮,点击就会将表格保存为excel表格,但他会将单元格内所有的内容都转到excel中去,如最后一个单元格<a href="http://www.aa.com/bb.jsp">详情</a>,而我只想要“详情”二字,各位有没有什么好办法?
      

  4.   

    如果使用的是1.1版本,需要在displaytag.properties中配置excel的部分添加下面语句:export.excel.class=org.displaytag.export.excel.ExcelHssfView