public static void Main()
<span style=""font-size: 12px""
<img id=""#assinatura46969#"" style=""display: none;"">
<br />_________________________________________________________________<br />
<span id=""#nome46969#"" style=""display: none;""></span>
var htmlDoc = new HtmlDocument();
ExibirTagHtml(htmlDoc, $"//img[@id='#assinatura46969#']", (node) =>
node.Attributes.Add("height", "35px");
node.Attributes.Add("src", "assinatura");
ExibirTagHtml(htmlDoc, $"//span[@id='#nome46969#']", (node) =>
node.InnerHtml = "GABRIEL DE GRANDE";
Console.WriteLine(htmlDoc.DocumentNode.OuterHtml);
private static void ExibirTagHtml(HtmlDocument htmlDoc, string xPath, Action<HtmlNode> acao = null)
foreach (var node in htmlDoc.DocumentNode.SelectNodes(xPath))
string style = node.GetAttributeValue("style", "");
if (!string.IsNullOrEmpty(style))
var properties = style.Split(';')
.Where(p => !p.StartsWith("display", StringComparison.OrdinalIgnoreCase))
.Where(p => !string.IsNullOrEmpty(p));
node.SetAttributeValue("style", string.Join("; ", properties));
node.Attributes.Remove("style");