It's better when it's simple

User Tools

Site Tools


OpenOffice Macro

See also:

I just started to use DokuWiki and was looking for an OpenOffice to DokuWiki Converter, so after searching the web and trying I noticed that none of the existing converters was converting embedded pictures (using OpenOffice 3 and Windows XP)!

But I remembered that the Writer2MoinMoin Converter did, so I checked the Macro and found the difference.

I am absolutely no expert in Macros or anything, but I thought I would share the work I did. I basically added the routine to parse for the embedded pictures and put it in the DokuWiki Macro. I don't know how to make a super easy installable extension or anything else with this, but maybe someone knows and can improve this even further?

  * The Original routine is Copyright © 2005 Ian Laurenson
  * Improvements and replacements for MoinMoinWikiEngine: 2005 KlausHeinisch
  * Further improvements for MoinMoinWikiEngine: 2005 Marc Santhoff search for "[ms"
  * both put together by RG in December 2008

Since I can't upload anything I just put the changes I made in here:

const sTYPE_PNG = ".png"

change the line:
if oTextElement.supportsService("") Then

with this:
' [ms, detecting graphics attached to paragraph]
	if oTextElement.supportsService("") Then
		en = oTextElement.createContentEnumeration("")
		while en.hasMoreElements()
			el = en.nextElement()
			if el.supportsService("") then
				if InStr(el.GraphicURL, "file:///") > 0 OR InStr(el.GraphicURL, "http://") > 0 then
					subAddString(sPICTURESTART & FileNameoutofPath(el.GraphicURL) & sPICTUREEND)
				else ' embedded picture, no location known
					subAddString(sPICTURESTART & el.getName() & sTYPE_PNG & sPICTUREEND)
	' [ms, end]
tips/openofficemacro.txt · Last modified: 2011-02-21 11:28 by HåkanS

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki