Skip to main content
April 23, 2026
Question

Issues with ADT files

  • April 23, 2026
  • 3 replies
  • 0 views

Hi community,

I'm using Advanced Document Templating plugin for a document generation where i have multiple chapters, and in each chapter i have have a conditional statement that if in the passed list are values then show a table else show a text "No data".

This a similar structure to the one that i'm using


    
        
        
        
    
    
        
        
        
    

The way that i'm implementing it is like the following in the document.xml



    
        
            
                
                
                    
                
            
            
                
                    
                
                Chapter 1
            
        
        
            
                
                    
                
                
                
                
            
            
        
        
            
                
                
                
            
            
                
                
            
            
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            Col 1
                        
                    
                
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            Col 2
                        
                    
                
            
            
                
                    
                        
                    
                    
                    
                    
                        
                    
                    
                
                
                    
                        
                            
                            
                            
                                
                            
                        
                        
                            
                                
                            
                        
                    
                
            
            
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            ${line.@col1}
                        
                    
                
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            ${line.@col2}
                        
                    
                
            
            
                
                    
                        
                    
                    
                    
                    
                        
                    
                    
                
                
            
        
        
            
                
                    
                
                
                
                
                    
                
                
            
            
        
        
            
                
                    
                
            
            
                
                    
                
                No data.
            
        
        
            
                
                    
                
                
                
                
                    
                
                
            
            
        
        
            
                
                    
                
            
        
        
            
                
                
                    
                
            
            
                
                    
                
                Chapter 2
            
        
        
            
                
                    
                
                
                
                
            
            
        
        
            
                
                
                
            
            
                
                
            
            
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            Col 1
                        
                    
                
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            Col 2
                        
                    
                
            
            
                
                    
                        
                    
                    
                    
                    
                        
                    
                    
                
                
                    
                        
                            
                            
                            
                                
                            
                        
                        
                            
                                
                            
                        
                    
                
            
            
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            ${line.@col1}
                        
                    
                
                
                    
                        
                    
                    
                        
                            
                                
                                
                                
                            
                        
                        
                            
                                
                                
                                
                            
                            ${line.@col2}
                        
                    
                
            
            
                
                    
                        
                    
                    
                    
                    
                        
                    
                    
                
                
            
        
        
            
                
                    
                
                
                
                
                    
                
                
            
            
        
        
            
                
                    
                
            
            
                
                    
                
                No data.
            
        
        
            
                
                    
                
                
                
                
                    
                
                
            
            
        
        
            
                
                    
                
            
        
        
            
            
            
            
        
    

The output file shows the table correctly and no issues here, my issue with the file is that i can still see the placeholders for the conditionals and loop

Also if i do any changes to the file and save them then i cannot open the file anymore.
Does anyone have any feedback that can be done to remove the field placeholders and also give the user the ability to edit the file without breaking it?

3 replies

May 12, 2026

Hi Flávio,

I would avoid editing document.xml directly if possible, because it can easily leave Word content controls or invalid table structure behind.

A safer approach would be to rebuild that section in the Word template itself: put the condition around the whole table vs. the “No data” paragraph, and keep the loop only on the repeating table row. If the conditional or loop placeholders are placed inside the wrong part of the table structure, ADT may still generate the data correctly but leave the controls visible in the output.

For the edit/save issue, I would also check whether any content controls remain in the generated DOCX. If they do, Word may modify them when the user edits the file, which could explain why the document becomes corrupted after saving.

gayathris111098
May 13, 2026

I think there might be a couple of things contributing to both the visible placeholders and the document corruption after saving.

One thing I noticed is that the `#if` block is being closed using:

```xml id="m7n2vs"
<w:tag w:val="@after-row[/#if]" />
```

Since `/#if` is more of a block-level directive, it may work better as:

```xml id="0g8cxv"
<w:tag w:val="@after-block[/#if]" />
```

My guess is that using `@after-row` here could be confusing the ADT engine a bit, so the SDT control is not getting cleaned up properly and ends up remaining visible in the generated document.

I also noticed that some `<w:sdt>` elements seem to be using the same `w:id` value, for example:

```xml id="e1wxj0"
<w:id w:val="604079035" />
```

From what I’ve seen, Word expects each content control to have a unique ID. Reusing the same `w:id` across multiple SDTs can sometimes cause document structure issues, especially after editing and saving the file in Word.

It might help to assign a unique integer ID to each `<w:sdt>` block and test again.