Page 1 of 1
How to Search and Replace in calc (ods) OpenOffice document
Posted: Sun Nov 16, 2014 11:35 am
by liste
I am using Delphi Vcl and I want to use Search&Replace command in openoffice or libreoffice calc program. there is one example in here (
http://stackoverflow.com/questions/7806 ... e-document ) but it is work in only odt file. I need for ods (calc) Find&Replace code for pascal or delphi
thanks for helps
Re: How to Search and Replace in calc (ods) OpenOffice docum
Posted: Sun Nov 16, 2014 4:49 pm
by karolus
Hallo
In Case of
Calc-files the Method .
.createReplaceDescriptor is available on Ranges like single sheets.
Code: Select all
...
sheet : = StarDocument.Sheets.getByIndex(0);
FileReplace := sheet.CreateReplaceDescriptor;
....
sheet.ReplaceAll(FileReplace);
Karolus
Re: How to Search and Replace in calc (ods) OpenOffice docum
Posted: Sun Nov 16, 2014 5:34 pm
by Charlie Young
I would add that there is one poorly documented property of the SearchDescriptor which is specific to Calc:
SearchType (not included in API-reference ) integer - Determines if the search should be done in cell formulas (0) values (1) or notes (2). [Calc only]
Re: How to Search and Replace in calc (ods) OpenOffice docum
Posted: Mon Nov 17, 2014 5:57 pm
by liste
hi Karolus
Thanks for answer. I try to test that code but there is no Create Replace Descriptor event on sheet object can you send me small sample?
karolus wrote:Hallo
In Case of
Calc-files the Method .
.createReplaceDescriptor is available on Ranges like single sheets.
Code: Select all
...
sheet : = StarDocument.Sheets.getByIndex(0);
FileReplace := sheet.CreateReplaceDescriptor;
....
sheet.ReplaceAll(FileReplace);
Karolus
Re: How to Search and Replace in calc (ods) OpenOffice docum
Posted: Mon Nov 17, 2014 6:07 pm
by karolus
I'm only tell you what I've inspected with the Help of
MRI
Use the tool by yourself!
Re: How to Search and Replace in calc (ods) OpenOffice docum
Posted: Mon Nov 17, 2014 9:12 pm
by Charlie Young
liste wrote:hi Karolus
Thanks for answer. I try to test that code but there is no Create Replace Descriptor event on sheet object can you send me small sample?
karolus wrote:Hallo
In Case of
Calc-files the Method .
.createReplaceDescriptor is available on Ranges like single sheets.
Code: Select all
...
sheet : = StarDocument.Sheets.getByIndex(0);
FileReplace := sheet.CreateReplaceDescriptor;
....
sheet.ReplaceAll(FileReplace);
Karolus
These things are case sensitive, try createReplaceDescriptor.