Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index

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, 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


XSpreadsheet sheet = (XSpreadsheet) iaSheets.getByIndex(_curSheet).Value;
                    XSearchable xSch = (XSearchable) sheet;
XSearchDescriptor xSchDr = xSch.createSearchDescriptor();
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?


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

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.setPropertyValue("SearchType", 2)
  x = oSheet.findFirst(oSearch)
End Sub

Andrew Pitonyak
My Macro Document:

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.