HTML string to Text conversion - preserve styling

Hello,

I am trying to convert html string to plain text but its not preserving the styling (indentation, table structure) in converted version. Can you please help me to identify how we can achieve that? I am using below code for conversion.

using (var HtmlDocument = new HTMLDocument(summaryHtml, ""))
            {
                // Initialize the instance of node iterator to iterate HTML
                INodeIterator iterator = HtmlDocument.CreateNodeIterator(HtmlDocument, NodeFilter.SHOW_TEXT
                  , new StyleFilter());

                StringBuilder Stringbld = new StringBuilder();
                Aspose.Html.Dom.Node node;

                // Iterate through Nodes
                while ((node = iterator.NextNode()) != null)
                    Stringbld.Append(node.NodeValue);
                return Stringbld.ToString();
            }

    class StyleFilter : NodeFilter
    {
        public override short AcceptNode(Aspose.Html.Dom.Node node)
        {
            // In order to avoid any element during fetching nodes, write the name of element in capital letters
            return (node.ParentElement.TagName == "STYLE" || node.ParentElement.TagName == "SCRIPT"
                ? FILTER_REJECT : FILTER_ACCEPT);
        }
    }

@Vaidehi123

Can you please share your sample HTML file along with the expected output in .zip format? We will test the scenario in our environment and address it accordingly.

Please find input, current output and desired output files in attached zip.
Files.zip (69.5 KB)

@Vaidehi123

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLNET-5491

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you @asad.ali

@asad.ali We already have licensed version of Aspose.Total

@Vaidehi123

The logged ticket will be investigated and handled as per the policies of Free Support Model. We will resolved it on a first come first serve basis and once it is resolved, we will inform you in this forum thread. Please spare us some time.

We are sorry for the inconvenience.