Overview
I had the opportunity to convert tabular information into a vertical writing format in Microsoft Word, so this is a memo.
Before conversion
| Research Title | Project Number | Direct Cost |
|---|---|---|
| Development of Digital Archive System Construction Methods Considering Sustainability and Usability | 21K18014 | 2600000 |
After conversion

This uses specified templates and the “Kanjize” library for mutual conversion between numbers and Kanji numerals.
Creating Microsoft Word Files with python-docx
First, create a Microsoft Word template file as follows. While using the specified layout, place {<variable_name>} in the parts where values should be changed.

Then, create a JSON file with values corresponding to the variable names used in the template above.
Then, by running the following Python script, you can create a Microsoft Word file based on the specified format.
Number to Kanji Numeral Conversion
When creating the above input JSON file, it was necessary to convert numbers to Kanji numerals.
Example: 2600000 -> 二百六十万
For this conversion, the following library was used.
https://github.com/nagataaaas/Kanjize
By running the following, data managed as numbers can be converted to Kanji numerals.
Summary
We hope this is helpful when creating Microsoft Word files.