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

Keyboard macros or custom scripts

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

Postby Netcoder1989 » Mon Mar 18, 2013 2:30 pm

is there any programming tutorial that gives the basic overview of using openoffice.

Please help me in this.
openoffice 3.4.1 on Windows7
Netcoder1989
 
Posts: 7
Joined: Mon Mar 11, 2013 12:57 pm

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

Postby RoryOF » Mon Mar 18, 2013 2:33 pm

Apache OpenOffice 4.1.6 on Xubuntu 18.04 (mostly 64 bit version) and infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 27665
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby Netcoder1989 » Mon Mar 18, 2013 2:37 pm

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?
openoffice 3.4.1 on Windows7
Netcoder1989
 
Posts: 7
Joined: Mon Mar 11, 2013 12:57 pm

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

Postby darrenbang » Mon Jul 15, 2013 8:34 am

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   Expand viewCollapse view
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
darrenbang
 
Posts: 1
Joined: Mon Jul 15, 2013 8:30 am

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

Postby balmerhevi » Sat Nov 12, 2016 8:02 am

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
OpenOffice 3.1 on Windows Vista
balmerhevi
 
Posts: 2
Joined: Sat Nov 12, 2016 7:58 am


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 4 guests