The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
How to export Outline to Apple Pages Thread Tools Search this Thread Display Modes
Hi sthainzl:

Thanks for the script. Something I seek.

However, it imports text that is nicely indented but it is all in the style "Body." I was hoping it would retain the Outline hierarchy.

Any suggestions?
 
The export .docx route does have the advantage of retaining character formatting like bold/italic, but if a script is what you need, you should be able to do it with something like the following.

(Bear in mind that Pages uses the MS Word convention of only having header styles down to level 9, whereas 003 indents indefinitely. In this draft script anything beyond 9 becomes body text by default I notice that the docx exporter flattens all further indentation to level 9, incidentally. I prefer to use body text, because it offers at least a distinction between levels 9 and 10 of indentation.

If you edit the first line of the code to:

property pblnBodyAfterLevel9 : false

It will create styles with names like "Heading 10" etc.
but the outliner won't indent them, and it's up to you to provide definitions for them.)


Code:
property pblnBodyAfterLevel9 : true

tell application id "OOut"
	if (count of documents) < 1 then return
	set {lstLevel, lstText} to {level, topic} of rows of front document
end tell

tell application id "page"
	activate
	set oDoc to make new document
	set outline visible of front window to true
	tell body text of oDoc
		repeat with i from 1 to length of lstLevel
			set lngLevel to item i of lstLevel
			set oStyle to my GetStyle(oDoc, lngLevel)
			properties of oStyle
			make new paragraph at end with data item i of lstText with properties {paragraph style:oStyle}
		end repeat
	end tell
end tell

on GetStyle(oDoc, lngLevel)
	tell application id "page"
		tell oDoc
			if lngLevel ≤ 9 then
				return paragraph style ("Heading " & lngLevel)
			else
				if pblnBodyAfterLevel9 then
					return paragraph style "Body"
				else
					set strLevel to "Heading " & lngLevel
					try
						return paragraph style strLevel
					on error
						return (make new paragraph style with properties {name:("Heading " & lngLevel)})
					end try
				end if
			end if
		end tell
	end tell
end GetStyle

Last edited by RobTrew; 2012-01-10 at 04:34 AM.. Reason: Added a switch to choose between "Body" and "Heading 10" etc beyond level 9
 
Hi RobTrew,

Great work! It still works on Lion with the newest version of Pages! Really useful!

I'm wondering if you know how to have the script use the current cursor position of the current document, instead of creating a new one (or alternatively just use a user defined template)?

This way, the text formatting can be controlled much better.

All the best

Anders
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pages export? [A: Pro exports to the .docx format, which Pages can import.] teamnoir OmniOutliner 3 for Mac 2 2011-12-08 08:49 PM
Can I export/copy a formatted file to Pages? nm2 OmniOutliner for iPad 5 2011-05-12 01:33 PM
Feature Request: Export OO to Apple Pages grgwrzbcki OmniOutliner 3 for Mac 0 2009-01-30 06:44 AM
Export to Word, Import to Pages Mike B OmniOutliner 3 for Mac 2 2007-12-19 03:51 PM
Numbered Outline Export Justin Chapman OmniOutliner 3 for Mac 1 2007-08-20 07:19 PM


All times are GMT -8. The time now is 09:43 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.