3

I would like to create an announcement list webpart that shows the information vertically, without column names, like in this image I found googling:

Announcement web part

Information is being shown in a column style, date, title and body, and no titles, instead of the regular table layout that comes out of the box (shown in the links webpart under News).

Is it possible to do this without development or Designer? I am working in an "out of the box" environment.

Thank you.

1
  • Which version of SharePoint are you using?
    – Manu
    Jan 16, 2015 at 12:41

2 Answers 2

1

This can be done using content by query web part and XSL. See this for more info: http://sharepointnadeem.blogspot.com/2011/09/cqwp-xsl-customizations.html

CQWP style sheets are present inside a folder "XSL Style Sheets" in Style Library at the root site collection. ItemStyle.xsl file contains the style templates which can applied to the items returned by CQWP. The best practice to create custom styles is to make the copy of ItemStyle.xsl and make changes in it and then upload the new customized xsl file to the style library.

The following sample code shows the Title in bold font and first 200 characters of the Body field followed by ...Read More link.

<xsl:template name="CustomStyle" match="Row[@Style='CustomStyle']" mode="itemstyle">
  <xsl:variable name="SafeLinkUrl">
         <xsl:call-template name="OuterTemplate.GetSafeLink">
               <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
               <xsl:with-param name="UseFileName" select="1"/>
         </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="DisplayTitle">
         <xsl:call-template name="OuterTemplate.GetTitle">
               <xsl:with-param name="Title" select="@Title"/>
               <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
         </xsl:call-template>
  </xsl:variable>
  <p>
         <strong>
               <xsl:value-of select="$DisplayTitle"/>
         </strong><br />
         <xsl:value-of select="substring(@Body,0,200)" disable-output-escaping="yes"/>
         <a href="{$SafeLinkUrl}">...Read more</a>
  </p>
</xsl:template>
7
  • 1
    Please add more details to the post, link only answers should be avoided and in particular so when linking to your own blog Apr 7, 2014 at 8:25
  • Added more details to the answer Apr 7, 2014 at 8:40
  • Thank you very much for your answer. I really like the result and it is what I am looking for. However, I cannot reach ItemStyle.xsl file at site collection for security reasons, server access is limited to admins, is there any other way to get this result? Apr 7, 2014 at 8:46
  • You may need to put your Custom Item Style xsl file in a library where you have permissions. And then update the path in following code: <property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/CustomItemStyle.xsl</property> Apr 7, 2014 at 8:52
  • I receive the following error on the Web part: "The web part references an untrusted XSL file. Only XSL files contained in this site's Style Library may be referenced." The library does not exist in the space either. Apr 7, 2014 at 9:10
0

Can't you just edit the web part and change the Selected View option from Current View to Summary View?

2
  • 1
    This is good candidate for a comment, not answer. Dec 9, 2014 at 23:01
  • Apologies. I used greater and less than symbols but the board translated that into code. Dec 12, 2014 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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