Giter VIP home page Giter VIP logo

Comments (4)

oleibman avatar oleibman commented on May 23, 2024

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.

MinxAa avatar MinxAa commented on May 23, 2024

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.

oleibman avatar oleibman commented on May 23, 2024

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.

MinxAa avatar MinxAa commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.