Johnny Andersson wrote:
Hi!
Can anyone provide me with a link to where I can find ALL properties for the Search/Replace descriptor for searching/replacing stuff in a spreadsheet?
All I found was this:
http://api.openoffice.org/docs/common/ref/com/sun/star/util/SearchDescriptor.html
However, this seems to be the text document search. The following properties are mentioned:
SearchBackwards
SearchCaseSensitive
SearchWords
SearchRegularExpression
SearchStyles
SearchSimilarity
SearchSimilarityRelax
SearchSimilarityRemove
SearchSimilarityAdd
SearchSimilarityExchange
When searching a text document manually, I can verify that these properties above are the same as those checkboxes in the Writer Seach/replace dialog.
The Calc Search/Replace dialog has a few more features, which are not mentioned above. Since I run the Swedish version of OOo 1.1.4 I have to make some wild guesses about the English names of those radiobuttons and checkboxes of the Calc Search/Replace dialog:
The SearchWords property seems to be replaced by something that could be called SearchWholeCells or something like that.
There's a "More >>" button, and when I click it the following stuff are available:
Search in:
Formulas
Values
Notes
Search direction: Rows Columns
Additions: Search in all spreadsheets (or something like that)
Those are not mentioned at http://api.openoffice.org/docs/common/ref/com/sun/star/util/SearchDescriptor.html, so where can I find information about it?
Maybe you wonder what I want to do, so here it is:
I want to write a Macro which search a selected range for a specific string or value. I want the following settings:
Search whole cells only
Case sensitive
Search in Values
Search direction: Columns (for example C10, C11, C12, C13,......, C53, D10, D11 and so on, until end of selected CellRange).
I know that I can search one cell at a time, but I thought that using the built in search thing might give me a little faster macro.
Is it possible, when using Search/Replace, to get the cell address from the cell in which a match was found? Or at least any kind of information which I can use to find other stuff in the same row easily.
Any suggetions will be appreciated!
Thanks!
In my book on pages 341-342, I indicate the usage of SearchWords in a Calc document. You can also read about it here:
http://api.openoffice.org/docs/DevelopersGuide/Spreadsheet/Spreadsheet.htm#1+3+3+6+Search+and+Replace
The following properties are supported: STRING ReplaceString BOOL SearchBackwards = False BOOL SearchByRow = False BOOL SearchCaseSensitive = False BOOL SearchRegularExpression = False BOOL SearchSimilarity = False INTEGER SearchSimilarityAdd = 2 INTEGER SearchSimilarityExchange = 2 BOOL SearchSimilarityRelax = False INTEGER SearchSimilarityRemove = 2 STRING SearchString BOOL SearchStyles = False INTEGER SearchType = 0 BOOL SearchWords = False
In my free macro document, I mention the SearchType. 0 means search the formula and 1 means search the value. I have not been able to find this documented any place else. I do not know off hand why I knew this so that I could document this. Oh yes, if you have my book, you will notice that in version 1.0.x, the SearchWords thing was not working.
You say that you want to search ONLY a range and NOT the entire sheet. Here is a little hint that I have not completely verified...
oSheet.getCellRangeByName("A1:B2").createSearchDescriptor()
-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
