Reputation: 6050
In Microsoft Word, paragraph numbers are marked up slightly differently to the actual text of a document. To illustrate -
I assume this is because they are auto-generated and can be positioned differently.
I would like to replace this auto-generated 1.2.1.2 text with "actual" text, so it will be marked up the same as the "Stack Overflow" to its right.
Is this possible somehow programmatically?
I am open to language suggestion if this is possible in any way (all of my research has led me to believe it is not-hence my lack of an "attempt" at this, if I am in err here then please let me know in the comments and I will very happily update my question with an attempt if you can point me towards an API or give me something to start with please :)).
Upvotes: 0
Views: 69
Reputation: 25663
Depending on where that underline is coming from, converting the numbers to text may not have the result you're looking for. You need to make sure that all the formatting is part of the Heading style and not applied directly. The ConvertNumbertToText
method, performed on any specified Range, will convert automatic numbering to plain text
wdDocument.Content.ListFormat.ConvertNumbersToText
You may also need to remove direct character formatting in order for the style format to display on the converted text:
wdDocument.Content.Select
Selection.ClearCharacterDirectFormatting
Upvotes: 1