Home > Blockchain >  Can Word automatically find the titles and apply the corresponding style to them?
Can Word automatically find the titles and apply the corresponding style to them?

Time:09-21

I'm desperately trying to convert an html to word or pdf with updated table of contents with page numbers (initially an R-markdown doc -> html).

When opening my HTML to word, the 650 page (!) document does not display page numbers or table of contents, although the titles are saved as titles. One suggested solution was that the document may have become corrupted during conversion. It was therefore necessary to copy / paste all the text on another document and save it.

Indeed, when I copy and paste the text leaving all styles, pagination is possible.

But I need to have my titles and create an automatic table of contents! I have the list of titles at the beginning of the document, but they are not identified as titles by Word.

Could there be a way that Word automatically applies the Heading 1 style to all sentences starting with 1, 2, 3 etc; Heading 2 style to all sentences starting with 1.1, 1.2, 2.1, 2.3 etc. And so on?

Maybe a Macro ? (I don't know anything about VBA :( )

Thanks in advance!

CodePudding user response:

You can easily do this without using any VBA code just by using Find and Replace, e.g.

enter image description here

If you don't know how to use wildcards see: https://wordmvp.com/FAQs/General/UsingWildcards.htm

  • Related