Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading Openoffice Calc (.ods) programmatically using c#?

I want to know if it is possible to read OpenOffice Calc spreadsheet programatically with c#, I can do this for Excel(.xls and .xlsx) but unable to find a solution for reading calc spreadsheet.

Help me if anyone has solution.

like image 344
bharath ayyagari Avatar asked Apr 03 '12 08:04

bharath ayyagari


2 Answers

ODF .NET - It works for c# and you can read and write.

Says like this on there page:

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.

like image 102
Arion Avatar answered Sep 23 '22 02:09

Arion


If you want to work directly against a headless OpenOffice/LibreOffice instance to manipulate the spread sheets, you are going to need to use OpenOffice/LibreOffice component interface UNO. This is a bit of a pain because of the casts that are required in strongly typed languages (UNO has bindings for many languages), deny you of the tooling you would expect unless you find a C# OpenOffice set of wrapper classes. There are other frameworks to manipulate the document but to work with it via OpenOffice directly this is the only way.

Here is some example code of someone creating an xls spread sheet with c#: Use OpenOffice Uno CLI with C# to create a spreadsheet

Here is the OpenOffice UNO reference: http://www.openoffice.org/api/docs/java/ref/overview-summary.html

like image 28
Quaternion Avatar answered Sep 24 '22 02:09

Quaternion