The specific steps are as follows
1. In the WORD document, select the text paragraphs with related titles respectively, and click "Title 1" in the Start tab to set them as the title style.
2. At the top of the home page, click Contents in the Reference tab.
3. In the pop-up drop-down option, click "Insert Directory" below to enter the directory details setting interface, and manually select and set related styles.
4. Check "Page Right Alignment", then click the option box behind tab leader, select the dotted line style, and click OK to complete directory insertion.
5. Back to the main document, I found that the dotted line of the directory in word has been automatically generated by the system.