OpenOffice and .NET
Asked Answered
A

5

18

Is there a .NET API for OpenOffice?

EDIT: Is there a OpenOffice SDK for .NET?

Andreaandreana answered 23/12, 2008 at 20:30 Comment(0)
J
4

Novel has a branch of OOo that adds mono capabilities, so you can use these builds for scripting via .Net inside OOo. The document formats for OOo (except for Base) is XML + resources in a zip container. If you need programmatic access beyond manual file manipulation, your best bet is to use the ActiveX control with COM Interop. If you want to use Base as a datasource in .Net, it is near impossible, as it's an embedded Java database structure without a mature .net port.

Jurist answered 23/12, 2008 at 20:46 Comment(0)
M
8

If you have OpenOffice installed, then you can use the "OpenOffice SDK" (current version here) to control that instance from several programming environments, including .NET. You can use OpenOffice this way to accomplish a number of different things; one example is converting files from one file format to another. It's analogous to how you can control Microsoft Office via COM.

A set of CLI/.NET bindings come with the SDK, and are by default installed in (example for SDK v3.0):

C:\Program Files\OpenOffice.org_3.0_SDK\sdk\cli

I've found Mark Alexander Bain's Creating an OpenOffice Calc Document with C# to be the most straightforward, hands-on, introductory article to controlling OpenOffice that way.

The CLI bindings are mostly a port/mapping of the non-.NET object model, so you'll want to get into things like the non-.NET-specific OpenOffice API Developer's Guide.

So far the main difference I've found between the CLI bindings and the other documentation is that with the CLI bindings you cast an object to a new interface using normal .NET cast syntax rather than with the UnoRuntime.queryInterface() method. For example, instead of

XComponentLoader xComponentLoader =
    (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop);

just use

XComponentLoader xComponentLoader = (XComponentLoader)desktop;

There are also some pretty technical docs of how the OpenOffice/UNO stuff gets mapped onto .NET concepts in the CLI binding here: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/CLI/CLI_Language_Binding

Messere answered 10/9, 2009 at 22:29 Comment(1)
Bain's link needs updating Creating an OpenOffice Calc Document with C#Cowell
J
4

Novel has a branch of OOo that adds mono capabilities, so you can use these builds for scripting via .Net inside OOo. The document formats for OOo (except for Base) is XML + resources in a zip container. If you need programmatic access beyond manual file manipulation, your best bet is to use the ActiveX control with COM Interop. If you want to use Base as a datasource in .Net, it is near impossible, as it's an embedded Java database structure without a mature .net port.

Jurist answered 23/12, 2008 at 20:46 Comment(0)
V
4

This might help:

"AODL is the .net module of the ODF Toolkit. The library is completly written in pure C# and can be used to extend your .net based software to support the OpenDocument Format. To use AODL within your projects respectively software there is no need of a deep knowlegde of the OpenDocument Format itself. It would be helpfull to understand what's going behind the scenes and for writing your own extensions, but as mentioned before this isn't a fundamental requirement."

This module has been abandoned during the Apache incubator transition, recent official binary or sources downloads are unavailable (see newsgroup post 1, newsgroup post 2, newsgroup post 3.

The most recent binary download is v1.2.0.1 available inside the old ADL SourceForge project page, while what seems to be the most recent source code resulting in a (abandoned too) fork is available on Bitbucket (the documentation and changelog included in the source tree read v1.3.0.0) and compiles just fine.

In the future there might be an official alternative in the new ODFDOM, whose generator is supposed to support .NET/C#/etc one day:

The ODFDOM Code Generator is used to generate the core Classes for ODFDOM which are a typed mapping of the ODF elements on real Java Classes. For the future we also plan to generate ODFDOM e.g. C# ( .NET ) for other programming languages with this generator.

Veranda answered 23/12, 2008 at 21:42 Comment(1)
The lisence for the AODL Library is GNU. Not great for commercial closed source software even though it is very easy to use.Tael
S
0

Depends on your needs. Most of the OpenOffice document formats are XML readable, and creatable.

Sheepdip answered 23/12, 2008 at 20:38 Comment(0)
P
0

Open Document Format API for .NET Framework

The API supports Open Document Format standard as defined in the OASIS Open Document Format. ODF .NET allows you to write applications to create, modify and parse text documents and spreadsheets. Supports all versions of .NET Framework, .NET Compact Framework and Mono.

Plastid answered 15/9, 2012 at 17:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.