= Stata PutDocx = The '''`putdocx`''' command is used for generating Word Documents. <> ---- == Usage == {{{ putdocx begin, footer(foot1) header(head1) putdocx paragraph, style(Title) putdocx text ("Document Title") putdocx paragraph, style(Heading1) putdocx text ("Section Heading") putdocx save foo.docx }}} === Tables === To insert a table, first it must be stored in a matrix. {{{ tab foo bar, matcell(foobar) }}} Then try: {{{ putdocx table foobar = etable }}} The table can then be accessed by by `NAME(ROW,COL)`. {{{ putdocx table foobar(1,.), bold putdocx table foobar(.,1), halign(left) putdocx table foobar(3,.), drop putdocx table foobar(1,1) = ("FOOBAR") }}} === Headers and Footers === Try: {{{ putdocx paragraph, tofooter(Foot1) putdocx text("Page Number ") }}} ---- == External Content == External graphs can be inserted. {{{ graph export foo.png putdocx image foo.png, height(1) width(1) }}} Note that dimensions are measured in inches. External text can also be inserted. {{{ putdocx textfile foo.txt }}} The content of the external file is inserted from the cursor position. Use the '''`stopat(pattern)`''' option to halt insertion at some pattern match; the cursor will remain at that point. ---- == Dynamic Tags == Dynamic tags are used to insert computed values. {{{ putdocx textblock begin Substitution: <>. putdocx textblock end }}} These can also be appended using `putdocx textblock append`. ---- CategoryRicottone