mlreportgen.dom.HTMLFile 类
命名空间: mlreportgen.dom
超类: mlreportgen.dom.HTML
将 HTML 文件转换为 DOM 文档
描述
将 HTML 文件的内容转换为包含具有相同内容和格式的 DOM 对象的 mlreportgen.dom.HTMLFile
对象。您可以将 HTMLFile
对象追加到任何类型的 DOM 文档,包括 Word 和 PDF 文档。
mlreportgen.dom.HTMLFile
类是一个 handle
类。
创建对象
描述
HTML 元素 | 属性 |
---|---|
a | class , style , href , name |
address | class , style |
b | class , style |
big | class , style |
blockquote | class , style |
body | class , style |
br | 不适用 |
center | class , style |
cite | class , style |
code | class , style |
dd | class , style |
del | class , style |
dfn | class , style |
div | class , style |
dl | class , style |
dt | class , style |
em | class , style |
font | class , style , color , face , size |
h1, h2, h3, h4, h5, h6 | class , style , align |
hr | class , style , align |
i | class , style |
ins | class , style |
img | class , style , src , height , width |
kbd | class , style |
li | class , style |
mark | class , style |
nobr | class , style |
ol | class , style |
p | class , style , align |
pre | class , style |
s | class , style |
samp | class , style |
small | class , style |
span | class , style |
strike | class , style |
strong | class , style |
sub | class , style |
sup | class , style |
table | class , style , align , bgcolor , border , cellspacing , cellpadding , frame , rules , width |
tbody | class , style , align , valign |
tfoot | class , style , align , valign |
thead | class , style , align , valign |
td | class , style , bgcolor , height , width , colspan , rowspan ,align , valign , nowrap |
th | class , style , bgcolor , height , width , colspan , rowspan ,align , valign , nowrap |
tr | class , style , align ,bgcolor , valign |
tt | class , style |
u | class , style |
ul | class , style |
var | class , style |
有关这些元素的信息,请参阅 https://developer.mozilla.org/en-US/docs/Web/HTML/Element。
支持以下 CSS 格式:
background-color
border
border-bottom
border-bottom-color
border-bottom-style
boder-bottom-width
border-color
border-left
border-left-color
border-left-style
boder-left-width
border-right
border-right-color
border-rigtht-style
border-right-width
border-style
border-top
border-top-color
border-top-style
border-top-width
border-width
color
counter-increment
counter-reset
display
font-family
font-size
font-style
font-weight
height
line-height
list-style-type
margin
margin-bottom
margin-left
margin-right
margin-top
padding
padding-bottom
padding-left
padding-right
padding-top
text-align
text-decoration
text-indent
vertical-align
white-space
width
有关这些格式的信息,请参阅 https://developer.mozilla.org/en-US/docs/Web/CSS/Reference。
输入参量
属性
方法
示例
提示
MATLAB® Report Generator™
mlreportgen.dom.HTML
或mlreportgen.dom.HTMLFile
对象通常无法接受将原生文档导出为 HTML 标记的第三方应用程序(例如 Microsoft Word)的原始 HTML 输出。在这些情况下,您的报告 API 报 告生成程序可以使用mlreportgen.utils.html2dom.prepHTMLString
和mlreportgen.utils.html2dom.prepHTMLFile
函数准备原始 HTML 以供mlreportgen.dom.HTML
或mlreportgen.dom.HTMLFile
对象使用。通常,您的程序必须进一步处理准备好的 HTML 以删除有效但不想要的对象,例如原始内容中的换行符。Word 和 PDF 文档要求在段落中包含内联元素(例如文本和链接)。为了满足此要求,HTML 解析器创建包装段落来包含段落中尚不存在的内联元素。如果从包含不在段落中的内联元素的 HTML 创建
mlreportgen.dom.HTML
或mlreportgen.dom.HTMLFile
对象并将该对象添加到 HTML 文档,则生成的 HTML 可能与输入的 HTML 不同。要生成不带添加包装段落的内联元素,请使用mlreportgen.dom.RawText
对象将 HTML 标记插入 HTML 文档。默认情况下,DOM API 使用 12 点的基本字体大小将
em
单位转换为实际字体大小。例如,指定为2em
的字体大小将转换为 24 点。要指定不同的基本字体大小,请使用mlreportgen.dom.HTML
对象将内容添加到报告中。将对象的EMBaseFontSize
属性设置为基本字体大小。例如,如果将EMBaseFontSize
属性设置为 14,则字体大小2em
将转换为 28 点。
版本历史记录
在 R2015a 中推出