This is a memo on how to achieve double-sided ruby (furigana) in Word using python-docx.

You can try it from the following notebook.

https://colab.research.google.com/github/nakamura196/ndl_ocr/blob/main/python_docxを用いた両側ルビ.ipynb

An output example is shown below.

An input example is shown below.

<<<bp</p<//o>r<</p>r<</pbdur<</rr>urrr>oybbr<</r<</rtubbtud>y>urrrurrrbby>by>bbtubbtu>py>py>y>by>bl>l>>py>pyaa<l><l>cc/a/ae<ercrc=/=bebe"r">=>=lba""e>brrfoiitvgg"ehh>"tt>"">></<<r//trr>tt>></rt>

The program is still incomplete, but I hope it serves as a helpful reference.