How to show in Table of Contents special formatted page numbers from the header

Hello,
I would like the Table of Contents to recognize the sections of a document. For example, using page styles I have a section where the header prefaces each page number with text: GR-{page number field}. Then the next section PD-{page number field} and so on. I want the Table of contents to include the prefacing text along with the page number. I am able to do this in my PDF editor. I can set each section with additional text to the page number field that then shows in the TOC. Is this possible in Writer?

You can’t do this natively.

However, if you distort your outline by tweaking levels assigned to Heading n, you can do with a very specific (and tricky) TOC configuration. It also needs customising Contents n styles (those to format the TOC).

I’d rather advocate against such a hack because it gives a non-standard (and non-logical) structure to your outline.