We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error when setting Worksheet Name property using Aspose.Cells.Interop in PHP

Hi Guys,


I am trying to set the Worksheet Name property in a PHP script, using the Aspose.Cells.Interop.dll COM component.

When I execute the below php script, line 7:

"$ptr->Set($worksheet, “Name”,array(“MySheetName”));"

fails with the following error (output into the PHP error log):

PHP Fatal error: Uncaught exception ‘com_exception’ with message ‘Error [0x80070057] The parameter is incorrect.
’ in C:\inetpub\asposetest\www\test.php:7
Stack trace:
#0 C:\inetpub\asposetest\www\test.php(7): com->Set(Object(variant), ‘Name’, Array)
#1 {main}
thrown in C:\inetpub\asposetest\www\test.php on line 7

I am using PHP 5.4.

If I comment out line 7, the script completes successfully and I end up with a valid xlsx file.

Thanks in advance.

PHP File:

<?php

$ptr= new COM("Aspose.Cells.Interop.InteropHelper")or die('Unable to load helper');
$workbook = $ptr->New("Aspose.Cells.Workbook",array());
$worksheets = $ptr->Get($workbook,"Worksheets",array());
$worksheet = $ptr->Get($worksheets,"Item",array(0));
$ptr->Set($worksheet, "Name",array("MySheetName"));
$ptr->Call($workbook,"Save",array("c:\\PHPTest.xls"));

?>


Cheers,
Michael.

Hi Michael,

Thanks for your posting and using Aspose.Cells.

We do not provide any interop dll of Aspose.Cells now. Instead, we now recommend PHP users to use Aspose.Cells for Cloud (REST based APIs). Because these APIs can be used in any platform and languages.

Please see the following documentation article how to use Aspose.Cells for Cloud API to rename worksheet.


Please also read the following product pages to get familiar with the Cloud APIs.