使用opentbs创建docx时是否可以在子块上使用子块?

时间:2019-06-23 15:42:13

标签: php opentbs tinybutstrong

我正在尝试使用opentbs插件将数组输出到docx文件。我的数组有一个嵌套数组,所以我对主数组使用一个块,对嵌套数组使用一个子块。这很完美。我的问题是嵌套数组也有自己的嵌套数组。可以将其与子子块一起输出吗?

以下是我在docx模板中使用的内容,显示了我需要的装运数据(块)和条目数据(子块)。对于每个条目,我都需要显示packs(子子块),但目前它仅输出标签而不是packs数据。我要去哪里错了?

[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
        )

)

1 个答案:

答案 0 :(得分:0)

子块功能确实支持子子块。

nltk.tokenize..块是a_sub1块的子块。

a块是a_sub1_sub1块的子块,因此它是'a'的子块。

这就是您的模板的样式:

a_sub1