Sergey, I am copying you so that you know that I am more widely distributing your question.



Is it possible to search a Calc document and find comments?

I tried this recently using LO 4.4.1.2, and I cannot find text in a comment using the GUI.

To my knowledge this search has always worked in OpenOffice using the API. I was sent this Java code

= BEGIN INSERT

XSpreadsheet sheet = (XSpreadsheet) iaSheets.getByIndex(_curSheet).Value;
                    XSearchable xSch = (XSearchable) sheet;
XSearchDescriptor xSchDr = xSch.createSearchDescriptor();
                    xSchDr.setSearchString(searchStr);
xSchDr.setPropertyValue("SearchType", new Any((short)2)); // 2- For cooment
                    xSchDr.setPropertyValue("SearchWords", new Any(false));
                    xSchDr.setPropertyValue("SearchByRow", new Any(true));
                    XCell xRangeCurrent = xSch.findFirst(xSchDr) as XCell;

Search with parameter SearchType = 0 works, and with the parameter SearchType = 2 is not working. Method findFirst always returns null. What am I doing wrong? Or what you can give advice to remedy this situation?

= END INSERT

I looked around and found this mentioned specifically as it relates to OpenOffice by Mr. Marcelly way back in 2006.

https://bz.apache.org/ooo/show_bug.cgi?id=67088

It is not clear to me that this ever worked in LO, but, if it is mentioned back in 2006, I assume that it probably did initially and that the functionality was removed (intentionally or accidentally) from LO.

Here is my corresponding Macro in Basic that demonstrates the problem.

Sub SearchSheet
  Dim oSheet    'Sheet in which to replace
  Dim oSearch
  Dim x

  oSheet = ThisComponent.Sheets(0)
  oSearch = oSheet.createSearchDescriptor()
  oSearch.setSearchString("comment")
  oSearch.setPropertyValue("SearchType", 2)
  x = oSheet.findFirst(oSearch)
End Sub

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


--
To unsubscribe e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to