I wrote a script to capture all content from specific location of the content tree, as part of this script I need to take out only the text from the rich text fields. I use the HtmlAgilityPack to filter out the text out from HTML. I had about 3000 records before decoding now I only get around 1200 records. I can see all the records in result view but when export it excel format I only see limited content. other formats(csv.json) contain all the results
Function SanitiseHtml($html){
$doc = New-Object HtmlAgilityPack.HtmlDocument
$doc.LoadHtml($html)
$sanitise = $doc.DocumentNode.InnerText -replace 'amp;',' '
$sanitise = $sanitise -replace ' ', ' '
$sanitise = $sanitise -replace '’',' '
$decoded = ([System.Web.HttpUtility]::HtmlDecode($sanitise))
return $decoded
}