Permanent and Session Options
asdocx uses asdocx_defaults.ado file to set permanent options. However, asdocx also allows to set an option just for the current session. Session and permanent options are discussed below.
1. Setting options permanently
asdocx uses asdocx_defaults.ado file to set permanent options. This file is a text file that can be edited in the Do Editor or any other text editor, such as Notepad. The file is located in the asdocx installation folder. If you are unable to find the installation folder, you can use the following command in Stata to locate the path to the file.
findfile asdocx_defaults.ado
Once you locate the file, open it in your preferred text editor, and change options by modifying the third argument of the global macros. Inside the file, you will find comments to guide you on how to set the options. asdocx has the following rules for setting permanent options:
1. This file is only run when the asdocx session is initially started. If you make changes to the options in this file and want to see their effects, you will need to either restart Stata or use the command below to apply the changes.
asdocx resetfmt
2. The command asdocx resetfmt
performs a global reset for all asdocx options in the current session, including the permanent options specified in the asdocx_defaults.ado
file. However, it is important to note that this does not reset the permanent options to the default values that came with the asdocx installation. The changes stays only in the current session. If you want to restore the default options, you will need to re-install asdocx.
3. The adocx_defaults.ado
file stores the default options for asdocx and is reset to these default values whenever asdocx is updated. This means that any changes you have made to this file will be overwritten during the update. To preserve your changes, you can copy the adocx_defaults.ado
file to a different location before updating asdocx and replace it in the installation folder after the update is complete.
2. Setting options for the current session only
In addition to the permanent options stored in the `asdocx_defaults.ado file`, asdocx also allows you to set options on a temporary basis for the current session. This can be useful if you want to override the default formatting for a specific table. For example, you may generally prefer the default spacings in a docx table, but in a particular document, you may want the contents to autofit the table. The `asdocx_defaults.ado` file includes options for this purpose:”
// Table layout: Available options are : autofit , fixed global table_layout "fixed"
Therefore, the permanent default is to make a full-width table. Now let’s say we prefer autofit
contents just for the current session. We shall not change the adocx_defaults.ado
file, rather we shall use the following option.
Example:
sysuse auto, clear asdocx sum, detail table_layout(autofit) replace
Since detailed summary statistics have more columns, we prefer a tight fit for the contents of the table. Note that option table_layout(autofit), the option name is similar to the global macro name in the asdocx_defaults.ado
file. This is a general behavior for all other options given in the default file. We supplied autofit inside the parenthesis. This option can also accept the “fixed” argument as mentioned in the asdocx_defaults.ado file.
The above code generates the following table, that autofits contents.
