I have 2 documents. I want the header of first doc to be copied to the second doc (exactly, same formatting, page number options etc..). Here's my source code so far:
tell application "Microsoft Word"
activate
open "Macintosh HD:test.docx"
open "Macintosh HD:newtest.docx"
set doc to document "Macintosh HD:test.docx"
set doc2 to document "Macintosh HD:newtest.docx"
set refHeader to get header of section 1 of doc index header footer primary
end tell
how can I set refHeader to the header of doc2? Thanks.
I tried this but it doesn't work, gives me error:
set refHeader to page number options of (get header of section 1 of doc index header fo开发者_如何学运维oter primary)
set page number options of (get header of section 1 of doc2 index header footer primary) to refHeader
this seems pretty elaborate but does the job might be a better way but i"m not sure
tell application "Microsoft Word"
activate
open "Macintosh HD:test.docx"
open "Macintosh HD:newtest.docx"
set doc to document "Macintosh HD:test.docx"
set doc2 to document "Macintosh HD:newtest.docx"
set refHeader to content of text object of (get header of section 1 of doc index header footer primary)
set props to properties of text object of (get header of section 1 of doc index header footer primary)
set content of text object of (get header of section 1 of doc2 index header footer primary) to refHeader
set properties of text object of (get header of section 1 of doc2 index header footer primary) to props
end tell
精彩评论