I have an Announcements list. In my view I am returning the body. When displaying the body field in a list web part, the body field is being truncated and '...' is added to the end. When viewing the view not in a web part the '...' is not added. How can I get the list part view not to truncate the data?

  • Can you clarify what is "list web part"? I'm adding Announcements to a webpartpage, when modifying view - adding the body field - and then I can see all the contents of the field, even if it is huge. It is not being truncated. – Andrey Markeev Nov 3 '11 at 12:16
  • I am using Lists and Libraries > My list name (It has a megaphone next to it) – John Nov 3 '11 at 13:25

So you're using <Summary view>:

enter image description here

To get full descriptions, just select "All items" view from webpart properties:

enter image description here

, and add the Body column using "Modify view" ribbon button:

enter image description here

However, if it doesn't satisfy your needs (because "All items" view looks like a table), you will need some additional XSLT coding.

Creating analogue for summary view with uncut Body field

First of all, ensure that Announcements list is currently displayed in "table" mode, and Body and Created by fields are added into the view.

Open the page in SharePoint designer, switch to Code tab, and add <Xsl> tag to the XsltListViewWebPart markup.

Finally, paste the following code to the <Xsl> tag:

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office"> 

    <xsl:include href="/_layouts/xsl/main.xsl"/>
    <xsl:include href="/_layouts/xsl/internal.xsl"/>

    <xsl:template match="/">
          <xsl:when test="$RenderCTXOnly='True'">
            <xsl:call-template name="CTXGeneration"/>
          <xsl:when test="($ManualRefresh = 'True')">
            <xsl:call-template name="AjaxWrapper" />
            <xsl:apply-templates mode="RootTemplate" select="$XmlDefinition">
                <xsl:with-param name="ShowSelectAllCheckbox" select="false"/>

    <xsl:template mode="header" match="FieldRef" />

    <xsl:template mode="Item" match="Row">

        <xsl:param name="Fields" select="."/>
        <xsl:param name="Collapse" select="."/>
        <xsl:param name="Position" select="1" />
        <xsl:param name="Last" select="1" />
        <xsl:variable name="thisNode" select="."/>
          <td width="80%" class="ms-vb" style="padding-bottom: 3px">
            <span class="ms-announcementtitle">
              <a onfocus="OnLink(this)"
                 onclick="GoToLink(this);return false;" target="_self">
                <xsl:value-of select="$thisNode/@Title"/>
              <xsl:if test="$thisNode/@Created_x0020_Date.ifnew='1'">
                <xsl:call-template name="NewGif">
                  <xsl:with-param name="thisNode" select="$thisNode"/>
              <xsl:call-template name="FieldRef_Attachments_body">
                <xsl:with-param name="thisNode" select="$thisNode"/>
              <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            <br />
            <xsl:value-of select="'by'"/>
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            <xsl:value-of disable-output-escaping="yes" select="$thisNode/@Author.span"/>
          <td width="20%" align="right" nowrap="nowrap" class="ms-vb">
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            <xsl:value-of select="$thisNode/@Modified"/>
          <td colspan="2" class="ms-vb">
              <xsl:value-of select="$thisNode/@Body" disable-output-escaping ="yes"/>
            <!-- output the remaining fields -->
            <xsl:for-each select="$Fields[not(@Name='LinkTitle' or @Name='Modified' or @Name='Author' or @Name='Body' or @Name='Attachments')]">
              <br />
              <xsl:value-of select="@DisplayName"/>:
              <xsl:apply-templates select="." mode="PrintFieldWithDisplayFormLink">
                <xsl:with-param name="thisNode" select="$thisNode"/>
          <td colspan="2">
            <font size="1">
              <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>



You will get exactly the same view as Summary view, but with uncut description.

Looks a bit complicated, huh? :) Actually mostly it's a copy-paste from OOTB SharePoint vwstyles.xsl file, with some pointed corrections. Creating this XSLT only took about 10 minutes.


As far as I have seen this is a built in setting in SharePoint that I don't think can be easily changed. Some body fields could have thousands of words because of the field type. I could only suggest creating a custom page if you wanted to display all the contents of the body field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.