2

I have to convert old OpenOffice.org Writer documents (.sxw) to PDF without an installation of OpenOffice present. Is there a (open source or commercial) component (.NET) or commandline tool to do this?

Hinek
  • 9,519
  • 12
  • 52
  • 74

2 Answers2

1

IF a commercial tool is an option then I can recommend Aspose.Words - it works without any Office installation for OpenOffice and MS Office documents.

It can read/edit/write ODT/SXW/DOC/DOCX etc. and render PDF and XPS and a bunch of other formats...

(not affilliated, just a happy customer)

UPDATE - as per comments:

Since the above library isn't working on your SXW documents there is only the "hard way" to implement this... you will need to read the XML yourself and use any PDF library to render what you read...

There are some XSLTs (not for PDF) which should help creating something usable in your case - see http://twiki.informatik.unibw-muenchen.de/pub/TWiki/OpenOffice2TWikiAddOn/sxw.xslt for an XSLT (NOT PDF) which can give your some insight into the structure etc. and see http://www.ibm.com/developerworks/xml/library/x-think15/ too!

Depending on the quality you need you could use something like <xsl:value-of select="text()"/> as XSLT to extract just the text and then render that via any PDF library.

Last but not least: since SXW is really old you could ask that the documents be at least delivered in a more current file format like ODT.

Yahia
  • 69,653
  • 9
  • 115
  • 144
  • Yes, a commercial tool is an option for me, but Aspose.Words does not support SXW (at least it is not listed in the supported file formats) – Hinek Oct 31 '11 at 07:28
  • SXW is the same as ODT, just an older version (V 1.0 and V 1.1)... from experience it works with SXW too (may need to rename to .ODT)... download the trial to make sure it works with your SXW files... – Yahia Oct 31 '11 at 07:30
  • I would have liked that, but Document throws an UnsupportedFileFormatException, when I try to load the SXW ... :( – Hinek Oct 31 '11 at 08:01
  • Can you explain your other option? I know that SXW and ODT are XML in a ZIP file, but how should I read them as XML and still render them to PDF? Is there a XSLT for it? – Hinek Oct 31 '11 at 08:02
  • Ok, I will not go this way, but it seems the only way possible, so I will accept the answer and award the bounty before it expires... – Hinek Oct 31 '11 at 14:43
0

You might find this software useful http://www.softpedia.com/get/Office-tools/Other-Office-Tools/NW-Docx-Converter.shtml

I also found a website that converts the swx files to pdfs http://www.convertfiles.com/ (they also have a firefox addon)

I dont know if that helps How many files do you have to convert?

Xitcod13
  • 5,949
  • 9
  • 40
  • 81
  • Yes, I used google, too. But Docx2Rtf unfortunately cannot open my .sxw files (I don't know why). I also did find several websites, but a website/-service is not what I'm looking for, the conversion must be executed on the client. – Hinek Oct 31 '11 at 07:33