给富文本框中的字体添加了各种样式后,可能会在该文字的外围出现一个span,css样式信息在该span中。可以通过下面的方法来获取:
富文本框赋值:@ie.frame(:id,"editor_ifr").document.body.innerText="内容很精彩"
添加了各种样式后,这样获取各种样式:
sp=@ie.frame(:id,"editor_ifr").body(:id,"tinymce").p.span
fontcolor=sp.document.currentStyle.color.to_s
bgcolor=sp.document.currentStyle.backgroundcolor.to_s
udline=sp.document.currentStyle.textdecoration.to_s
fontfy=sp.document.currentStyle.fontfamily.to_s
fontsize=sp.document.currentStyle.fontsize.to_s