Notifications

432 views

Symptoms


HTML fields display with HTML Tags when exported and rendered in Excel format from List view:

1) Navigate to any list view which has an HTML Field.

2) Right Click on the headers

3) Export > Excel (.xlsx)

4) Observe the rows content after downloaded into the Excel file.

Export Excel


Cause


This ability to hide HTML Tags is currently not a part of the product.

Solution


Use Visual Basic Editor in Excel to clean the exported content.

The code to change a column from HTML to plain text can be something like this:

 

Sub StripTags()

      Dim cell               As Range

      Dim s                     As String

      Dim asWd()           As String

      Dim iWd                 As Long

 

      For Each cell In Intersect(Selection.Cells, ActiveSheet.UsedRange)

              s = Replace(cell.Value, Chr(160), " ")

              s = Replace(s, ">", "<")

              s = Replace(s, vbCr, vbLf)

   

              asWd = Split(s, "<")

              s = vbNullString

              For iWd = 0 To UBound(asWd) Step 2

                      s = s & " " & asWd(iWd)

              Next iWd

 

              Do While InStr(s, vbLf & " ")

                      s = Replace(s, vbLf & " ", vbLf)

              Loop

 

              Do While InStr(s, vbLf & vbLf)

                      s = Replace(s, vbLf & vbLf, vbLf)

              Loop

   

              cell.Value = WorksheetFunction.Trim(s)

      Next cell

End Sub

 

 

Additional Information



See more extensive details and instructions in the community post Rendering HTML in Exported Lists.

Documentation pages: List export

Article Information

Last Updated:2019-05-21 11:58:49
Published:2019-05-17