When doing “getHTMLContent” from a plugin, I get the font size in em instead of pt.
Example, If a font is set to ‘Arial 11’, the getHTMLContent will return
<span style="font-family:'Arial';font-size:0.95em;color:#000000;mso-style-textfill-fill-color:#000000"><u>word</u></span>
However, re-injecting it with “PasteHtml”, may set the font size to ‘Arial 10.5’, specially if it has other styles as underline.
I did dig into the code and I found that in all cases it is the function “CorrectFontSize” which is been called for that.
My question is, what is the need to switch from ‘pt’ to ‘em’ the size which will cause rounding issues?
Document Server version: 7.3 & 7.4
Installation method: docker, web
OS: ubuntu
Hello @humbol
I don’t quite understand what is ‘getHTMLContent’, can you provide more details? Is that a method?
Eventually, you can check out sample plugin Get and paste html as a reference for your code:
https://api.onlyoffice.com/plugin/example/getandpastehtml
Hello @Constantine ,
Sorry for “getHTMLContent” (my own code
), what i meant was
window.Asc.plugin.executeMethod(
"GetFileHTML",
null,
function(data){
console.debug(data)
}
);
I checked out the plugin, however it uses “initOnSelectionChanged”, If I print the text is received as argument in the init function I get :
<html>
<body>
<span style="font-family:'Arial';font-size:11pt;color:#000000;mso-style-textfill-fill-color:#000000">test</span>
</body>
</html>
But when doing GetFileHTML,
<p style="margin-top:0pt;margin-bottom:10pt;border:none;border-left:none;border-top:none;border-right:none;border-bottom:none;mso-border-between:none"
class="docData;DOCY;v5;902;...=">
<span style="font-family:'Arial';font-size:0.95em;color:#000000;mso-style-textfill-fill-color:#000000">test</span>
</p>
where the font-size changed from 11pt to 0.95em
Even worse, the plugin afterwards get 0.95em, I suspect that the “CorrectFontSize” is setted up afterwards.
thanks,
Thank you for the information. We are analyzing the situation, I will update the thread once any news come up.
By the way, is it possible to share example for your plugin so we can run test with it also?
We did some tests and found out that method PasteHtml incorrectly interpretates font size in em
unites. We registered this behavior as a bug and have already started working on it.
Thank you for pointing to it.