Converting Markups to formatted text

Say you've created a track changes document. But now you need to copy those tracked changes and all their auto-formatted markup changes to another document to show what has changed, into a change report. You could screenshot your page, but this is time-consuming and makes it impossible to search.

And if you copy/paste this text, you'll lose the formatting in the change report. 

How can you convert these markups into real formatting easily?

There's three methods:

The easiest way is to simply print the markups to a PDF. This locks all the formatting. Then open the PDF in Word. Follow these steps:

1. Adjust the Track Changes to show the changes as colours and strikethroughs, and disable comments and formatting:

2. Print the document to PDF:

3. In the print dialog, choose a location and save the PDF.

4. Find the PDF, then open it in Word:

NOTE: If you have a PDF program installed that intercepts this (e.g. KoFAX PowerPDF, then follow their procedure to disable this, such as https://knowledge.kofax.com/MFD_Productivity/Power_PDF/How_To/How_to_stop_Word_2016_from_converting_with_Nuance_Convert_Assistant_when_opening_a_PDF?utm_source=pocket_mylist

5. Now in Word, you can copy the formatted text directly into another Word document, and all the change markups will be retained. See below for an example:

This is a sentancesentence that needs correctinghas been corrected

2. Copy to Excel (for tables)

If you copy the text to Excel, it will turn into real formatted text. This is great for tables.

There is one little catch: you need to swap line feeds and carriage returns before pasting, and after pasting you need to swap the line feeds back. My preference is to use the emoticon tongue sign :-Þ because it's easy to type (ALT-0222).

Follow this procedure to convert the markups into real formatting:

4. Similarly, Replace All ^p (line break) with Þ (ALT-0222).

5. Open Excel.

6. Copy and paste the entire table into Excel. This will preserve the formatting.

7. Save the Excel document as an ODS file (this is required to stop Excel from remembering that some cells are changes - this seems to happen to cells with text over a certain length).

8. Open the ODS file in Excel.

9. Copy this table back into the original Word doc, with all the formatting now baked in.

10. Open the Find/Replace (CTRL-H) dialogue box.

11.  Replace All Þ (ALT-0222) with ^p to fix line feeds and carriage returns. Note that it is important to do this step in Word, because Excel's Find/Replace tends to destroy some formatting.

3. Use a Word Macro

Here is a macro from Stack Overflow:


' From https://stackoverflow.com/questions/34280088/ms-word-macro-for-converting-track-changes-markup-into-text?utm_source=pocket_saves


Sub StartCompareChanges()

  CompareRevisionsRanges

  ConvertTrackChangesToText

End Sub


Sub CompareRevisionsRanges()

  Dim revs As Word.Revisions

  Dim rev As Word.Revision, revOld As Word.Revision

  Dim rngDoc As Word.Range

  Dim rngRevNew As Word.Range, rngRevOld As Word.Range

  Dim authMain As String, authNew As String, authOld As String

  Dim bReject As Boolean


  bReject = False

  Set rngDoc = ActiveDocument.Content

  Set revs = rngDoc.Revisions

  If revs.count > 0 Then

    authMain = revs(1).Author

  Else 'No revisions so...

    Exit Sub

  End If


  For Each rev In revs

    'rev.Range.Select  'for debugging, only

    authNew = rev.Author

    If rev.Type = wdRevisionInsert Or wdRevisionDelete Then

        Set rngRevNew = rev.Range

        'There's only something to compare if an Insertion

        'or Deletion have been made prior to this

        If Not rngRevOld Is Nothing Then

            'The last revision was rejected, so we need to check

            'whether the next revision (insertion for a deletion, for example)

            'is adjacent and reject it, as well

            If bReject Then

                If rngRevNew.Start - rngRevOld.End <= 1 And authNew <> authMain Then

                    rev.Reject

                End If

                bReject = False 'reset in any case

            End If


            'If the authors are the same there's no conflict

            If authNew <> authOld Then

                'If the current revision is not the main author

                'and his revision is in the same range as the previous

                'this means his revision has replaced that

                'of the main author and must be rejected.

                If authNew <> authMain And rngRevNew.InRange(rngRevOld) Then

                    rev.Reject

                    bReject = True

                'If the previous revision is not the main author

                'and the new one is in the same range as the previous

                'this means that revision has replaced this one

                'of the main author and the previous must be rejected.

                ElseIf authOld <> authMain And rngRevOld.InRange(rngRevNew) Then

                    revOld.Reject

                    bReject = True

                End If

            End If

        End If

        Set rngRevOld = rngRevNew

        Set revOld = rev

        authOld = authNew

    End If


  Next

End Sub




Sub ConvertTrackChangesToText()


Dim chgAdd As Word.Revision


If ActiveDocument.Revisions.count = 0 Then

    MsgBox "There are no revisions in this document", vbOKOnly

Else

    ActiveDocument.TrackRevisions = False

    For Each chgAdd In ActiveDocument.Revisions

        If chgAdd.Type = wdRevisionDelete Then

            chgAdd.Range.Font.StrikeThrough = True

            chgAdd.Range.Font.Color = wdColorDarkBlue

            chgAdd.Reject

        ElseIf chgAdd.Type = wdRevisionInsert Then

            chgAdd.Range.Font.Color = wdColorRed

            chgAdd.Accept

        Else

            MsgBox ("Unexpected Change Type Found"), vbOKOnly + vbCritical

            chgAdd.Range.Select ' move insertion point

        End If

    Next chgAdd

End If

End Sub