You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在HotDocs模板中动态插入编号列表中的数字?

Great question—this is a common pain point in legal document automation, and the best approach depends on how your numbering rules interact with HotDocs’ dynamic content controls. Let’s break down your options clearly:

Can Word auto-grab the list number?

Word’s native cross-reference tool works fine for static numbered lists, but it’s not reliable for your use case where the number changes based on special counting rules or dynamic content. Here’s why:

  • If HotDocs hides sections of your list after generating the document, Word’s cross-reference won’t automatically adjust to exclude those hidden paragraphs from the count.
  • Custom rules like skipping certain paragraphs, resetting numbers mid-list, or counting only specific content types can’t be handled by Word’s basic cross-referencing logic.

So for your scenario, relying solely on Word isn’t the right call—you’ll want to leverage HotDocs’ built-in variable system to compute the number dynamically.

This is the most robust way to handle dynamic, rule-based numbering:

  1. Create a numeric variable (e.g., FinalValidParagraphNum) to track the correct count.
    • Use HotDocs’ computation editor to codify your special rules: For example, if Paragraph 12 is hidden when a certain condition is met, subtract 1 from the total; if a supplementary section is included, add its paragraph count to the total.
    • You can also tie the variable directly to list item visibility: For each paragraph that counts toward your final number, add a line in the computation that increments the variable only if the paragraph is set to show.
  2. Insert the variable into your template
    • Replace the blank in "第1-__段内容真实" with your HotDocs variable. The text will look like this: 第1-<<FinalValidParagraphNum>>段内容真实
    • When HotDocs generates the document, it will automatically populate the variable with the computed number based on your rules.

Fallback: Manual Input (For Extremely Nuanced Rules)

If your counting rules are too complex to codify (e.g., depend on case-specific exceptions that vary widely), you can set up a simple manual input prompt:

  • Create a numeric variable (e.g., ManualParagraphNumber) and mark it as required in HotDocs.
  • Insert the variable into the template as described above.
  • Users will be prompted to enter the correct number when generating the form, ensuring it aligns with the specific case’s unique counting rules.

Pro Tip

Always test your template with all edge cases:

  • Verify the variable computes correctly when sections are hidden or shown.
  • If you ever use Word cross-references for static lists, remind users to refresh fields (press Ctrl+A then F9) after generating the document to update numbers.

内容的提问来源于stack exchange,提问作者hypetech

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 04:21:04