Comments (4)
There is very limited support for reading most styles (getFormatCode) in Ods Reader, and it might take a lot of effort to add more. Although I don't see any support for Number Formats in Ods Writer (setFormatCode), it might be possible to add some. I'll be away a while, but I'll take a look when I get back.
from phpspreadsheet.
Then I am missing something here. The Features cross reference#writers say ODS has support for writing all sorts of Cell Formatting including Number Format Mask.
The #reader table states ODS supports reading Number Format Mask.
I have no problems setting font-name, font-size, font-weight, cell-alignment etc. Both for entire sheet and individual cells. The same Feature table say cell column-width / row-height is not supported for ODS, but those work fine as well. I am also using cell-merging without problem.
What I use and that works fine with ODS:
- Sheet font
- Column-width
- Row-height
- Merging cell-ranges
- Cell font- size, weight, alignment
- Border bottom for cell-ranges
- Set cell formula
=Foo(...)
The one thing not working (and the thing I of course implemented last hah) was cell-formatting. And this does not apply.
Checking further; the last things that I had thought adding does not work either:
- Printing area
- Header / footer
In conclusion I guess I use XLS(X) instead of ODS and convert the product to ODS locally, i.e:
libreoffice --convert-to ods --outdir ./conv *.xlsx
As a note I believe it should state more clearly that ODS has limited support. As an anecdote my process was this:
Have been using a hack where I create document templates as ODS in LibreOffice. Save them and unpack them. Then I have a PHP script that use this as base to create new documents. As this is both cumbersome and a product of an ad-hock solution I went looking for some library.
Found this one where it says at top "PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc." - OK, good, I thought. Went on to install it and start poking around. First test was the "Hello World!" from https://phpspreadsheet.readthedocs.io/en/latest/ . All good. Then changed to ODS. Still all good. Fired up the test-server and had a look around. All OK. Then started to write a simple wrapper class and filling in data poking around in the PhpSpreadsheet Documentation. All good. Then came to formatting and full stop. Searching the WWW. No fix. Trying various ways to set it and also set the data (as described in OP) no fix. Looking at the API docs. Nothing further. And so on ... at last ending up posting a ticket here.
IMO perhaps some clear statement in both README and the front-page of the Documentation informing about the big feature differences between formats. I got the impression it was opaque to containers.
I mean looking at this page: https://phpspreadsheet.readthedocs.io/en/latest/
I get the impression (First line of File formats supported) is ODS. Nothing about limitations. Further down in the Getting started section - still no notice about limitations etc.
As the spreadsheet API is opaque to file-format and there is no errors or warnings when using calls that does not apply it is, was at least for me, easy to have blinders on that prevent one from understanding it is a container issue.
And - yes, the Features cross reference says a lot of this, - but to be honest I jumped right into topics and did not register that table until after I posted OP. Not that it would have helped as from how I read it - it say it supports number formatting. As it say no on row/column dimensions I'd skip it though ...
It is of course a likelihood it is all about me being a moron, but still.
from phpspreadsheet.
I am sorry that the experience has been so frustrating for you. As far as the documentation is concerned, I will look into the errors. But ... we do accept PRs, and, since you are obviously further ahead than I will be in what is wrong or not emphasized sufficiently, perhaps you would like to take a shot at correcting some of the doc problems with a PR.
from phpspreadsheet.
I do not mean to sound negative. It's an awesome project, was merely meant as some hints.
As for PR I'll see what I find out when back after Easter. Would have to look closer at various aspects before deciding on a suggestion.
from phpspreadsheet.
Related Issues (20)
- Default style alignment does not work for Xlsx Writer HOT 9
- Sheet cloning is time consuming HOT 1
- Prepending zero on negative percentage numbers -10<n<-9
- setCellValueByColumnAndRow deprecated?? HOT 1
- Rank formula not working
- [Bug] Removing column when next column value is null shifts cell value from deleted column into the next column HOT 6
- Calculation Error "=COUNTIF(F$12:F$203,"1")" HOT 1
- Xls::loadSpreadsheetFromFile: trim(): Passing null to parameter #1 ($string) of type string is deprecated HOT 11
- converting a .xlsx file to .pdf not retain the specified print area HOT 1
- setReadDataOnly function is deprecated or missing HOT 4
- Including WordPress? HOT 4
- If the content of the csv file contains Chinese characters enclosed in double quotes, the data will not be output correctly HOT 4
- Need help regarding download of excel file. HOT 1
- Protect Sheet But Allow Sort not working HOT 2
- [ERROR] Class "Rector\Core\Rector\AbstractRector" not found HOT 2
- Make voku packages optional HOT 2
- ver 1.29 ) Csv auto_detect_line_endings HOT 4
- mime_content_type() has been removed since PHP ver. 8 HOT 1
- Some methods removed in v2.0 but not mentioned in CHANGELOG file 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 phpspreadsheet.