I've got a openoffice doc which I'll use as a template, in it I've written strings like "To: {name}". I want to make a copies of this document and replace the {name} part with data from a database using c#.
Would aodl or CLI_UNO_EX be suited to use for this task? Do anybody know if there is any code examples available that does something like this?
Any help would be appreciated.
The administrator has disabled public write access.
Re:search & replace in an openoffice doc
Date: 2007/01/24 21:56
By: Lars B
Status: Admin
Karma: 1  
Admin
Posts: 33
Hi,
you could use both, but by using CLI_UNO_EX OpenOffice.org must be installed on the target computer. By using AODL this isn't required. With AODL you could simply iterate over the content ArrayList of the document. Then check if it's a Paragraph object and when yes if it contains the subject to replace.
Regards LarsB
The administrator has disabled public write access.
Re:search & replace in an openoffice doc
Date: 2007/02/27 06:01
By: Håvard
Status: User
Karma: 0  
Fresh Boarder
Posts: 3
I didn't get this working, but giving it a try again. I'm kind of stuck trying to open the document. Here is what I'm trying now:
foreach (IContent iContent in doc.Content) { if (iContent is Paragraph) { if (((Paragraph)iContent).TextContent.Contains(txt_old)) { ((Paragraph)iContent).TextContent.Add(txt_new); ((Paragraph)iContent).TextContent.Remove(txt_old); } }
Gives this error: Exception Details: System.UnauthorizedAccessException: Access to the path 'C:WINDOWSsystem32aodlread' is denied.
Any advice?
The administrator has disabled public write access.
Re:search & replace in an openoffice doc
Date: 2007/02/27 15:58
By: Lars B
Status: Admin
Karma: 1  
Admin
Posts: 33
Hi,
AODL need full system rights. Make sure that AODL has execute and write rights in the current executing folder.
Regards Lars
The administrator has disabled public write access.
Re:search & replace in an openoffice doc
Date: 2007/03/02 04:29
By: Håvard
Status: User
Karma: 0  
Fresh Boarder
Posts: 3
Hi again, I'm still stuck
I've tryed to give the following accounts full rights to the directory: ASPNET IUSR_Machine IWAM_Machine everyone anonymous
And as a test I did this in the same code System.IO.File.Create("e:inetpubwwwrootmailmergedocstest.txt");
The file appeared but still getting the same error with AODL.
The administrator has disabled public write access.