Re: How to paste styled text into a footnote in "Microsoft Word"
Re: How to paste styled text into a footnote in "Microsoft Word"
- Subject: Re: How to paste styled text into a footnote in "Microsoft Word"
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 01 Jun 2008 12:19:59 -0700
- Thread-topic: How to paste styled text into a footnote in "Microsoft Word"
Title: Re: How to paste styled text into a footnote in "Microsoft Word"
Actually, even the two-part method you outline below only works if you first select the footnote itself between them (after creating the footnote). Otherwise it pastes the clipboard content not only into the footnote but also into the main text after the original selection (after the footnote symbol). The main point is that you don't want to paste into the selection but rather into (text object of myFootnote). For pasting styled text, there's no real need for 'paste special' although it works fine with the right data type, as you did. Simpler is just to use 'paste object' which pastes styled text by default.
So just do this:
tell application "Microsoft Word"
collapse range text object of selection direction collapse end
set myFootnote to make new footnote at active document with properties {text range:text object of selection}
paste object (text object of myFootnote)
end tell
There's also no need ever to create "Test-String" content except for testing: by default an empty content (which appears in the footnote as "No Reference") will be created, and you can then alter that. Note that in other situations where you can get styled text from somewhere in a Word document itself, there's no need to copy to the clipboard. When creating your footnote, simply set the 'formatted text' property of its text range to the 'formatted text' of the text range you want to copy into the footnote. You could even do that right in the 'make new footnote' command without having to follow up with a new line.
--
Paul Berkowitz
From: Markus Krajewski <email@hidden>
Date: Sat, 31 May 2008 14:42:51 +0200
To: AppleScript-Users <email@hidden>
Subject: How to paste styled text into a footnote in "Microsoft Word"
Hi,
my apologies for a probably easy question: I want to make Mac:Word 2008 opening a new footnote into the current document and then insert as the content of the footnote some text from the clipboard. Both actions I am able to execute
One like this:
tell application "Microsoft Word"
collapse range text object of selection direction collapse end
set myFootnote to make new footnote at active document with properties {text range:text object of selection}
set content of text object of myFootnote to "Test-String"
activate
end tell
The other like this:
tell application "Microsoft Word"
paste special (text object of selection) data type paste styled text
activate
end tell
My question now is: how can I combine these two commands in order to replace "Test-String" directly by the content of the clipboard?
Any help is very much appreciated, thanks a lot,
Markus
--
mkr
Dr. Markus Krajewski
Bauhaus-Universität Weimar
Bauhausstraße 11, Zimmer 226
99421 Weimar
Fon: 03643.58-3840
Fax: 03643.58-3791
Mobil: 0179.7964814
www.uni-weimar.de/medien/kulturtechniken/ <http://www.uni-weimar.de/medien/kulturtechniken/>
www.verzetteln.de <http://www.verzetteln.de>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden