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

Error when opening file generated with this library in a newer version of excel. #352

Open
Modicrumb opened this issue Oct 12, 2023 · 5 comments

Comments

@Modicrumb
Copy link

Modicrumb commented Oct 12, 2023

Excel spits this error out:

<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error306120_01.xml</logFileName><summary>Errors were detected in file 'C:\filepath\filename.xlsx'</summary><repairedRecords><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord></repairedRecords></recoveryLog>

In version 2309. I have OSX and can open it in Numbers just fine. I am not sure if it works perfect in older versions of excel. What is the best way to troubleshoot this?

@TonHaver
Copy link

Hi,

I ran into the same problem.
Tried a few things, problem was solved when I saved xlsxwriter.class.php in UTF8 encoding (instead of ANSI)

Hth,
Ton

@TitaniumCreative
Copy link

I am having this issue with OXS Excel v16 and my client is having the same issue on PC. I have tried generating the examples and still have the error.

We found a problem with some content in 'NAME OF FILE'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

Repaired Records: Cell information from /xl/worksheets/sheet1.xml part

  • I tried resaving the xlxwriter class to UTF8 with no effect.
  • Converting all data to UTF-8 - just in case
  • Using the examples here in the git hub repository

Nothing is working.

Output code:

            // Header label => format
	
	$header = array(
		'brand'					=> 'string',
		'branch'					=> 'string',
		'branch_id'				=> 'integer',
		'company_name'			=> 'string',
		'sales_rep'				=> 'string',
		'address'				=> 'string',
		'zipcode'				=> '00000',
		'shipping'				=> 'integer',
		'weight_offset'		=> 'integer',
		'referral_count'		=> 'integer',
		'locator_count'		=> 'integer',
		'samples_count'		=> 'integer',
		'ship_count'			=> 'integer',
		'branch_count'			=> 'integer',
		'branch_ship_count'	=> 'integer',
		'total_count'			=> 'integer',
	);
	
	// CREATE XLSX OBJECT
	$xlsx = new XLSXWriter();
	$xlsx->writeSheet($this->data, 'Sheet1', $header);		
	
	// filename for download 
	$month = date('F', mktime(0,0,0,$this->month, 1,0));
	$created = date('Y-m-d H-i');
	$filename = $this->site.' Referral Report - '.$month.' '.$this->year.' | '.$created.'.xlsx';
	
	$file = trim($xlsx->writeToString());
	
	ini_set('display_errors', 0);
	ini_set('log_errors', 1);
	error_reporting(E_ALL & ~E_NOTICE);
	
	ob_get_clean();
	header('Content-Description: File Transfer');
	header('Content-Disposition: attachment; filename='.$filename); 
	header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8');
	header('Content-Transfer-Encoding: binary');
	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
	header('Pragma: public');
	header('Expires: 0');
	header('Content-Length: ' . filesize($file));
	
	echo $file;
	ob_flush();

@sayid
Copy link

sayid commented Nov 8, 2024 via email

@BurninLeo
Copy link

BurninLeo commented Nov 27, 2024

I have the issue regularly and it allows for replication. One additional column was sufficient to provide the error message in Excel.

The error refers to "colum information", in the original message: "Entfernte Datensätze: Spalteninformationen von /xl/worksheets/sheet1.xml-Part"

I was able to replicate the error, and it seems to have nothing to do with the content of the cells, but with using more that 1024 columns.

col1024.xlsx
col1025.xlsx

@sayid
Copy link

sayid commented Nov 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants