Save OpenOffice.org text document in a database

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
noni
Posts: 2
Joined: Tue Apr 26, 2011 9:44 am

Save OpenOffice.org text document in a database

Post by noni »

Hi there,

I am developing application in C# . Net using Visual Studio 2008, and for storage I use MS SQL Server 2005.
However I want my application to store open office document template in the database as XML and then I want to add possibility to retrieve this document and open in OpenOffice 3.3.
I have tried to store content.xml, the manifest, configuration, styles, settings as separate xml data records in the database using AODL library which I have found on the net. But when I try to retrieve and open the document it says that the file is corrupted.

Can anyone, please give me any advise?

Thank you.
OpenOffice 3.3
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Save OpenOffice.org text document in a database

Post by rudolfo »

noni wrote:But when I try to retrieve and open the document it says that the file is corrupted.
What do you mean with this? Do you retrieve a binary stream or object from the database? Or do you read the several different XML text files that make up the content of the odf document's zip archive? Do you open it with OpenOffice Writer or do you open it with your own .NET application?
Looking at the AODL library's documentation I would rather say that the recommended way to do this is to use the exporter and importer interface.
I remember there is an extension for storing the xml files of an odf document in a subversion repository for meaningful external source control. I think development on this has stopped, but I am not sure. But most probably they had to cope with the same kind of problems as you have to. Maybe you can get some inspiration from that project ...
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
noni
Posts: 2
Joined: Tue Apr 26, 2011 9:44 am

Re: Save OpenOffice.org text document in a database

Post by noni »

I read several different XML text files, and I am trying to open it with OpenOffice Writer, but I want to run OpenOffice Writer with my own .Net application, even if I try to open with OpenOffice Writer it says corrupted file, but it opens then.

I have made some changes at the AODL exporter and importer so I can Load from XML, but I think I am missing something.

Anyway, thanks
OpenOffice 3.3
rudolfo
Volunteer
Posts: 1488
Joined: Wed Mar 19, 2008 11:34 am
Location: Germany

Re: Save OpenOffice.org text document in a database

Post by rudolfo »

How can you open your text document with OpenOffice Writer? I thought the content of your documents is stored in the database tables. The only thing that my OOo Writer understands is a zip archive with the extension .odt. Even if I unzip the archive to a directory with the content

Code: Select all

-rw-rw-rw-        39  17-Feb-2011  12:30:12  mimetype
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/statusbar/
-rw-rw-rw-         0  17-Feb-2011  12:30:12  Configurations2/accelerator/current.xml
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/floater/
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/popupmenu/
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/progressbar/
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/menubar/
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/toolbar/
drwxrwxrwx         0  17-Feb-2011  12:30:12  Configurations2/images/Bitmaps/
-rw-rw-rw-      3418  17-Feb-2011  12:30:12  content.xml
-rw-rw-rw-     11040  17-Feb-2011  12:30:12  styles.xml
-rw-rw-rw-       992  17-Feb-2011  12:30:12  meta.xml
-rw-rw-rw-       988  17-Feb-2011  12:30:12  Thumbnails/thumbnail.png
-rw-rw-rw-      8510  17-Feb-2011  12:30:12  settings.xml
-rw-rw-rw-      1889  17-Feb-2011  12:30:12  META-INF/manifest.xml
and start Writer with either swriter.exe mimetype or swriter.exe content.xml it will refuse to do anything because it can't guess that the files mimetype, content.xml, meta.xml, ... that it finds in the current directory belong to the same document.
As far as I understood any interfaces Java, Python or C# are all bridges to UNO objects. They work on paragraphs, collections of styles, but they don't give you access to the GUI of the OpenOffice applications. If you need the GUI you will have to start OpenOffice in it's own process.
In other words I don't think that there is a difference between run OpenOffice Writer with my own .Net application and open it with OpenOffice Writer.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Post Reply