OpenDocument4all - Info and tools about OpenDocument
Saturday, 19 May 2012
Home arrow Forum
Forum Statistics
Total user: 91
Total message: 181
Main Menu
Home
My Blog
AODL - Project
AODC - Project
OO Development & Info
Forum
About OpenDocument ...
Search
News
Contact Us
Login Form





Lost Password?
No account yet? Register
Sourceforge.net

SourceForge.net - Goto the project homepage
Project site on SF.net

 

Demand OpenDocument

 

Countomat Webcounter und Webstatistik (Statistik & Logfileanalyse, Counter)

OpenDocument4all-Forum

 
search & replace in an openoffice doc
Date: 2007/01/24 19:27 By: Håvard Status: User  
Karma: 0  
Fresh Boarder

Posts: 3
graphgraph
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
graph
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
graphgraph
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:

TextDocument doc = new TextDocument();
doc.Load("e:inetpubwwwroottesttest.odt");
IText txt_old = null;
txt_old.Text = "navn";
IText txt_new = null;
txt_new.Text = "havard";

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
graph
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
graphgraph
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.

Quick jump
Download area
Who's Online
We have 27 guests online
Polls
Should AODL and AODC also implement export as PDF and RTF?
 
Popular
© 2005 MamboZ. All rights reserved.