I was wondering why the content put in the expand macro is not displayed in the table of content macro. Do you know why?
That would only happen if you don't mark the text in the expand macro as a header. The table of content macro only captures headers and not "paragraph" text.
Could you try and let us know if it worked like that?
Here are the general links to the two macros: https://confluence.atlassian.com/doc/expand-macro-223222352.htmlandhttps://confluence.atlassian.com/doc/table-of-contents-macro-182682099.html
This is how it should look like ("Klicken Sie hier, um zu erweitern..." is the german version of "Click here to expand")