Using asdocx with putdocx
Since putdocx allows merging several docx files using the
putdocx append command, we can generate files using asdocx with the
.docx extension and then merge it with files generated by the putdocx. Below, I perform the following sequence of tasks:
(1) create a file with putdocx command (2) write some text and regression results to that file using putdocx (3) save that file (4) create another file with asdocx (5) and finally merge the asdocx file to the putdocx file.
sysuse auto, clear
putdocx paragraph, style(Heading1)
putdocx text ("Regression results")
reg price mpg rep78 headroom trunk length
putdocx table bweight = etable, title("Linear regression of birthweight")
putdoc save putdocx_file, replace
asdocx sum, save(asdocx_file)
putdocx append putdocx_file asdocx_file
The above code generates a combined file that contains the following contents.