<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - MACRO setformula does not appear to work with array formula"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=130661">130661</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MACRO setformula does not appear to work with array formula
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>5.4.6.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>christophe.alviset@insee.fr
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
Hi
I am using array formulas. For some reason, while using macros or sorting or
something else, the array formulas go away and I am left with simple formulas
(ie SUM(...) instead of {SUM(...)}

I want to write a macro to reset these cells to array formulas, but setformula
does not seem to work with an array formula. It sets a string.

Thank you for looking

Christophe


Steps to Reproduce:
The data
Cells A1 contain 1, A2, 4, B1, 0, B2, 1.
Array formula {=SUM((A1:A2)*(B1:B2))} yields 4 while =SUM((A1:A2)*(B1:B2))
yields 0. This is fine

The macro instructions
oBug.getCellByPosition(2,0).setFormula("=SUM((A1:A2)*(B1:B2))")
has a cell type 3 (=FORMULA)
Whereas
oBug.getCellByPosition(2,0).setFormula("{=SUM((A1:A2)*(B1:B2))}")
has a cell type 2 (=STRING)

I did not find a way to set the cell type to FORMULA.



Actual Results:
cell type 2 (=STRING)

Expected Results:
cell type 3 (=FORMULA)


Reproducible: Always


User Profile Reset: No



Additional Info:
I am using the French Libreoffice version.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>