Export to Excel for Master/Detail List does not work

version 2022.12, I made the latest updates. The error always appears if you try to export a master detail page, in any format (Word, Excel…) using Return false to skip default export and use Row_Export event.

The error reported by the log is:
log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Call to undefined method PHPMaker2022\med_2022\Myfile::rowExport()Esporting with Return true to use default export works.

You may double check your Row_Export server event, if you edited before and then cleared it, make sure that you click the “Clear” button to clear it. If you left whitespace or anything not same as the default code, it will be considered as your own code and outputted.

thank you arbei, but I followed your suggestion, made the “clear” and simply tried to uncomment the example proposed for the Row_Export event ($this->ExportDoc->Text .= “my content”; ) but still remain the waiting exporting message and the error is the same in the chrome console:
Uncaught TypeError: Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed.
at Object. (ew.min.js:5:52263)
at c (jquery-3.6.0.min.js:2:28327)
at Object.fireWith [as resolveWith] (jquery-3.6.0.min.js:2:29072)
at l (jquery-3.6.0.min.js:2:79901)
at XMLHttpRequest. (jquery-3.6.0.min.js:2:82355)and also in the log error file:
log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Call to undefined method PHPMaker2022\med_2022\Box::rowExport() File: E:\xampp8\htdocs\med\models\Box.php Line: 1427same error both with excel and word export.

Make sure you have written Row_Export server events for both the master and detail tables.

Sorry but unfortunately the error remains. I tried to enable row_export in the MasterTable View Page as suggested (as it seemed more logical) but I tried putting it also in the MasterTable List Page, but it doesn’t seem to affect the export of the MasterDetail. The error remains the same.
I also tried to enable the custom export only in the MasterTable and not in the DetailTable but it seems that this is not influential: the exported data remains the same (while putting $ this-> ExportDoc-> Text. = “My content”; in the master I should have found “my content” which doesn’t happen)

for the sake of scruple I have done many tests and finally I have created a new blank project connected to phpmaker sample database. I checked only orders and ordersdetails tables. I created the master detail releationship between the two tables and set master details list view. same behavior that I have already reported.
Normal export works (“return true” in pageexporting event) (Note: $this->ExportDoc->Text = “my header”; // Export header WORKS ONLY with PDF , not with Word and Excel export)
With “return false” (and enabling only the sample proposed by phpmaker for row_export event) I have the same error that I have reported:
In the browser console: Uncaught TypeError: Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed.
In the error lgo: Log.DEBUG: Slim Application Error Type: Error Code: 0 Message: Call to undefined method PHPMaker2022\demo\Orders::rowExport() File: E:\xampp8\htdocs\demo\models\Orders.php Line: 1621 Trace: (…)Tested also enabling custom export in the master view table as suggest. same behaviour. I confirm that the custom export works perfectly in the case of a simple table (not master / details)
Best Regards

Please update to the latest template (Tools → Update Template) and try again.

Thanks for the assistance! From this morning updating the template (Saturday I tried to do it without success) the custom export NO longer gives the errors I had reported, but only the export to PDF works. The custom export in word and excel produces a blank document instead (however without errors in log)

arbei wrote:

Make sure you have written Row_Export server events for both the master and detail tables.

For example, if you export from the View page of master table, you need to enter your code for:

  • Page_Exporting and Row_Export of the View page of the master table, and
  • Row_Export of the List page of the detail table

Also make sure your Row_Export does output something. You may post your code for discussion.

ok, but I wrote that now (after template update), the master detail export works. but only with pdf export. Word and excel custom export are blank
I only used this code (uncommenting sample) both in view and in detail list:

public function pageExporting()
{
    $this->ExportDoc->Text = "my header list<br>"; // Export header
    return false; // Return false to skip default export and use Row_Export event
    //return true; // Return true to use default export and skip Row_Export event
}

public function rowExport($rs)
{
    $this->ExportDoc->Text .= "my content list<br>"; // Build HTML with field value: $rs["MyField"] or $this->MyField->ViewValue
}

this code produce in pdf this output:
my header list
my content list
my content list
my content listbut prodice empty word and excel file…

Note that if you use PhpSpreadsheet and PhpWord extensions, the data is not outputted to $this->ExportDoc->Text, you need to write your own custom export code that works for the PhpSpreadsheet and PhpWord libraries, you may refer to the source code in the extension as example.Another approach is to custom the Export classes, read: https://discourse.hkvstore.com/t/phpspreadsheet-and-titles/723/1

ok thanks for the clarification. Now it’s all clear