Share via


Trim the text in the multiple line of text field in a list and add a tool tip using SharePoint Designer 2007 (en-US)

  1. This is the sample list which is currently displaying full text from multiple lines of text field “Remarks"

http://1.bp.blogspot.com/-NOyuRN9AhdQ/TjPfKNoWGFI/AAAAAAAAC38/dIjd6orZgt8/s400/1.png

2. Open the site in SharePoint designer, navigate to the list default view page. (In this example we are using AllItems.aspx page)

3. Right-click the List View Web Part and select “Convert to XSLT Data View”. This will automatically convert settings for the current view into data view parameters.

http://3.bp.blogspot.com/-cNa1lVbvX-8/TjPfMfVfZDI/AAAAAAAAC4A/dxIyxIrzDuw/s400/2.png

4. After converting to XSLT, select the remarks field and switch to code view, you will see the code to display the remarks field as below

<TD Class="{$IDAWNV5H}"><div dir="{ddwrt:GetVar('Direction')}">
<xsl:value-of disable-output-escaping="yes" select="@remarks" />
</div></TD>

 We need to change the above line of code as below:

<TD Class="{$IDAXNQ1G}" style="height: 22px">
<div dir="{ddwrt:GetVar('Direction')}" title="{@remarks}">
<xsl:choose >
<xsl:when test="@remarks != ''" >
<xsl:value-of disable-output-escaping="yes" select='concat((substring(@remarks,1,20)),"...")' />
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="@remarks" />
</xsl:otherwise>
</xsl:choose>
</div></TD>

 5. Save the file. Now you will see the trimmed text in the default view page:

http://1.bp.blogspot.com/-yy_kY7_9AN4/TjPkNJpJZTI/AAAAAAAAC4I/f2k2DP8iD5Q/s400/3.png