Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

2 Answers

up vote 4 down vote accepted

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

    <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="."/>
        <tr>
          <td width="80%" class="ms-vb" style="padding-bottom: 3px">
            <span class="ms-announcementtitle">
              <a onfocus="OnLink(this)"
                 href="{$FORM_DISPLAY}&amp;ID={$thisNode/@ID}"
                 onclick="GoToLink(this);return false;" target="_self">
                <xsl:value-of select="$thisNode/@Title"/>
              </a>
              <xsl:if test="$thisNode/@Created_x0020_Date.ifnew='1'">
                <xsl:call-template name="NewGif">
                  <xsl:with-param name="thisNode" select="$thisNode"/>
                </xsl:call-template>
              </xsl:if>
              <xsl:call-template name="FieldRef_Attachments_body">
                <xsl:with-param name="thisNode" select="$thisNode"/>
              </xsl:call-template>
              <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            </span>
            <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>
          <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>
        </tr>
        <tr>
          <td colspan="2" class="ms-vb">
            <div>
              <xsl:value-of select="$thisNode/@Body" disable-output-escaping ="yes"/>
            </div>
            <!-- 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"/>
              </xsl:apply-templates>
            </xsl:for-each>
          </td>
        </tr>
        <tr>
          <td colspan="2">
            <font size="1">
              <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            </font>
          </td>
        </tr>

    </xsl:template>

</xsl:stylesheet>

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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