How to add and set directories in batches in Word documents
Explains how to add, set and update table of contents in batches in multiple Word documents or multiple chapters, including common practices such as unifying title styles, using templates to copy styles, merging master documents, etc., and attaches a checklist.
Key points of this article
- The Word table of contents is generated based on the title style. The prerequisite for batch processing is that each file title uses a unified title style.
- Multiple chapters of the same document share a directory, and there is no need to create separate directories for section breaks.
- Multiple independent files can be unified in style first, and then inserted into the directory one by one, or merged into the master document and generated at once.
- After modifying the directory style, use a template or style manager to copy it to other files to avoid manual adjustments one by one.
- Update fields and check page numbers after the table of contents is generated, especially after merging files or changing the text.
When many people are working on papers, tender documents or project reports, they have several Word documents with similar structures, and each document must be added with a table of contents. Setting up from scratch one by one is time-consuming and prone to problems such as inconsistent levels and inconsistent page numbers. If you want to process multiple documents at one time, or if there are many chapters in the same long document and you need to set up a unified table of contents, you need to change your thinking.
Word itself does not have a button to "select multiple files and generate a table of contents with one click". Its table of contents is automatically captured based on the title style, so the key to batch processing is not to find a batch button, but to unify the title style first, and then insert, set and update the table of contents in an appropriate way. This article talks about general methods, applicable to all versions of Word. After reading this, you can decide which one to use.
If your file is a scan or PDF, the method in this article does not apply, because Word tables of contents can only be generated from editable Word documents.
How to add directories in batches? One sentence conclusion
First unify the title style, and then choose a method based on the number of files and the relationship between the files: the same document uses a directory to cover all chapters; multiple independent files can be inserted one by one, or merged and processed centrally.
| your situation | Recommended practices | reason |
|---|---|---|
| There are multiple chapters in a long document | After unifying the title style, only one table of contents is inserted. | The table of contents will automatically include all titles of the document, and section divisions will not be affected. |
| Multiple independent documents with the same structure | Make a template with a unified style, apply it one by one and insert it into the directory | Unified styles, set once and reuse |
| Multiple documents need to be combined into one book | Use the master document to merge and generate a total directory | Only one set of catalogs needs to be maintained with uniform page numbers |
| There are many files and the format is fixed | Use macros to traverse files in batches and insert them into directories, and back them up first | Can reduce repeated operations, but requires basic macro settings |
| Just want to adjust the directory appearance | Modify styles such as "Directory 1" and "Directory 2", and then update the directory | The appearance is changed uniformly, no line-by-line adjustments are required. |
Before you start: Confirm these points first
1. Do you use a title style for the title? The Word table of contents only recognizes paragraphs that have heading styles such as "Heading 1" and "Heading 2" applied. If you rely on bolding and changing the font size to serve as titles, the table of contents will be empty. Before batch processing, first check a few documents to confirm that the title styles are used in titles at all levels.
2. Whether the levels of each file are consistent. If some files use "Title 2" as a first-level section, and some use "Title 1", the directory hierarchy will be messed up when merging or unifying settings. This step must be unified before adding the directory, otherwise each subsequent file must be repaired separately.
3. Relationship between files. Whether multiple documents are to be combined into a whole (such as several chapters of a book) depends on whether you use "master document" or "insert one by one". If the files are independent of each other and each needs a directory, there is no need to merge them.
4. Is there a backup of the original file? Batch insertion and update of fields can be undone, but when errors occur in macro or merge operations, the repair cost is high. Before you start, make a copy of the original file and save it somewhere else.
5. Whether the page number and layout have been finalized. Table of contents page numbers are calculated based on the current paging. If there will be a lot of additions and deletions after the main text, it is recommended to finalize the main text first and finally generate a unified table of contents. Otherwise, every change will have to be updated again.
Steps to add tables of contents to multiple documents in batches
The following takes "multiple independent documents with similar structures" as an example. This situation is common.
- Organize the title structure. Open each document and mark the first-level headings with "Heading 1" and the second-level headings with "Heading 2." Do it in a document first as a template.
- Make a template with a unified style. Save the template file as a template format (.dotx), which contains title styles and table of contents styles. Later, new files will start from this template, and the title level will be consistent.
- Synchronize styles to existing files. If the old file already exists, you can use the style management function of Word to copy the title style and table of contents style in the template to avoid manually changing the font and paragraph format one by one.
- Insert directories one by one. At the table of contents location of each document (usually after the cover and before the text), find the function of inserting a table of contents in the ribbon of Word, and select the automatic table of contents style insertion. When inserting, make sure the directory level contains the heading level you need.
- Uniformly set directory styles. Modify the font, indent and line spacing of "Directory 1" and "Directory 2" in one file, and then copy it through a template or style to let other files use the same settings.
- Update table of contents and page numbers. After inserting, right-click on the table of contents to find the option to update fields; or select all documents and press F9 to choose to update the entire table of contents. This step will make the page number consistent with the current pagination.
- Check one by one. Open each document and quickly check whether the table of contents corresponds to the title of the text, and whether the page numbers are correct.
- Archive and save. Save as final version when completed and indicate the date or version number in the file name to avoid confusion.
If your files want to be merged into a book, you can use the "master document" method instead: first put each chapter into a master document, set the title style uniformly, and finally insert a table of contents at the beginning of the master document. This only needs to be generated and updated once, and the page numbers will be continuous.
Check each item after completion
| Check items | How to see | What to do if there is a problem |
|---|---|---|
| Is the directory complete? | Check the text to see if each first-level and second-level heading is in the table of contents | Check whether the missing title uses the title style, and update the table of contents after correcting it. |
| Is the level correct? | Look at the indentation and level, whether the second-level headings are indented below the first-level headings | Return to the text and unify the title style, don’t just adjust it manually in the table of contents |
| Does the page number correspond? | Randomly select a few titles and jump to the corresponding page to check. | After selecting all documents, press F9 to update the entire table of contents. If necessary, check whether page breaks are redundant. |
| Is the style uniform? | Are the fonts, font sizes, and indentations of each file directory consistent? | Use templates or styles to copy and unify functions, do not modify them one by one manually. |
| Are there any duplicate directories after merging? | After merging the files, check if any old directories are left behind | Delete the old directory and keep only one total directory |
| Whether to synchronize after modification | After adding or deleting content in the main text, does the table of contents change accordingly? | Update the domain after each modification to confirm that the page number is still correct |
Pay special attention to merged files when checking. The original page numbers of each document and the merged page numbers are often different. If they are not updated, the page numbers on the table of contents will be old. In addition, if the PDF has been exported before the catalog is updated, it needs to be exported again.
If you convert files back and forth between different editors, for example, use OmniDoc's UniDoc web editor to open a Word file and then download it back, it is recommended to check again after conversion whether the directory is still there and whether the hierarchy is preserved. Different software has different levels of support for directory domains, so verification cannot be omitted.
📊 Core comparison
| method | Suitable scene | advantage | need attention |
|---|---|---|---|
| Insert one by one after unifying the styles | There are not many files and each one is independent. | Simple and straightforward, no additional settings required | When there are many files, there are more repeated operations |
| Template plus style copy | Multiple new or old files with the same structure | Unified styles, set once and reuse | You need to make a template first, and the template needs to be maintained regularly. |
| Master document merge | Multiple chapters combined into one book | There is only one table of contents with consecutive page numbers. | Before merging, make sure that the title levels of each chapter are consistent |
| Macro batch processing | There are many files and fixed rules | Less repetitive work and fast speed | You need to understand the security settings of macros and be sure to back them up before operation. |
🎯 Which method is suitable for you?
- Students and staff writing papers or reports: If there are only a few independent documents, it is recommended to make a template and insert the table of contents one by one. The operation is intuitive and easy to check.
- People who organize book manuscripts or tender documents: The content of multiple chapters will eventually be combined into one document. It is easier to control the document and the page numbers are easier to unify.
- People who need to process a large number of similar files: If the number of files is large and the format is fixed, you can consider macro batch processing, but you should test it on a copy first and confirm that the results are in line with expectations before using them in official documents.
❓ Frequently Asked Questions (FAQ)
1. The directory is empty after being generated. Why?
Usually the title of the text does not use the heading style and Word cannot recognize it. Check the style of the heading paragraph and change it to "Heading 1" or "Heading 2" and update the table of contents.
2. The document has many sections. Do I need to generate a table of contents for each section?
unnecessary. The table of contents for the same document will include all headings, regardless of the section in which they are located. Just insert a table of contents at the required location. Section breaks do not affect the table of contents generation.
3. What should I do if the page number is wrong after adding a table of contents in batches?
Right-click the table of contents and find the option to update fields, or select all documents and press F9 to update the entire table of contents. If it still doesn't work, check whether there are manually inserted page breaks or blank pages, delete the extra page breaks and update again.
4. Can I batch modify the fonts and formats of directories only?
Can. Modify the styles such as "Directory 1" and "Directory 2", and all directories using these styles will change accordingly. After unified settings, then use the template or style copy function to apply to other files, which is more reliable than manually changing them one by one.
5. Can the table of contents of a Word file converted using an online editor still be used?
In most cases, yes, but different software supports directory domains to varying degrees. After conversion, you should check whether the directory hierarchy, page numbers, and styles are retained. If problems are found, go back to the original file to correct it, and then convert again.
📝 Summary
The core of adding a table of contents in batches in Word is to unify the title style first, and then select the method of inserting, merging or macro processing according to the relationship between the files. After finishing, checking the level, page number and style item by item can avoid most rework. Save the unified title style and table of contents style as a template, and subsequent documents will avoid a lot of detours.


