‘Manual’ for Word to XML export routine

Files

 

What the program does

The program is just a Word macro.  It takes an outline created in microstuff word and puts it into XML format which can be read by Shadow desktop.

Word has an outline view that allows you to use it as an outliner that shows heading levels as outline levels and allows you to do outliner stuff like expand/collapse levels, drag trees around, indent/outdent etc.  If you already have data in a word outline (or can import it into word from another outliner) then this macro allows easy transfer into Shadow.

(If you want to get your data from shadow back into a word doc just use Shadows save function to save as .html.  Word can import this directly.)

‘Installation’

This is a macro so theres no real installation – it’s just a case of adding the Macro into Word.  To do that...

Unzip the files to any directory.  Import the .bas file into your word macros.  If you arn’t familiar with this, the steps are:

·          Open up Word

·          In Word2000 press Alt+F11 or Select Tools –> Macro --> Visual Basic Editor

·          In the Visual basic window there should be a sidebar titled “Project – something”  If not press Ctrl+R to call it up

·          Expand the entry “Normal” by clicking on it or the +

·          Click on the “Modules” subfolder.  This allows the macro to be added to the Normal.dot template

·          select File --> Import and select the file Export-to-XML.bas

You should now have a new entry under Modules, probabIy called NewMacros12

 

Select the Normal template (Ctrl+S or File-->Save) and close the Visual basic window.

 

Thats it.  The macro is now in and can be run.  If you like you now can give it a shortcut key combo and/or add a macro button.

Adding a Macro button

If you want to simplify running the macro you can add a toolbar button to make it a ‘one click’ operation. To add a macro button:

·          In an open Word doc, Right click on blank area next to the toolbar buttons

·          Select customise.

·          On the Customise dialogue, select the "Commands" tab

·          In the left pane called Categories, select "Macros", then in the right window pane (commands) scroll down to the macro named “Normal.NewMacros12.ExporttoXML"

·          Left click on the macro name and hold and drag it over to the buttons area - the cursor will change to an insertion bar - release the left mouse button and the button will be inserted at that point.

 

·          (To remove the button reverse the process i.e. drag the button off the toolbar into the customise dialogue.)

 

·          To Add/Change the ICON, keep the Customise menu open and right click on the toolbar button you just added.  Select "Image and text", select "Change button image" and pick one you like.  I use the Floppy disk with an up arrow.  (You can even paste/edit your own image from the clipboard).  Change the Name to "ExporttoXML" or whatever is meaningfull to you.

 

Using it

Open the MS .DOC format outline you want to convert.  (If there is more than one Word document open the macro will convert the currently active document.)

The routine does not modify your file in any way.  It creates a working copy in memory which is closed when the routine finishes.

The output is saved in the same directory as the source doc.  It’s not closed so that you can quickly see if it looks ok.

Be prepared to wait – see Notes below

If the input file has not been saved or has been modifed since it was opened, you will be prompted to save the file.

If the output (XML) file already exists you will be asked if you want to overwrite it or to select a new name/location.

To run it, if you have created a button just click the button.

Otherwise Select Tools --> Macro --> Macros.  Scroll to Macro named “ExporttoXML” the click RUN.

 

I’ve included a short ‘Word’ test file – if you run the macro on ShortTestFile.doc it will produce the same as ShadP-ShortTestFile.xml (& in the same directory).

Notes:

The routine may take a while if you have a large outline is large.  I timed an approx 2500line (8000word) outline as taking about 20minutes on a 600MHz PC so be prepared to take a break - allow, say, 1min per 100 lines.

There’s no progress bar, you just have to wait for things to finish.

I might add a started and finished message box but that would be two extra clicks (I don’t know how to get Word to display a message without a ‘click’ button)

 

Mac users:  The path seperators are system independent so it should work on a Mac running a recent version of Word – please let me know if it doesn’t.

The XML output is just raw text.

The main macro ExporttoXML calls two other included macros – writeout and replaceXMLreserved so don’t be suprised to see them.

Input Format

 It is assumed that the input is basically a text file.  The routine can handle embedded tables but if you have graphics or other objects all bets are off.

Tables are converted to tabbed text – Each row becomes a new title (shadow item) with each column separated by a tab.  If you have a carriage return in the middle of a table that will start a new title.

Word allows 9 outline levels plus ‘normal’ text.  Text is treated as another level.

Special XML characters such as & <> will not cause a problem (famous last words!).

Items marked as strikethrough are flagged as “completed".

routine should be able to handle extended ASCII characters such as the degree symbol.

Bold text is shown as bold in Shadow.

 

Known Issues:

Limitations

You may you some characters which are not recognised by Shadow. Tip - If Shadow barfs, look at the xml file with Internet explorer - it can be more forgiving, sometimes reading upto the error thus giving an indication of where the problem lies.  If theres only a few of these you can then edit out the offending characters either in the source .doc or in the .xml (its just a text file).

I suspect that ‘foreign language’ characters will cause a problem also.  I’d like to sort this out as I suspect if may be a problem for some, so please let me know if you come across this - any help would be most welcome.

No check for excessive length titles.

Support

Please let me know if you find any issues at vjornes at yahoo.com – or just post a message to the Shadow Desktop list.  If you have a problem with the resulting xml try to see where it messed up as noted in ‘limitations’.

Warranty

Yeah, right!