private (LaTeXDocument texDoc, IControlHtml ctrlHtml) GetDocuments() { IControlHtml ctrlHtml = Svc.SM.UI.ElementWdw.ControlGroup.FocusedControl.AsHtml(); if (ctrlHtml == null) { return(null, null); } var html = ctrlHtml.Text ?? string.Empty; var htmlDoc = ctrlHtml.GetDocument(); var htmlSelObj = htmlDoc?.selection; string htmlSel = null; if (htmlSelObj?.createRange() is IHTMLTxtRange textSel) { htmlSel = textSel.text; } var texDoc = new LaTeXDocument(Config, html, htmlSel); return(texDoc, ctrlHtml); }