Skip to main content

render_with_handler

Function render_with_handler 

Source
pub fn render_with_handler<H: DocWriteHandler>(
    content: &DocumentContent,
    handler: &mut H,
) -> Result<Docx>
Expand description

将语义模型渲染为 docx-rs 的 Docx 实例,并在渲染过程中触发 handler 回调。

支持 DocWriteHandler trait 的 before/after 回调:

  • before_document / after_document
  • before_paragraph / after_paragraph
  • before_table / after_table

§参数

  • content: 完整的语义文档模型。
  • handlers: 可变引用的 handler 切片,按 order 排序。

§返回