The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniOutliner 3 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=9)
-   -   Importing from word (http://forums.omnigroup.com/showthread.php?t=12959)

stolzy 2009-07-05 10:10 PM

Importing from word
 
How do I import a simple Single column) outline from word?
I've exported files from word in the obvious formats but .htm. .html and .doc are greyed out in the OO 'open' dialog.
.xml files are not greyed out, but I just get a message 'The document could not be read'

Surely this is possible?

DerekM 2009-07-06 09:24 AM

To retain the outline structure, it needs to be formatted with leading tab spaces which Word doesn't save to. You would have to copy and paste the text over and manually re-indent it. Generally you would create your outline in OmniOutliner and then move to Word to write it all out if needed which is why there isn't as much focus on importing in OO3.

RobTrew 2009-07-06 10:57 PM

[QUOTE=DerekM;62284]Generally you would create your outline in OmniOutliner[/QUOTE]

Well, not if you had to spend part of your day working on Windows, you wouldn't :-)


[QUOTE=DerekM;62284]You would have to copy and paste the text over and manually re-indent it.[/QUOTE]

A delightful pastime !

In order to avoid this kind of thing, I wrote a [URL="http://files.me.com/robinfrancistrew/55z6zk"]simple utility[/URL] a few years ago.

(MS Word is, after all, very likely to be the most widely-used outliner there is, not least because it and its clones are rather more cross-platform than OmniOutliner).

If you:[LIST=1][*]Open your outline in Word,[*]run [URL="http://files.me.com/robinfrancistrew/55z6zk"]ReadTree[/URL][*]choose [B]File > Import > Active Word Outline[/B] from the ReadTree menu,[/LIST]
ReadTree will capture the word outline, and you can then choose:[LIST][*][B]File > Export > OmniOutliner 3[/B],[*]or [B]File > Save As[/B] (to .opml, also readable in OO3)[/LIST]
You are very welcome to try it.

--

PS - The simple capacity to import MS Word outlines in this way (without resorting to my utility) would be much appreciated in OO4.

The almost universal currency of MS Word outlines provides a route, for example, from the venerable [URL="http://www.inspiration.com/"]Inspiration[/URL] to Omnioutliner. (Despite its great antiquity, Inspiration still does a better job of diagramming outlines than OmniGraffle, which yields a slightly displeasing layout, with too many jagged lines, too much link space, too little text space, and a tendency to let right-angle links overlap in large outlines).

Rob

DerekM 2009-07-07 10:44 AM

Hey that's pretty neat. Would you mind if this was linked to on the extras page?

RobTrew 2009-07-07 02:45 PM

Thanks - you're very welcome to link to it.

I may not be able to maintain it very actively (not even sure that I still have a Realbasic compiler on my system).

How about including that kind of simple functionality in OO4 ?

Rob

DerekM 2009-07-07 03:03 PM

Oh believe me, importing Word and other common formats is well on the requested features list. We can not give a definitive answer either way right now :)

stolzy 2009-07-08 04:54 AM

Thanks for that - it does exactly what I want.
[QUOTE=DerekM;62350]Oh believe me, importing Word and other common formats is well on the requested features list. We can not give a definitive answer either way right now :)[/QUOTE]
People have been asking for simple word import functionality from OO for years now - I won't be holding my breath :-)

MacDeluxe 2009-08-09 05:57 PM

Error upon Import attempt
 
[QUOTE=RobTrew;62317]Well, not if you had to spend part of your day working on Windows, you wouldn't :-)


If you:[LIST=1][*]Open your outline in Word,[*]run [URL="http://files.me.com/robinfrancistrew/55z6zk"]ReadTree[/URL][*]choose [B]File > Import > Active Word Outline[/B] from the ReadTree menu,[/LIST]
ReadTree will capture the word outline, and you can then choose:[LIST][*][B]File > Export > OmniOutliner 3[/B],[*]or [B]File > Save As[/B] (to .opml, also readable in OO3)[/LIST]
You are very welcome to try it.

Rob[/QUOTE]

Thanks, Rob, but I'm running into a problem.

I followed the instructions and when I try to import the Active Word Outline, I get the following error message - "This program needs to be run from the \Office folder of the Microsoft Office installation"

I click OK and the next error message is - "No outline present in Word"

The ReadTree program is in the same folder as MS Word. I have restarted both programs and get the same error.

I'm running MS Office 2008 ver 12.1.5 in Mac OS 10.5.8

What am I doing wrong?

thanks in advance,
Billy

RobTrew 2009-08-09 10:26 PM

[QUOTE=MacDeluxe;64314]I'm running MS Office 2008 ver 12.1.5 in Mac OS 10.5.8[/QUOTE]

Oddly enough, I am now getting the same. Something seems to have broken it since July.

My first guess was Office, but you are running 12.1.5 (I am running 12.2.1)

10.5.8 perhaps ?

I will investigate when I get a moment.

In the meanwhile, does anybody have a system on which this is still working ? If so, what OS X and Office versions are you running ?

[COLOR="White"]--[/COLOR]

MacDeluxe 2009-08-09 11:10 PM

[QUOTE=RobTrew;64317]Oddly enough, I am now getting the same. Something seems to have broken it since July.

My first guess was Office, but you are running 12.1.5 (I am running 12.2.1)

10.5.8 perhaps ?

I will investigate when I get a moment.

In the meanwhile, does anybody have a system on which this is still working ? If so, what OS X and Office versions are you running ?

[COLOR="White"]--[/COLOR][/QUOTE]
FWIW, I have another machine here running 10.5.6 and office 12.0.0 that reports the same error with the same file.

?

thanks,
Billy

RobTrew 2009-08-09 11:32 PM

That's interesting.

Meanwhile Applescript is now returning "Missing value" for the [I]OutlineLevel[/I] property of Word paragraphs ...

[COLOR="White"]--[/COLOR]

RobTrew 2009-08-10 01:26 AM

As a stop gap, here is a very rough first draft of an Applescript which aims to pull an outline from a currently open Word document into OO3.

No error checking yet, but may suffice for simple cases.

[CODE]-- Rough sketch - no guarantees (explicit or implied) of how it will behave
-- Ver 002

on run
tell application "Microsoft Word"
if (count of documents) < 1 then
display dialog "Open an outline in Word, and try again"
return
end if
end tell

set lstParas to GetWdParas()

tell application "OmniOutliner Professional"
set oDoc to make new document
end tell

Paras2OO(oDoc, lstParas)
end run

on Paras2OO(oDoc, lstParas)
-- Loop through paras maintaining list of level parents
set lstLevelParents to {"", "", "", "", "", "", "", "", ""}
using terms from application "OmniOutliner Professional"
tell oDoc
repeat with lstPara in lstParas
set lngLevel to item 1 of lstPara
if lngLevel > 0 then
set oParent to item lngLevel of lstLevelParents
end if

if lngLevel > 1 then
set oRow to make new row at end of children of oParent with properties {topic:item 2 of lstPara}
else
if lngLevel > 0 then
set oRow to make new row at end of children with properties {topic:item 2 of lstPara}
else
tell oRow
set note to note & item 2 of lstPara
end tell
end if
end if
if lngLevel > 0 then
set item (lngLevel + 1) of lstLevelParents to oRow
end if
end repeat
set expanded of every row to true
end tell
end using terms from
end Paras2OO


on GetWdParas()
tell front document of application "Microsoft Word"
-- get list of paras and their outline levels
set lstParas to {}

set oParas to paragraphs
repeat with oPara in oParas
-- Get heading level from style name
set strStyle to name local of style of oPara
set my text item delimiters to " "
set lstParts to text items of strStyle
if length of lstParts > 1 then
if item 1 of lstParts ≠ "Heading" then
-- not an outline header
set strText to (content of text object of oPara)
set lstParas to lstParas & {{0, strText}}
else
set lngLevel to (item 2 of lstParts) as integer

-- Get text without trailing /r
set strText to (content of text object of oPara)
set my text item delimiters to ""
set lngChars to length of strText
if lngChars > 1 then
set strText to (characters 1 thru (lngChars - 1) of strText) as string
end if
set lstParas to lstParas & {{lngLevel, strText}}
end if
else
-- not an outline header
set strText to (content of text object of oPara)
set lstParas to lstParas & {{0, strText}}
end if
end repeat
end tell

-- Ensure that highest level paras are level 1
set lngMin to 9
repeat with lstPara in lstParas
set lngLevel to item 1 of lstPara
if lngLevel > 0 then
if (lngLevel < lngMin) then
set lngMin to lngLevel
end if
end if
end repeat

if lngMin > 1 then
set lngDelta to lngMin - 1
repeat with lstPara in lstParas
set item 1 of lstPara to (item 1 of lstPara) - lngDelta
end repeat
end if

--Attend to over-indentations in Word by inserting bridging paras

return lstParas
end GetWdParas
[/CODE]

MacDeluxe 2009-08-10 07:29 AM

I compiled and ran the script and it churned through the Word doc, but stalled when it tried to create a new OO document with an error. "The variable oRow is not defined".

I don't know very much about AppleScript, so I'm not sure if this stuff is useful.

This is the text in the bottom window of the script editor when the hairball occurs.

tell application "OmniOutliner Professional"
make new document
document id "c-guTw8kzJV"
"The variable oRow is not defined."

This was the highlighted occurrence of oRow in the upper script window when it snarled -

else
tell [I][B]oRow[/B][/I]
set note to note & item 2 of lstPara
end tell


Thanks so much for working on this, Rob. If it doesn't work out, it's not a show-stopper for me.

I really do wish that outliner documents were more portable between implementations. I've been using them since the days of More in OS7, and then I used Inspiration for years. Now, Omni Outliner is my current favorite. I'm hopeful that they can keep developing the capabilities of the program.

I still miss More.

Billy

RobTrew 2009-08-10 07:48 AM

Sounds as if your document may contains a non-heading (ordinary text) paragraph which is not preceded by a heading para.

This edit should handle such cases:

[CODE]-- Rough sketch - no guarantees (explicit or implied) of how it will behave
-- Ver 003

on run
tell application "Microsoft Word"
if (count of documents) < 1 then
display dialog "Open an outline in Word, and try again"
return
end if
end tell

set lstParas to GetWdParas()

tell application "OmniOutliner Professional"
set oDoc to make new document
end tell

Paras2OO(oDoc, lstParas)
end run

on Paras2OO(oDoc, lstParas)
-- Loop through paras maintaining list of level parents
set lstLevelParents to {"", "", "", "", "", "", "", "", ""}
using terms from application "OmniOutliner Professional"
tell oDoc
repeat with lstPara in lstParas
set lngLevel to item 1 of lstPara
if lngLevel > 0 then
set oParent to item lngLevel of lstLevelParents
end if

if lngLevel > 1 then
set oRow to make new row at end of children of oParent with properties {topic:item 2 of lstPara}
else
if lngLevel > 0 then
set oRow to make new row at end of children with properties {topic:item 2 of lstPara}
else
tell oRow
set note to note & item 2 of lstPara
end tell
end if
end if
if lngLevel > 0 then
set item (lngLevel + 1) of lstLevelParents to oRow
end if
end repeat
set expanded of every row to true
set note expanded of every row to true
end tell
end using terms from
end Paras2OO


on GetWdParas()
tell front document of application "Microsoft Word"
-- get list of paras and their outline levels
set lstParas to {}

set oParas to paragraphs
repeat with oPara in oParas
-- Get heading level from style name
set strStyle to name local of style of oPara
set my text item delimiters to " "
set lstParts to text items of strStyle
if length of lstParts > 1 then
if item 1 of lstParts ≠ "Heading" then
-- not an outline header
set strText to (content of text object of oPara)
set lstParas to lstParas & {{0, strText}}
else
set lngLevel to (item 2 of lstParts) as integer

-- Get text without trailing /r
set strText to (content of text object of oPara)
set my text item delimiters to ""
set lngChars to length of strText
if lngChars > 1 then
set strText to (characters 1 thru (lngChars - 1) of strText) as string
end if
set lstParas to lstParas & {{lngLevel, strText}}
end if
else
-- not an outline header
set strText to (content of text object of oPara)
set lstParas to lstParas & {{0, strText}}
end if
end repeat
end tell

-- Ensure that highest level paras are level 1
set lngMin to 9
repeat with lstPara in lstParas
set lngLevel to item 1 of lstPara
if lngLevel > 0 then
if (lngLevel < lngMin) then
set lngMin to lngLevel
end if
end if
end repeat

if lngMin > 1 then
set lngDelta to lngMin - 1
repeat with lstPara in lstParas
set item 1 of lstPara to (item 1 of lstPara) - lngDelta
end repeat
end if

--Attend to over-indentations in Word by inserting empty bridging paras at intermediate levels
set lngPrevLevel to 0
set lstBridge to {}
set lngParas to length of lstParas
set lstAllParas to {}
repeat with iPara from 1 to lngParas
set lstPara to item iPara of lstParas
set lngLevel to item 1 of lstPara
if lngLevel > 0 then
if lngLevel > lngPrevLevel then
set lngDelta to lngLevel - lngPrevLevel
if lngDelta > 1 then
repeat with iLevel from (lngPrevLevel + 1) to (lngLevel - 1)
set lstBridge to lstBridge & {{iLevel, ""}}
end repeat
set lstAllParas to lstAllParas & lstBridge & {lstPara}
set lstBridge to {}
else
set lstAllParas to lstAllParas & {lstPara}
end if
else
set lstAllParas to lstAllParas & {lstPara}
end if
set lngPrevLevel to lngLevel
else -- Level = 0
if lngPrevLevel > 0 then
set lstAllParas to lstAllParas & {lstPara}
else -- text para has no preceding header para
set lstAllParas to lstAllParas & {{1, ""}} & {lstPara}
set lngPrevLevel to 1
end if
end if
end repeat
return lstAllParas
end GetWdParas
[/CODE]

MacDeluxe 2009-08-10 08:16 AM

Thanks so much, Rob.

I went back to the original Inspiration document and removed the notes fields and re-entered them as outline items. Then I re-exported to Word and ran the script and it worked great.

I owe you a soda pop.

Billy

DerekM 2009-08-10 09:49 AM

Using the "Plain Text of Active Outline" option works for me. The "Active Outline" option didn't work when I tried it back in July either, should have mentioned something then.

RobTrew 2009-08-10 11:53 AM

That makes sense.

The applescript does much the same as the "Plain Text of Active Outline" and does at least cut out the OPML stage.

RedGrass 2009-08-23 01:47 PM

[QUOTE=RobTrew;64345]That makes sense.

The applescript does much the same as the "Plain Text of Active Outline" and does at least cut out the OPML stage.[/QUOTE]
The Scrivener forum has a programme script for download that converts Word docs to OPML or multimarkdown. Search Literature and Latte forums for: "Oultline Converter 080322"

joshfree 2010-01-24 10:16 AM

Rob, this is great. I'm excited to try it out. But I'm trying to go the other way --- use an OO outline in Word, and retain the levels and structure. Is there anything you're aware of that will do this? Can't seem to figure it out, and I'm not a programmer (or scripter). Thanks!

joshfree 2010-01-24 11:11 AM

Reporting back: Word 12.2.3, OS 10.6.2 and OO 3.95. -- works perfectly. Now if only I can get some way to go the other direction. OO 4.0 is supposed to do it, I guess.

RobTrew 2010-01-25 06:45 AM

[QUOTE=joshfree;72267]Now if only I can get some way to go the other direction. [/QUOTE]

I find that exporting to Word format (.docx) from oo3 retains the outline level. (Switch to [B]View>Outline[/B] in Word).

The inescapable architectural limit is, of course, that OO3 supports an arbitrary level of indentation, whereas "Heading Level 9" is Word's deepest level of indentation. Anything deeper in OO3 is bound to be flattened.

Yata-Hey 2010-02-06 11:41 AM

[QUOTE=RobTrew;72305]I find that exporting to Word format (.docx) from oo3 retains the outline level. (Switch to [B]View>Outline[/B] in Word).

The inescapable architectural limit is, of course, that OO3 supports an arbitrary level of indentation, whereas "Heading Level 9" is Word's deepest level of indentation. Anything deeper in OO3 is bound to be flattened.[/QUOTE]

I just want to add my two cents. What has kept me from adopting OO in the past is that it does not play real well with MSWord. I have 20 years invested in Word and need to be able to go both ways preserving outline levels, to be able to make the switch. Like it or not, it is a Word world!

TheCPT 2011-03-30 09:56 PM

importing from Outline Numbered Styles, cumbersome but doable
 
importing from Outline Numbered Styles, cumbersome but doable: See my post on another thread if that is what you are looking for...


[url]http://forums.omnigroup.com/showthread.php?t=20561[/url]

...Ed 2013-01-17 05:32 AM

Would someone please post a new link to ReadTree? The one posted goes to MobileMe, which is history. THANKS! ...Ed

RobTrew 2013-01-17 02:59 PM

[url]http://complexpoint.macmate.me/public/ReadTree.app.zip[/url]


All times are GMT -8. The time now is 02:28 PM.

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