Page 1 of 1

Tutorial for implementing OpenOffice in C++/C#/Java

Posted: Mon Mar 18, 2013 2:30 pm
by Netcoder1989
is there any programming tutorial that gives the basic overview of using openoffice.

Please help me in this.

Re: Tutorial for implementing OpenOffice in C++/C#/Java

Posted: Mon Mar 18, 2013 2:33 pm
by RoryOF
Tha various OpenOffice APIs are linked from
http://www.openoffice.org/api/
and the Developers Guide at
http://wiki.openoffice.org/wiki/Documen ... pers_Guide

Re: Tutorial for implementing OpenOffice in C++/C#/Java

Posted: Mon Mar 18, 2013 2:37 pm
by Netcoder1989
I'm trying to implement OpenOffice/LibreOffice Impress in my program.
I've average knowledge of C++/C# but I'm unable to implement this in my code.
getting bootstrap error.
Is there any problem in SDK or what?

Re: Tutorial for implementing OpenOffice in C++/C#/Java

Posted: Mon Jul 15, 2013 8:34 am
by darrenbang
Open Office Document formats are simple, every document is just simple Zip file containing XML files. Xml contains schema as well as data and reading them is pretty simple. If you just want to extract text out of them, then its easier, otherwise you can use System.Xml.Linq to read xml files to extract the data. To test, you can take any open office document, rename it as something.zip and extract and study its contents. You can use ISharpZip library to unzip in http://csharp.net-informations.com C# Tutorial and use Linq to study xml.

Add to references cli_bessatypes.dll, cli_cppuhelper.dll, cli_oootypes.dll, cli_uno.dll, cli_ure.dll and cli_uretypes.dll.

Code: Select all

XComponentContext oStrap = uno.util.Bootstrap.bootstrap();
XMultiServiceFactory oServMan = (XMultiServiceFactory)oStrap.getServiceManager();
XComponentLoader oLoader = (XComponentLoader)oServMan.createInstance("com.sun.star.frame.Desktop");
string fileName = "file:///" + filePath;

PropertyValue[] propVals = new PropertyValue[1];
propVals[0] = new PropertyValue();
propVals[0].Name = "Hidden";
propVals[0].Value.setValue(typeof(Boolean), true);
XComponent oXlsDocument = oLoader.loadComponentFromURL(fileName, "_default", 0, propVals);

XSpreadsheets oXlsSpreadsheet = ((XSpreadsheetDocument)oXlsDocument).getSheets();
XIndexAccess oXlsSheetIA = (XIndexAccess)oXlsSpreadsheet;
XSpreadsheet oXlsSheet = (XSpreadsheet)oXlsSheetIA.getByIndex(0).Value;
darren

Re: Tutorial for implementing OpenOffice in C++/C#/Java

Posted: Sat Nov 12, 2016 8:02 am
by balmerhevi
use LINQ

StringBuilder result = new StringBuilder();
foreach (XElement level1Element in XElement.Load(@"D:\product.xml").Elements("Brand"))
{
result.AppendLine(level1Element.Attribute("name").Value);
foreach (XElement level2Element in level1Element.Elements("product"))
{
result.AppendLine(" " + level2Element.Attribute("name").Value);
}
}

More...Read XML

Hevi