Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    Apr 2013
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Want left bar in margin to work like change tracking (Word 2010, PC)

    Hi all,
    I'd like to be able to put a vertical bar in the left margin for either paragraphs or tables in a doc. For paragraphs it looks like either a left border or a bar tab will work. For tables (with all around borders) I can't get either to work.

    I am basically creating a redline document in HTML (content coming from a non-office application) that has been marked up to indicate the changes. Given the heavy use of tables, Word's native compare capability usually breaks if there have been too many row insertions/deletions. I then bring the redlined html document into Word and it generally formats pretty well. If I could just put in the change bars it would be nearly perfect...

    At this point the best I can come up with for tables is to turn the left border red for the row that contains a change.

    Any other ideas?

    Thanks,
    Eric

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,535
    Thanks
    3
    Thanked 147 Times in 140 Posts
    Is there a reason you are not actually using revision tracking itself to replicate revision tracking?

    Is this effort being made to text already in Word or does a HTML feature need to survive the conversion to Word?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Apr 2013
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi Andrew,
    We were originally exporting these documents (from MKS) as Word documents and then using Word compare to generate a redline between versions. MKS formats the bulk of the output Word document as tables (and there are many different document types: specs, test protocols, FMEAs, etc.). Unfortunately, Word can't handle lots of row additions and deletions from a table before it gives up and marks the whole old table deleted and the new table as new which masks the actual changes.

    I've written a Python app that pulls all the data from MKS and redlines it on a cell by cell basis, generates the redlines as html markup and then imports the aggregated HTML into Word for final formatting (MKS outputs HTML to provide basic text styling & tables). To use revision tracking, I'd have to export the original document, figure out the changes as I am doing and then update the old document with revision tracking turned on. It is probably possible to do it this way but I think it was easier to do it the way I've done it. An associated problem is that some of these tables can span tens of pages on ledger paper and Word slows way down when you update a cell in a table that large.

    Thanks,
    Eric

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,535
    Thanks
    3
    Thanked 147 Times in 140 Posts
    I think the point of the markup you are trying to replicate in Word is best served by actual revision tracking so I would do it by this kind of workflow.
    1. Export the complete document as you are doing with say "blue text" to indicate additions and "red text" to indicate deletions
    2. Now run a macro in Word which does a find for 'blue text". If it finds a block of 'blue text', turn off revision tracking, cut the content, turn on revision tracking, paste the content (and remove blue colour). Loop through document.
    3. Now for red text. In this instance, turn on revision tracking and delete (using the find and replace function) the content. This part of the macro shouldn't need a loop at all.

    This will give you a Word document with the revisions tracked as revisions. That then allows the sidebars and final; final with markup etc views.
    Last edited by Andrew Lockton; 2014-05-08 at 18:19.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    Charles Kenyon (2014-05-07)

  6. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    196
    Thanks
    4
    Thanked 46 Times in 38 Posts
    I'd like to add a comment on why Andrew's answer is the best solution.

    In order to create a vertical bar in the margin next to a table without using tracked changes, you would have to insert a line Shape with text wrapping other than in-line. You would have to calculate the length of the line to match the height of the changed matter, which is not a simple job if there are non-text elements, multiple paragraphs with different Space Above/Below settings, various font sizes, etc. Once all that's done, there is no good way to lock floating shapes against being dragged -- only their anchors can be locked.

    Using real tracked changes avoids all this agita.

  7. The Following User Says Thank You to jjfreedman For This Useful Post:

    RunDeep (2014-05-09)

  8. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,535
    Thanks
    3
    Thanked 147 Times in 140 Posts
    Jay

    Thanks for the word 'agita'. I have never seen that one before.

    FWIW, using drawn shapes as a sidebar also causes heartache when a revision spans a page break. You would need to revisit how each sidebar line is drawn every time the document repaginates since one shape can't appear on two pages.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    RunDeep (2014-05-09)

  10. #7
    New Lounger
    Join Date
    Apr 2013
    Posts
    14
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi,
    Thank you both for your comments. I understand what Andrew has proposed and I don't have enough hair left to play with drawing lines in the margins so that's out I've been writing macros since the WordBASIC days so I have a pretty good handle on the effort involved in implementing Andrew's suggestion (it was the option I was trying to avoid). What I have works so much better than our current alternatives that I will stay with it for now (it is in high demand since the alternative is so bad). There are some MKS workflow issues that complicate things a little as well as the diverse document styles to deal with but I'll investigate in more depth for Ver 2.

    Thanks,
    Eric
    P.S. In a plug for Python, I wouldn't use Word Macros directly in this app, this is an example from my Python code using the COM interface with pywin32, very straightforward for somebody experienced with Word macros:

    Code:
    try:
      wordapp = win32com.client.GetObject(Class="Word.Application")
    
    except Exception, e:
      if e.args[0] == -2147221021:
        wordapp = win32com.client.Dispatch("Word.Application")
      else:
        raise
    
    wordapp.Visible = True
    worddoc = wordapp.Documents.Open(filename_c)
    footer = worddoc.Sections(1).Footers(wdHeaderFooterPrimary)
    finder_rng = footer.Range
    finder_rng.Find.Text = 'AAAA'
    finder_rng.Find.Execute()
    
    if finder_rng.Find.Found:
      finder_rng.InsertFile("redline_frag.html")
      sentence = finder_rng.Sentences(1)
      sentence.Collapse(wdCollapseEnd)
      sentence.MoveEnd(wdCharacter, -1)
      sentence.Delete()
    I've redefined the constants, e.g. wdCharacter, in Python though pywin32 includes them in a module too. Python makes the other parts of the apps so much easier than doing them in Word...
    Last edited by RunDeep; 2014-05-09 at 13:16. Reason: Add Python code

  11. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,535
    Thanks
    3
    Thanked 147 Times in 140 Posts
    I don't do Python but the VBA version of what I proposed would look similar to the following
    Code:
    Sub ConvertMarkupToRevisions()
      Dim rng As Range
      Set rng = ActiveDocument.Range
      ActiveDocument.TrackRevisions = False
      'Mark all strikethrough text as tracked deletion
      With rng.Find
        .ClearFormatting
        .Font.StrikeThrough = True
        .Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        While .Execute = True
          rng.Font.StrikeThrough = False
          ActiveDocument.TrackRevisions = True
            rng.Delete
          ActiveDocument.TrackRevisions = False
        Wend
      End With
      'Mark all underlined text as tracked addition
      Set rng = ActiveDocument.Range
      With rng.Find
        .ClearFormatting
        .Font.Underline = True
        .Font.Color = RGB(0, 0, 255)
        .Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        While .Execute = True
          ActiveDocument.TrackRevisions = False
          rng.Font.Reset
          rng.Cut
          ActiveDocument.TrackRevisions = True
          rng.Paste
        Wend
      End With
      ActiveDocument.TrackRevisions = False
    End Sub
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    RunDeep (2014-05-16)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •