aardio 文档

string.html.toDocx 库模块帮助文档

DOCX 导出指南

string.html.toDocx 成员列表 #

string.markdown.toDocx 使用的有限 HTML 子集适配器。
HTML 语义转为 fsys.openXml.docx.builder 的内容模型,Word XML 和打包不在此重复实现。
不经过 RTF;不依赖 Office、COM、.NET;保留可编辑段落、标题、表格和列表。

string.html.toDocx.buildParts(html,options) #

生成包内 XML 部件表(键为相对路径),不进行文件 IO。
兼容原来的部件表返回形式,内部由 fsys.openXml.docx.builder 生成。
返回 parts,null,report;失败返回 null,err。用于检查、测试或自定义打包。

string.html.toDocx.defaults #

默认选项表,可修改。
font="Microsoft YaHei",monoFont="Consolas",symbolFont="Segoe UI Symbol";
fontSize=11,codeFontSize=10(磅),lineSpacing=1.15,codeLineSpacing=1.15;
pageWidth=11906,pageHeight=16838(A4,twips),landscape=false;
margins={left=1440;right=1440;top=1440;bottom=1440};
checkboxStyle="unicode",可设 "ascii";wideTable="stack",可设 "wrap";
tableMinColumnWidth=720(twips),overwrite=false,title="",author="";
colors={text;muted;link;border;codeBackground;codeText;inlineCode;inlineCodeBackground;tableHeaderBackground;mark}(0xRRGGBB)。
inlineCodeBackground=false 禁用行内代码背景。
超宽表格默认按行列展开保留内容;wrap 保持表格并收窄换行。
图片只保留替代文字和地址;不下载或读取图片;不嵌入字体,不支持任意 CSS 或完整数学公式。

string.html.toDocx.packParts(parts,options) #

兼容打包入口:将部件表交给 fsys.openXml.writer,返回临时 DOCX 路径;失败 null,err。
调用者负责删除临时文件;一般应使用 save。options 支持 writer 的写入限额。

string.html.toDocx.save(path,html,options) #

保存 DOCX,返回完整路径,null,report;失败返回 null,err。
自动创建输出目录;默认不覆盖已有文件,overwrite=true 允许原子替换。

string.html 成员列表 #

string.html.toDocx(html,options) #

返回 DOCX 二进制字符串,err,report。
成功时 err 为 null,report.warnings 为降级提示数组。
使用 string.html(html,true) 解析,要求支持 preserveSpace 的新版 HTML/XML 库。

Markdown 格式