I recently started using dyndoc command for creating word documents. Stata's documentation offers examples on how to use it and shows the possibility of customizing html or word outputs by creating a css stylsheet and then calling it into the markdown script throught the <<dd_include>> tag. In the example css that can be found in http://www.stata-press.com/data/r16/...stmarkdown.css they define the printing features for the document as follows:
With the at-rule @page they define the margins of the word document. For the command
they show the following image as the output:

In this case there is clearly a bigger margin on the left, than on the right, as was defined through.
I've tried to create my own css with different margins, using the same code, but it doesn't works. The created word document has the predefined word margins (1 in). I even tried to replicate the above example by downloading the css stylesheet, the txt file and the header.txt file and using the aforementioned command. My output does not look like the documentation's image. It has the word's normal margins.
dyndoc_ex.docx
So long, i have noticed that if I create a html file and then try to print it, the printed document do follows the @media print specifications. It seems that dyndoc command does not work by printing the html output as a word document, that's why it does not matter what has been included under the at-rule @media print. Instead it creates the word document by following the html script.
Am I doing something wrong, that does not allows me to replicate the example?
Code:
@media print { * { background: transparent !important; color: black !important; filter:none !important; -ms-filter: none !important; } body{font-size:12pt; max-width:100%;} a, a:visited { text-decoration: underline; } hr { height: 1px; border:0; border-bottom:1px solid black; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; } pre, blockquote { border: 1px solid #999; padding-right: 1em; page-break-inside: avoid; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } @page :left { margin: 15mm 20mm 15mm 10mm; } @page :right { margin: 15mm 10mm 15mm 20mm; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } }
Code:
dyndoc dyndoc_ex.txt, docx
In this case there is clearly a bigger margin on the left, than on the right, as was defined through.
Code:
@page :left { margin: 15mm 20mm 15mm 10mm; }
dyndoc_ex.docx
So long, i have noticed that if I create a html file and then try to print it, the printed document do follows the @media print specifications. It seems that dyndoc command does not work by printing the html output as a word document, that's why it does not matter what has been included under the at-rule @media print. Instead it creates the word document by following the html script.
Am I doing something wrong, that does not allows me to replicate the example?