What does queryCommandValue ("FontSize") return?
I am trying to get the font size of a selected range in an html document. I used queryCommandValue to get it. It returns an integer multiple times. And sometimes it doesn't. I do not know what it is.
And I also tried another way to get the font by getting the parent emlement style. But this is not always correct, since there may be a different font size in its children.
+3
source to share
1 answer
This method returns a value between 1 and 7 for small to large font sizes, such as in GMail.
If you want to get the font size in points or pixels use
mshtml.IHTMLTxtRange range = _dom.selection.createRange() as mshtml.IHTMLTxtRange;
if (range != null)
{
mshtml.IHTMLElement2 elem = range.parentElement() as mshtml.IHTMLElement2;
fontSize.Text = elem.currentStyle.fontSize.ToString()
}
+3
source to share