How to add custom hidden attribute values to each paragraph of a docx document content via a Python script?

We have a specific requirement to add some hidden custom attribute values to each paragraph, image, shape, and other elements. Initially, we planned to use UserDefinedAttribute to achieve this. However, we discovered that the values written in this way cannot be parsed by the Aspose library after downloading the document. Are there any other ways to add hidden attribute values?

I think UserDefinedAttribute is specific to ODT. For DOCX, perhaps <w:smartTag> is a good option. See these core.git commits:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=8cf2c1353cfa5f95d1aa9551035fda721d5345d8

https://cgit.freedesktop.org/libreoffice/core/commit/?id=831492f3d50f3d131f458f4ec0e5e802b612923f

These use the UNO API, so you can more or less do the same from a Python script as well.

Could you please provide a Python code example? C language seems a bit difficult for me. Thank you very much!

LibreOffice Developer's Guide: Chapter 6 - Office Development - The Document Foundation Wiki this has some Java samples, if you prefer that.

Still not possible, unable to use Python to add smartTags to paragraphs.