How to create OpenOffice Calc document programmatically (C++)?

Hi,

I am using Microsoft Visual C++ 8 (VS 2005) and I need to create OpenOffice Calc document programmatically from inside my C++ application. Is there any short example/tutorial?

Thanks.
LVL 30
peprAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bijopuliCommented:
Hi

This will be a great resource:

http://udk.openoffice.org/common/man/spec/ole_bridge.html

Regards
Bijo.
0
rstaveleyCommented:
MS Office automation is generally called upon for MS Excel on Windows platforms and it looks like you can automate OOo likewise - see http://udk.openoffice.org/common/man/tutorial/office_automation.html and follow the link to the StarOffice programmer's tutorial - but you're on your own there as far as I'm concerned.

I can vouch that HSSF does a great job of it in Java - see http://jakarta.apache.org/poi/hssf/index.html.

Otherwise, OOo is open source, which means you ought to be able to dig around in it, but that's unlikely to be quick gratification.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

peprAuthor Commented:
Thanks to all. Sorry for being late with my reaction. However, I am fighting with it without success. Is there any step-by-step tutorial what should be done from scratch? I am not able to make the thinks working.

I have downloaded and installed the OpenOffice 2.2 (stable) for Windows as OOo_2.2.0_Win32Intel_install_en-US.exe. The applications work fine (at least it seems so).

Then I have downloaded SDK instalation pack as OOo-SDK_2.2.0_Win32Intel_install.exe and installed it. Then I tried to run "C:\Program Files\OpenOffice.org_2.2_SDK\setsdkenv_windows.bat" to set the environment. Then I have noticed that I probably need URE (UNO Runtime Environment).

So, I have downloaded OOo-URE_1.2_windows_install_en-US.exe and installed. Then I forced the
"C:\Program Files\OpenOffice.org_2.2_SDK\setsdkenv_windows.bat --force-configure". When runnig the batch again now, it reports:

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

 ******************************************************************
 *
 * SDK environment is prepared for Windows
 *
 * SDK = C:\Program Files\OpenOffice.org_2.2_SDK
 * Office =
 * URE = C:\Program Files\URE
 * Make = c:\cygwin\bin
 * Zip = d:\usr\bin
 * C++ Compiler = C:\Program Files\Microsoft Visual Studio 8\VC\bin
 * C# and VB.NET compilers = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
 * Java =
 * Special Output directory = c:\tmp
 * Auto deployment = NO
 *
 ******************************************************************

I am not sure about some of the settings. For example, the batch wanted directories but maybe it wanted full paths to the tools? Another problem, C# and VB.NET is not inside the directory, but I guess that I do not need them for C++.

When running make (from cygwin) for the example disussed in document pointed by jkr, the result looks like this:

C:\...xamples\DevelopersGuide\ProfUNO\CppBinding>make
/bin/sh: ../../../../config.guess: No such file or directory
mkdir ..\\..\\..\\..\\WINexample.out\\inc\\ProfUnoCppBinding\\com\\sun\\star\\uno
mkdir: cannot create directory `..\\..\\..\\..\\WINexample.out\\inc\\ProfUnoCppBinding\\com\\sun\\star\\uno': No such file or directory
make: [../../../../WINexample.out/inc/ProfUnoCppBinding/com/sun/star/uno/XNamingService.hpp] Error 1 (ignored)
"/windows/bin/cppumaker" -Gc -BUCR -O../../../../WINexample.out/inc/ProfUnoCppBinding -Tcom.sun.star
.uno.XNamingService -Tcom.sun.star.uno.XComponentContext -Tcom.sun.star.uno.XWeak -Tcom.sun.star.uno
.XAggregation -Tcom.sun.star.lang.XMain -Tcom.sun.star.lang.XMultiServiceFactory -Tcom.sun.star.lang
.XSingleComponentFactory -Tcom.sun.star.lang.XTypeProvider -Tcom.sun.star.lang.XComponent -Tcom.sun.
star.registry.XSimpleRegistry -Tcom.sun.star.registry.XImplementationRegistration -Tcom.sun.star.bri
dge.XBridgeFactory -Tcom.sun.star.bridge.XUnoUrlResolver -Tcom.sun.star.container.XHierarchicalNameA
ccess "\types.rdb"
/bin/sh: /windows/bin/cppumaker: No such file or directory
make: *** [../../../../WINexample.out/inc/ProfUnoCppBinding/com/sun/star/uno/XNamingService.hpp] Err
or 127

I do not know, for example, if the things could be done in C++ without UNO (URE), and what should be the /windows/bin/cppumaker.

Any other hint?

Thanks
0
peprAuthor Commented:
I have assigned the point by just feeling who of you is the closer to the answer. I did not try hard enough to solve the problem (postponed). Thanks anyway.
0
rstaveleyCommented:
Sorry I missed your post on 12th (I've had my nose to the grindstone), but if you are missing cppumaker, it looks like you haven't installed the Uno SDK or that you've installed the tool somewhere different from \windows\bin.

Here's a link for the SDK download, if and when you pick up the pieces of this project again:

http://download.openoffice.org/2.1.0/sdk.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
LibreOffice

From novice to tech pro — start learning today.