https://bugs.freedesktop.org/show_bug.cgi?id=54854

             Bug #: 54854
           Summary: calc add-in functions are not evaluated as expected
    Classification: Unclassified
           Product: LibreOffice
           Version: 3.6.1.2 release
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Spreadsheet
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Created attachment 67091
  --> https://bugs.freedesktop.org/attachment.cgi?id=67091
Calc add-in component.  Issues first seen using this.

Problem description:

calc add-in functions are not evaluated as expected

A) UI shows #NAME? instead of the add-in function result when a simple formula
that calls the function is entered using setFormula() via the pyuno bridge.

The same formula is evaluated as expected when entered by hand via the UI.

The #NAME? condition may be cleared at the UI by selecting the cell and, at the
keyboard, typing F2 SPC RET (effectively re-entering the formula by hand).

It may also be cleared by using Find & Replace to substitute the leading the
leading "=" with "=".  The 'workaround' is also effective from a Python script
using the pyuno bridge.

These symptoms affect all add-in functions I have implemented in Python.

B) UI shows #VALUE! instead of the add-in function result when the calc
workbook is closed and then re-opened.

The #VALUE! condition may be cleared as for the #NAME? but it may also be
cleared by selecting the cell(s) and typing DEL ^Z.

Oddly these symptoms do not show with all the add-in functions I have
implemented in Python but I suspect the issue is not with the function itself.

Steps to reproduce:

1.  Install the attached add-in component.

Please review the add-in.  It seems simple enough but it is the result of
triangulation of scant information from obscure sources of dubious currency.

2.  Open LibreOffice with a UNO bridge and a new calc document.  E.g.

  soffice --calc --accept="socket,host=localhost,port=2012;urp";

>From the UI, enter in a cell the formula:

  =PAGENAME(0)

The UI should show the formula evaluates to "Sheet1".

In another cell enter:

  =PAGENAME(SHEET(Sheet1.A1)=1)

The UI should show the formula evaluates to "Sheet1".

3.  From a shell console start Python as bundled with LibreOffice.  E.g.

  /opt/libreoffice3.6/program/python

and copy/paste the following one line at a time into the shell:

  import uno
  # connect with running LibreOffice
  lcxt = uno.getComponentContext()
  resolver =
lcxt.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver",
lcxt)
  unoUrp = 'socket,host={0},port={1};urp'.format("localhost", 2012)
  rctx = resolver.resolve("uno:{0};StarOffice.ComponentContext".format(unoUrp))
  # enter formula into a cell of the open workbook
  desktop =
rctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop",rctx)
  cell =
desktop.getCurrentComponent().Sheets.getByName('Sheet1').getCellRangeByName("E5")
  cell.setFormula("=PAGENAME(SHEET(Sheet1.A1)-1)")

There should be no errors.  Beware line wrap: each assignment is one line.

The cell E5 on Sheet1 will now show #NAME? when one would expect it to show
Sheet1.

Clear the #NAME? using one of the methods describe in A) of the Problem
Description above.
Save, close and reopen the workbook.

The cell E5 on Sheet1 will now show #VALUE! when one would expect it to show
Sheet1.

Clear the #VALUE! using one of the methods describe in A) of the Problem
Description above.

Current behaviour (3.6.2):

See Problem Description above.  I will add more comments if and when I
understand the circumstances better.

Expected behaviour:

Formulae involving add-in functions should always evaluate to the correct
result regardless of:
  a) how the formula is entered (manually or by macro)
  b) regardless of circumstances in which the containing document is opened
  c) the language of implementation (here Python)

Platform (if different from the browser): 

  Debian GNU/Linux 6.0.5 (aka Squeeze, aka Stable)

Installation media:

  LibO_3.6.1_Linux_x86-64_helppack-deb_en-GB.tar.gz
  LibO_3.6.1_Linux_x86-64_install-deb_en-US.tar.gz
  LibO_3.6.1_Linux_x86-64_langpack-deb_en-GB.tar.gz
  LibO-SDK_3.6.1_Linux_x86-64_install-deb_en-US.tar.gz

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to