I have a list called Introducing and the list has a column called Body. Body has a type of multiple lines of text.
One of the list views displays the Title and Body columns. There are entries that have a lot of content in the Body column. To make it look tidy and clear, we’d like to only display the first 200 characters of the content and use “…” to indicate more content.
- Open up the site in SharePoint Designer.
- From the left Site Objects panel, select Lists and Libraries. In the middle of the page, choose the list that you want to manipulate.
- To make sure that I don’t mass up with other views, I created a new view in the Views pane called Short.
- Click on Short view to open it up.
- Optional step. (On the Option tab in the Ribbon, click Add/Remove Columns to choose the columns that you want to display in this view. )
- On the top Ribbon, click on the Home tab->Advanced Mode. Note: you need to be the site collection administrator to have this option enabled.
- Go to the Design tab->Customize XSLT->Customize Entire View
- Change the display to Split and click on the Body content, not the Title field. The code of the content should be highlighted in the editor. The code looks like this <xsl:value-of select=”$thisNode/@*[name()=current()/@Name]” disable-output-escaping=”yes”/>
- Replace the above code with: <xsl:value-of select=”substring($thisNode/@*[name()=current()/@Name], 1, 200)” disable-output-escaping=”yes”/><xsl:if test=”string-length($thisNode/@*[name()=current()/@Name]) > 200″>…</xsl:if>
- Save the changes.
- Ctrl+F to bring up the Find and Replace window. Navigate to the Replace tab.
- In the Find what box, type in ddwrt:ghost=”hide”, replace it with empty string. Yes, we want to get rid of this. It prevents you from editing them.
- Save and see the view in the browser.