使用opentbs创建docx时是否可以在子块上使用子块?
Is it possible to use a subblock on a subblock when creating docx with opentbs?
我正在尝试使用 opentbs 插件将数组输出到 docx 文件。我的数组有一个嵌套数组,所以我对主数组使用一个块,对嵌套数组使用一个子块。这非常有效。我的问题是嵌套数组也有自己的嵌套数组。是否可以用子块输出?
下面是我在 docx 模板中使用的内容,装运数据(块)和条目数据(子块)按我的需要显示。对于每个条目,我需要显示包(子子块),但目前它只输出标签而不是包数据。我哪里错了?
[a.shipment_#; block=tbs:row;sub1=entries]
[a_sub1.id]
[a_sub1.shipping_name;block=tbs:row;sub2=packs]
[a_sub1.total_quantity]
[a_sub2.display_line;block=tbs:row]
[a_shipment_total]
这是数组:
Array
(
[0] =>; Array
(
[entries] =>; Array
(
[1] =>; Array
(
[id] =>; 10000
[shipping_name] =>; Name1
[total_quantity] =>; 135
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 6 Steel Drums x 10L
)
[1] =>; Array
(
[display_line] =>; 5 Steel Drums x 15L
)
)
)
[2] =>; Array
(
[id] =>; 100001
[shipping_name] =>; Name2
[total_quantity] =>; 50
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 2 Plastic Jerry Cans x 25L
)
)
)
[3] =>; Array
(
[id] =>; 10002
[shipping_name] =>; Name3
[total_quantity] =>; 170
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 1 Plastic Jerry Can x 20L
)
[1] =>; Array
(
[display_line] =>; 6 Plastic Jerry Cans x 25L
)
)
)
)
[shipment_id] =>; #1234
[shipment_total] =>; 355
)
)
sub-block 功能支持子sub-block。
块 a_sub1
是块 a
的 sub-block。
块a_sub1_sub1
是块a_sub1
的sub-block,因此它是'a'的子sub-block。
您的模板可能是这样的:
[a.shipment_id;block=tbs:row;sub1=entries]
[a_sub1.id]
[a_sub1.shipping_name;block=tbs:row;sub1=packs]
[a_sub1.total_quantity]
[a_sub1_sub1.display_line;block=tbs:row]
[a.shipment_total]
我正在尝试使用 opentbs 插件将数组输出到 docx 文件。我的数组有一个嵌套数组,所以我对主数组使用一个块,对嵌套数组使用一个子块。这非常有效。我的问题是嵌套数组也有自己的嵌套数组。是否可以用子块输出?
下面是我在 docx 模板中使用的内容,装运数据(块)和条目数据(子块)按我的需要显示。对于每个条目,我需要显示包(子子块),但目前它只输出标签而不是包数据。我哪里错了?
[a.shipment_#; block=tbs:row;sub1=entries]
[a_sub1.id]
[a_sub1.shipping_name;block=tbs:row;sub2=packs]
[a_sub1.total_quantity]
[a_sub2.display_line;block=tbs:row]
[a_shipment_total]
这是数组:
Array
(
[0] =>; Array
(
[entries] =>; Array
(
[1] =>; Array
(
[id] =>; 10000
[shipping_name] =>; Name1
[total_quantity] =>; 135
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 6 Steel Drums x 10L
)
[1] =>; Array
(
[display_line] =>; 5 Steel Drums x 15L
)
)
)
[2] =>; Array
(
[id] =>; 100001
[shipping_name] =>; Name2
[total_quantity] =>; 50
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 2 Plastic Jerry Cans x 25L
)
)
)
[3] =>; Array
(
[id] =>; 10002
[shipping_name] =>; Name3
[total_quantity] =>; 170
[packs] =>; Array
(
[0] =>; Array
(
[display_line] =>; 1 Plastic Jerry Can x 20L
)
[1] =>; Array
(
[display_line] =>; 6 Plastic Jerry Cans x 25L
)
)
)
)
[shipment_id] =>; #1234
[shipment_total] =>; 355
)
)
sub-block 功能支持子sub-block。
块 a_sub1
是块 a
的 sub-block。
块a_sub1_sub1
是块a_sub1
的sub-block,因此它是'a'的子sub-block。
您的模板可能是这样的:
[a.shipment_id;block=tbs:row;sub1=entries]
[a_sub1.id]
[a_sub1.shipping_name;block=tbs:row;sub1=packs]
[a_sub1.total_quantity]
[a_sub1_sub1.display_line;block=tbs:row]
[a.shipment_total]