<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 - API: inserting a sheet fails with IllegalArgumentException"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=128951">128951</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>API: inserting a sheet fails with IllegalArgumentException
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.4.0.0.beta1+
          </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>Keywords</th>
          <td>bibisectNotNeeded, regression
          </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>mikekaganski@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>noelgrandin@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This BASIC code:

sub test
    oSheet = ThisComponent
    oSheet = calcDoc.createInstance ("com.sun.star.sheet.Spreadsheet")
    calcDoc.Sheets.insertByName ("NewName", oSheet)
end sub

fails in "calcDoc.Sheets.insertByName ("NewName", oSheet)" with
com.sun.star.lang.IllegalArgumentException.

This happens in ScTableSheetsObj::insertByName, because it checks that
pSheetObj->GetDocShell() must be nullptr (= sheet not inserted yet).

This broke in
<a href="https://git.libreoffice.org/core/+/009e7a54f40ebacd9dd4a394504c277789699801">https://git.libreoffice.org/core/+/009e7a54f40ebacd9dd4a394504c277789699801</a>,
where ScServiceProvider::MakeInstance was changed to pass pDocShell to
ScTableSheetObj ctor.

Noel: could you please take a look?</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>