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 declare permanent options. This file is a text file and hence 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 cannot locate the installation folder, just type the following in Stata to locate the file installation path.

findfile asdocx_defaults.ado

Once you locate the file, open it in your preferred text editor, and change options by modifying the third argument with each global macro. Inside this file, there are comments which can guide you on how to set these options. asdocx has the following rules for setting permanent options:

1. This file is run just once when the asdocx session is started. So if you change an option in this file and want to see its effect, you have to either restart Stata or use the following command.

 asdocx resetfmt

2. asdocx resetfmt is a global reset for all asdocx options, including the permanent options. However, please note that by permanent options here we mean the options recorded in the asdocx_defaults.ado file. If you want to use the default options that came with the asdocx installation, then you need to re-install asdocx.

3. When asdocx is updated, the adocx_defaults.ado file is reset to defaults. Therefore, if you have made changes in this file, those changes will be over-written. The workaround for this might be to copy the asdocx_defaults.ado file to a different location and replace it back in the installation folder once the update is complete.

2. Setting options for the current session only

Options can be temporarily changed to meet the specific formatting needs of a given table. So say we generally prefer the default spacings in a docx table. However, in a given document, we prefer the contents to autofit the table. The asdocx_defaults.ado file has the following contents 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.