Search code examples
.netwindowsopenoffice-writer

Converting SXW to PDF without OpenOffice automation


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?


Solution

  • 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.