Closed tpcarman closed 6 years ago
Hi @tpcarman Thanks for reporting. I think that the TOC in Word requires the use of the default Heading 1 - 3 styles (or at least the default implementation does).
Here's an example of overriding the built-in heading styles:
document Test {
Style -Name 'Heading 1' -Size 16 -Color 00B050 -Font 'Segoe UI'
Style -Name 'Heading 2' -Size 14 -Color 00B050 -Font 'Segoe UI'
TOC
Section 'Section1' -Style Heading1 {
Paragraph 'Test Section1';
Section 'Section2' -Style Heading2 {
Paragraph 'Test Section2';
}
}
} | Export-Document -Path $env:TEMP -PassThru -Format Word | Invoke-Item
Does this help? If not, we will need to review the WordML documentation to see if using other styles is supported.
Hi @iainbrighton ,
It seems TOC does not work with custom heading names, however if I use the default heading names with customised style parameters as you have demonstrated, then it works as expected.
Thank you for resolving this issue for me.
I seem to have an issue whereby the TOC is not generated if I use custom style headings. The TOC heading is displayed correctly, however the section headings are not generated within the TOC.
`# Document Options DocumentOption -EnableSectionNumbering -PageSize A4 -DefaultFont 'Segoe UI' -MarginLeftAndRight 72 -MarginTopAndBottom 72
TOC -Name 'Table of Contents'
Section -Style Custom_H1 'Section 1' { Paragraph 'Section 1 paragraph text.' Section -Style Custom_H2 'Section 1.1' { Paragraph 'Section 1.1 paragraph text.' }
If I revert back to default Styles/Headings then everything works as expected.