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?
How to strip formatting?
-
Matthew McBride 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?
-
Matthew McBride 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!
2 Comments