Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError : Argument 4 passed to PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::writeAttributeIf() must be of the type string #1505

Closed
laurinkeithdavis opened this issue Jun 2, 2020 · 3 comments

Comments

@laurinkeithdavis
Copy link

I just updated to 1.13.0 and now when I try to save an XLS file that I just imported, I get this error:

TypeError : Argument 4 passed to PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::writeAttributeIf() must be of the type string, null given, called in C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php on line 1164
C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php:453
C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php:1164
C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php:1040
C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php:67
C:\inetpub\Intranet_Local\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx.php:267
C:\inetpub\Intranet_Local\library\Intranet\PhpOffice\XlsxWriter.php:20
C:\inetpub\Intranet_Local\phpunit\library\Intranet\PHPExcelTest.php:52

I am not making any changes to the file, just import, then save:

$sFileImportedFromEmail      = _TEST_DATA_PATH."/imported_from_email01.xls";
$sFileImportedFromEmailSaved = _TEST_DATA_PATH."/imported_from_email_saved01.xls";

$this->expectOutputString(
	"");

try{

	$oSpreadsheet =
		IOFactory::load(
			$sFileImportedFromEmail);
	$oXlsxWriter  =
		new XlsxWriter(
			$oSpreadsheet);

	$oXlsxWriter->save(
		$sFileImportedFromEmailSaved);

}
catch(Exception $oException){

	Exceptions::convertToError(
		$oException);

	$aSpreadsheet = [];

}

Here is the file that I am importing:

https://drive.google.com/file/d/1xrbe_knlKBeqAMpmNGKUYFMatP_UPteX/view?usp=sharing

MarkBaker pushed a commit that referenced this issue Jun 19, 2020
This problem is the same as #1238, which was resolved by #1239.
For that issue, the fix was to check in one place whether
$this->mapCellXfIndex[$xfIndex] was set before using it.
The sample spreadsheet supplied as a description for this
problem had exactly the same problem in 2 other places in the code.
In addition, there were 7 other places in the code where that
particular item was used unchecked. This fix corrects all 9 locations.
The spreadsheet supplied with the problem is used as the basis
for some new tests, which particularly test column dimensions
and styles, the problems involved in this case.
@stale
Copy link

stale bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Aug 1, 2020
@stale stale bot closed this as completed Aug 8, 2020
@jujuo0o
Copy link

jujuo0o commented Dec 19, 2020

Getting the exact same error while opening an xlsx template with cells having "FILL COLOR"

@oleibman
Copy link
Collaborator

Fixed by PR #1525 in June 2020.

@oleibman oleibman removed the stale label Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants