Software Support Forum


Research answers to your questions, or request support for SharePoint
Solutions software products. Our forums are grouped by software product.
Welcome to Software Support Forum Sign in | Join | Help
in Search

How to strip formatting?

Last post 10-07-2009 1:21 PM by SonOfPirate. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-07-2009 9:40 AM

    How to strip formatting?

    I am using the Data Zoom web part to aggregate data and would like to strip away existing formatting so the list has a uniform appearance.  Is there any way to do this?

     

  • 10-07-2009 10:13 AM In reply to

    Re: How to strip formatting?

    The Data Zoom Web Part provides a handful of formatting options. The two most common formatting requirements are for string manipulation and field data.

    Strings

    If you would like to format a string the first place
    to look is the $Strings context item. This provides access to the .NET String.Format method. Find the documentation here...

    (.NET String Format)
    http://msdn.microsoft.com/en-us/library/b1csw23d.aspx 

    ($Strings context item)
    http://help.sharepointsolutions.com/products/DataZoom/Classes_StringUtility.html

    If this doesn't satisfy your requirements the next step would be to investigate the $Expressions context item. This context item provides access to the .NET Regular Expression library. A detailed description of Regular Expressions is way beyond this forum post. Please read more below...

    (.NET Regular Expressions )
    http://msdn.microsoft.com/en-us/library/hs600312.aspx

    ($Expressions context item)
    http://help.sharepointsolutions.com/products/DataZoom/Classes_ExpressionUtility.html

    Field Data

    If you would like to format field data please have a look at $SPFields context item. It allow you to easily read complex SharePoint field data like Lookups, Multi-Choice, User and URL field data.

    ($SPFields context item)
    http://help.sharepointsolutions.com/products/DataZoom/Classes_SPFields.html

    (Read Complex Field Data Sample)
    http://help.sharepointsolutions.com/products/DataZoom/Samples_SPFields.html

    Finally, if you post the details of your task a more specific solution can be provided.

    Filed under:
  • 10-07-2009 12:18 PM In reply to

    Re: How to strip formatting?

    Simply put, I am aggregating all of the Announcements posted to such lists in a site's child sites.  When these announcements are posted, the author has the ability to change the font name, size, color, etc. and these variations cause the list shown in the Data Zoom web part to be difficult to read.

    I am using the Body property to obtain the body of the original message so that we can display a short summary for each list item (announcement).  We have code that truncates the content to the first carriage return or 200 characters, whichever comes first.  But, the character count includes any HTML markup used to format the content so we don't get consistent results.  Furthermore, because the HTML markup is still present, when we display the item, whatever formatting was used by the original author is persisted and each item will have a different appearance.

    I would like to remove all of the HTML markup so I can ensure a consistent appearance - and, as a side effect, get an accurate length for truncation.

    Make sense?

     

  • 10-07-2009 1:21 PM In reply to

    Re: How to strip formatting?

    It looks like the regular expression approach will do the job.  Using the right pattern, I am able to strip away the HTML tags.  This is not fool-proof, of course, but gets the job done today.

    Thanks!

     

Page 1 of 1 (4 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems