NVeloDocx是基于NVelocity和OpenXml的Word模版引擎,所以遵循NVelocity的语法,但是要求上更为严格。NVeloDocx中的标签必须是“${VariableName}”这样,如果是NVelocity的话:${VariableName} 和 $VariableName 都是符合规范的,当然在NVeloDocx中两者都可以使用。
但是由于Word的格式太过于灵活,所以为了尽可能减少错误,我们强烈建议使用${VariableName} 这种格式。
下面E6中是常用的:
取数:
${data.GetValue("__Name__")}
${data.GetValue("Employee\\__Name__")}
${data.GetValue("Employee\\Department\\__Name__")}
插入图片:
${word.InsertImg(${data.GetValue("图片字段名")},33,32)}
插入签名:
${word.InsertImg(${data.GetValue("签名字段名")},30,15)}
插入柱状图:
${word.InsertBarChart(${data.GetChild("子表ID","汇总表控件名")},"图表标题",140,90)}
插入折线图:
${word.InsertLineChart(${data.GetChild("子表ID","汇总表控件名")},"图表标题",140,90)}
插入饼图:
${word.InsertPieChart(${data.GetChild("子表ID","汇总表控件名")},"图表标题",140,90)}