As @Jaydeep Suryawanshi linked to in the comments, it seems there's a nuget package that can be used to replace HtmlTextWriter: https://www.nuget.org/packages/HtmlTextWriter