Comments (7)
Can you narrow it down to which row is causing the issue, and put it in code? For instance:
include_once("xlsxwriter.class.php");
$my_string = "\xa35";//35 pounds (currency)
$my_string = mb_convert_encoding($my_string, 'UTF-8', 'windows-1252');
$writer = new XLSXWriter();
$writer->writeSheetRow('Sheet1', array($my_string) );
$writer->writeToFile('output.xlsx');
when I comment out mb_convert_encoding() above, and run this via command line php, i get this from stderr:
2014-11-14 20:58:44:Error, invalid UTF8 encoding detected.
But when I leave mb_convert_encoding() in there, the (above) spreadsheet seems to work for me.
What version of PHP?
What server is running PHP? (windows, linux, etc)
Is the .xlsx file a valid .zip file (can you rename it to .zip and unzip it, and the zip is not corrupted?)
from php_xlsxwriter.
I did copy the data over to my test server and went through it row by row. Here's the issue. I have a product model number "500E1205", which I have put in a column that is specified as a string. Unfortunately, either your code or Excel is seeing this as a number and I get a INF in the field where this should be located. Is there any way that your code can say this is truly a string? I noticed that your interpretation of cell contents uses a !is_string() call on line 233. Could this be viewed as a number by PHP when in reality it should be specified as a string when exported to Excel? So it turned out that it might not have had anything to do with character encoding.
BTW, I am using PHP 5.4.32 running on CentOS as an Apache module. And this .xlsx is a valid zip file. That's the first thing I checked before writing.
from php_xlsxwriter.
Just committed a fix for that, let me know if it works for you.
from php_xlsxwriter.
I downloaded and tested on both my test environment and in production and both worked great. Thanks very much for your quick fix!
from php_xlsxwriter.
Thanks. And thanks again for your quick work on this!
from php_xlsxwriter.
Not sure if i am doing anything wrong, because got the same error with just writing following headers.
Array ( [Status] => string [Part Number] => string [Model Number] => string [Serial Number] => string [Manufacturer] => string [Condition] => string [Vendor] => string [Price] => string [Purchase Date] => string [Warranty Date] => string [Calibration Date] => string )
Code i am using to generate is this:
// $theader output is above $writer->writeSheetHeader('Sheet1', $theader ); header('Content-disposition: attachment; filename="'.$filename.'"'); header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); header('Content-Transfer-Encoding: binary'); $writer->writeToStdOut();
Edit: Ignore it, My problem was due to single space being printing before file output.
from php_xlsxwriter.
This should be fixed properly in the latest version 0.30
from php_xlsxwriter.
Related Issues (20)
- GitHub About (quick win) HOT 1
- Not Work Xampp PHP v8.1.6 HOT 3
- How to add cell data starting with space or more space (not trimmed) HOT 1
- How to set cell width HOT 2
- Macro HOT 1
- Date format issue in Excel 2021 HOT 1
- Writing excel with title/caption in first two rows then header and then rows HOT 3
- Trouble on styling cells HOT 1
- auto_filter doesn't work when there are rows before table header HOT 1
- Question: Requirements on Docker HOT 1
- вакансия пхп
- how do i set different font color in one cell
- Is it intentional that the default number format formatCode is "GENERAL" instead of "General" HOT 1
- Error when opening file generated with this library in a newer version of excel. HOT 1
- TimeFormat in Excel 365 with only time as input HOT 1
- Set cell width only for some cells HOT 2
- PHP 8.2 deprecation warning, passing NULL to htmlspecialchars HOT 2
- Is this streaming the info from memory to disk?
- excel cannot open the file because the file format or file extension is not valid HOT 3
- `widths` does not take effect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php_xlsxwriter.