MS Word: how to extract all headers/footers
Thread poster: Samuel Murray
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 17:32
Member (2006)
English to Afrikaans
+ ...
Nov 17, 2016

Hello everyone

I often have to proofread translated documents that may or may not have edits to the headers and footers, but it's very hard for me to see if the footer on one page is in fact identical to the footer on a previous or next page. It would be tremendously helpful if I could extract all headers/footers to a separate document, so that I can proofread just the headers/footers by themselves.

Do you know of a way to accomplish this?

Samuel


 
Andrzej Mierzejewski
Andrzej Mierzejewski  Identity Verified
Poland
Local time: 17:32
Polish to English
+ ...
AFAIK... Nov 17, 2016

... headers/footers are identical over the entire document. If you make any amendment in the footer (or header) on any page, the same amendment will be made automatically on all the other pages.

Is there any chance for a different situation?

Rgds

Andrzej Mierzejewski


 
Tony M
Tony M
France
Local time: 17:32
Member
French to English
+ ...
SITE LOCALIZER
Not quite... Nov 17, 2016

Andrzej Mierzejewski wrote:

... headers/footers are identical over the entire document. If you make any amendment in the footer (or header) on any page, the same amendment will be made automatically on all the other pages.


That's not quite the case, Andrzej: headers/footers are identical within the same SECTION of a document, but one reason for inserting a 'section break' is sometimes in order to be able to change the headers/footers.

Across a 'section break', you have a button available allowing you to 'use same header/footer as previous section; if you don't click this button, then the header/footer can be changed from one section to the next.

Hence why OP has a problem...


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 17:32
Member (2006)
English to Afrikaans
+ ...
TOPIC STARTER
No, not all footers are running footers Nov 17, 2016

Andrzej Mierzejewski wrote:
AFAIK, headers/footers are identical over the entire document.


That is a common misconception, yes, but the author of a document can change any footer in the middle of a document without affecting the running footer, or can create a new running footer that starts from the middle of the document.

If you make any amendment in the footer (or header) on any page, the same amendment will be made automatically on all the other pages.


The amendment will be made automatically to footers on all other pages that form part of the same running. But if the document author introduced a new footer at, say, page 10, then an amendment to page 2 will only affect pages 1 to 9.


 
Alistair Gainey
Alistair Gainey  Identity Verified
United Kingdom
Local time: 16:32
Russian to English
Use a CAT tool? Nov 17, 2016

Can you just hide the main text, then import the document into a CAT tool using a hidden text filter, pseudotranslate it and edit the headers and footers from there (possibly arranging the segments alphabetically if you need to)?

 
Andrzej Mierzejewski
Andrzej Mierzejewski  Identity Verified
Poland
Local time: 17:32
Polish to English
+ ...
Then... Nov 17, 2016

I guess I better understand your problem now.

You wrote: "the author of a document can change any footer in the middle of a document without affecting the running footer". I'm not aware of such functionality. I understand that footers/headers are made automatically, not manually, that's why they are the same over the document (or a document section at least). May I suggest that you ask the author how s/he does the trick you're interested in.

Perhaps, t
... See more
I guess I better understand your problem now.

You wrote: "the author of a document can change any footer in the middle of a document without affecting the running footer". I'm not aware of such functionality. I understand that footers/headers are made automatically, not manually, that's why they are the same over the document (or a document section at least). May I suggest that you ask the author how s/he does the trick you're interested in.

Perhaps, the clue lays simply in dividing the document in sections?

Rgds

Andrzej Mierzejewski
Collapse


 
Tony M
Tony M
France
Local time: 17:32
Member
French to English
+ ...
SITE LOCALIZER
Not quite what Asker wants to know, Andrzej Nov 17, 2016

Andrzej Mierzejewski wrote:
May I suggest that you ask the author how s/he does the trick you're interested in.
Perhaps, the clue lays simply in dividing the document in sections?


That isn't really Asker's problem: however it has been achieved, the fact is that the headers/footers have been edited, and Asker just needs to find a way of identifying these edits easily.


 
Tony M
Tony M
France
Local time: 17:32
Member
French to English
+ ...
SITE LOCALIZER
Just a thought... Werecat? Nov 17, 2016

I don't know if you've maybe tried this, but I wonder if it's possible to use Werecat to do what you want? Although it is basically intended for extracting and subsequently replacing text in text boxes in Word documents or PPT, I have a feeling that it also extracts headers and footers too; if so, maybe you could use that feature? Better still, if you could find a way of organizing its output into a table, adding an index number column, and then sorting on the 'header / footer ID text', y... See more
I don't know if you've maybe tried this, but I wonder if it's possible to use Werecat to do what you want? Although it is basically intended for extracting and subsequently replacing text in text boxes in Word documents or PPT, I have a feeling that it also extracts headers and footers too; if so, maybe you could use that feature? Better still, if you could find a way of organizing its output into a table, adding an index number column, and then sorting on the 'header / footer ID text', you could do your proofing more easily, THEN put the table back in the original order and THEN pop it all neatly back into Word!

Haven't tried it, but might be one avenue to explore?
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 17:32
Member (2006)
English to Afrikaans
+ ...
TOPIC STARTER
Blue Werecat only does text boxes Nov 17, 2016

Tony M wrote:
I wonder if it's possible to use Werecat to do what you want?


Nice idea, but nope... it doesn't find the headers/footers.

Samuel


 
esperantisto
esperantisto  Identity Verified
Local time: 18:32
Member (2006)
English to Russian
+ ...
SITE LOCALIZER
OmegaT? Nov 17, 2016

A quick idea:
1. Delete all file contents except for headers / footers.
2. Save the file to ODT.
3. Fetch it to OmegaT. It will display headers / footers in segments as per the sequence of page styles obtained by conversion of document sections in the Word file.


 
CafeTran Training (X)
CafeTran Training (X)
Netherlands
Local time: 17:32
VBA Nov 17, 2016

Samuel Murray wrote:

Do you know of a way to accomplish this?

Samuel


I know that you're an experienced macro writer, so it shouldn't be too difficult to create a macro to extract the headers and footers to a new document.

Here's some info:

https://msdn.microsoft.com/en-us/library/office/ff194465.aspx

https://support.microsoft.com/en-us/kb/269565

http://stackoverflow.com/questions/8131219/word-2010-macro-for-editing-headers-footers

https://foren.activevb.de/archiv/vba/thread-21507/beitrag-21510/Re-Kopf-Fusszeile-kopieren-einf/

[Edited at 2016-11-17 16:49 GMT]


 
Didier Briel
Didier Briel  Identity Verified
France
Local time: 17:32
English to French
+ ...
OmegaT 2? Nov 18, 2016

esperantisto wrote:
A quick idea:
1. Delete all file contents except for headers / footers.
2. Save the file to ODT.
3. Fetch it to OmegaT. It will display headers / footers in segments as per the sequence of page styles obtained by conversion of document sections in the Word file.

Load the .docx in OmegaT.

Header and footers are loaded separately from the main text.
Search for the first header/footer, and all subsequent headers/footers will be there. Using non-unique segment highlighting, it will be obvious if a header/footer is different from the previous one.

Didier


 
Terry Richards
Terry Richards
France
Local time: 17:32
French to English
+ ...
A macro Nov 18, 2016

This should get you going. It only does headers at the moment but extending it to footers should be easy. If the forum software screws up the formatting, drop me an e-mail at [email protected] and I'll send you a properly formatted version.

Sub ResetView()
'
' ResetView Macro
'
' This macro recorded in Word

If ActiveWindow.View.SplitSpecial wdPaneNone Then
ActiveWindow
... See more
This should get you going. It only does headers at the moment but extending it to footers should be easy. If the forum software screws up the formatting, drop me an e-mail at [email protected] and I'll send you a properly formatted version.

Sub ResetView()
'
' ResetView Macro
'
' This macro recorded in Word

If ActiveWindow.View.SplitSpecial wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If
Selection.HomeKey Unit:=wdStory
End Sub
Sub ExtractHeaders()
'
' ExtractHeaders Macro
'
'This macro written by Terry Richards unless it screws up your
'document in which case I don't know who wrote it

Dim MainDoc As Range
Dim WorkDoc As Document
Dim SecNum As Integer
Dim HeadNum As Integer

'Store the document the macro is being run from

Set MainDoc = ActiveDocument.Range

'Create a work document to extract the headers to
'We should probably copy the style from the original document
'I might get round to that one day

Set WorkDoc = Documents.Add

'Loop through the sections in the original document

SecNum = 1

For Each Section In MainDoc.Sections

'Put a line in the work doc to show where we are

WorkDoc.Range.InsertAfter (">> Section: " + CStr(SecNum) + vbCrLf)
SecNum = SecNum + 1

'Loop through the headers for this section. There can be up to 3
'First page, odd page, even page.

HeadNum = 0

For Each header In Section.Headers

'Only extract headers if they are not empty

If header.Range.Text vbCr Then

'Only extract headers that have changed from the previous section.
'Note that any, or all, of the 3 can be changed

If header.LinkToPrevious True Then

'This is the first occurence of a new header - copy it to the end of the work document

header.Range.Select
Selection.Copy
WorkDoc.Range.InsertAfter (">> Header: " + CStr(HeadNum) + vbCrLf)
WorkDoc.Range.Select
Selection.GoTo What:=wdGoToLine, Which:=wdGoToLast
Selection.PasteAndFormat (wdFormatOriginalFormatting)

End If

End If

HeadNum = HeadNum + 1

Next

Next

'All of this jumping around headers has munged up the view of the main document
'Reset it to print view and move to the top of the first page

MainDoc.Select
Call ResetView

End Sub
Collapse


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 17:32
Member (2006)
English to Afrikaans
+ ...
TOPIC STARTER
@Terry Nov 18, 2016

Terry Richards wrote:
If the forum software screws up the formatting...


It does. But there's a trick to unbreaking code posted on ProZ.com: simply hit the "Quote" button, and then you can see the originally posted code.

I'll test this macro in a couple of days, thanks.

Samuel



[Edited at 2016-11-18 21:50 GMT]


 
Terry Richards
Terry Richards
France
Local time: 17:32
French to English
+ ...
@Samuel Nov 19, 2016

Ooooh, neat trick. Thanks for that.

 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

MS Word: how to extract all headers/footers






Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »
Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »