* Extract character set, so we can convert to UTF-8 if required
* Set column width and row height when defined on tr/td
* Parse align and valign on td
* Specify number format of cell via html attribute
* Formatting of b, strong, i and em tags
* Inserting image in cell when using img tag in html
* Add applying inline styles: border, fonts, alignment, dimensions
* Add tests for applying inline styles
`master` is now the only permanent branch. Features and fixes should be merged
into `master` when stable. Pull requests should be forked from `master`.
`develop` branch disappear entirely in favor of temporary features/fixes branches.
In case we generate Spreadsheet from html file and the code
in file have text color in css "color:#FF00FF" it will showing
as black color because it will render like rgb content with } "FF00FF}"
So, we fix it by adding missing bracket "{".
Closes#831
Using an operator is significantly faster than calling the max function.
As this method is called more than once per cell the difference adds up.
Closes#824
Removing the duplicate strtoupper call has a meaningful impact on
performance since this method is called at least once per cell.
`Worksheet::getCells` currently calls `strtoupper` twice. `strtoupper`
is kind of expensive and this method is called at least once for every
cell in the spreadsheet. By removing the unnecessary second call the
runtime decreases by 18% when importing a ~100K cell spreadsheet.
Closes#825
For large XLSX files `Reader/Xlsx::readColumnsAndRowsAttributes()` performs
a lot of calls to `$this->getReadFilter()` and `$this->getReadFilter()->readCell()`
as `readCell()` is called twice for each (possibbly filled) cell.
By ignoring calls to the DefaultReadFilter implementation (which always returns true),
using no custom read filter will not incur any runtime penalty.
The runtime penaltiy when using a custom read filter is reduced by a third by
caching the read filter into a variable instead of using the getter method.
Fixes issue #772.
Due to a limitation in Mpdf, the HTML string passed to its WriteHTML method
must not exceed a particular length. PhpSpreadsheet produces one HTML string
containing all spreadsheet data when writing to HTML, which can easily exceed
Mpdf's size limit. Thus, it was impossible to write large spreadsheets to PDF
using the Mpdf writer - this change fixes that issue.
Fixes#637Fixes#706
Commit 8dddf56 inadvertently removed the ability to omit the width
and height arguments to the OFFSET function. And #REF! is returned
because the function is validating that the new $pCell argument
is present. It is present, but it has been passed in the $height position.
We fixed this by always passing $pCell at the last position and filling
missing arguments with NULL values.
Fixes#561Fixes#565
When extracting sheet title from string reference (like `"Work!sheet1!A1"`), PHP function `explode()` divide this string into three parts: `['Work', 'sheet1', 'A1']`. And then these wrong values are used in formulas, ranges, etc.
This change fix that problem by using special function `Worksheet::extractSheetTitle()`. This function also has been changed to make sure that worksheet title can contain "!" character. So, that function search last position of "!" in reference string and divide it to 2 parts correctly: `['Work!sheet1', 'A1']`.
Fixes#325Fixes#662
When a formatting string has a locale in it an error can occur when outputting. For example when the format string with a locale such as `[$-1010409]#,##0.00;-#,##0.00` appears, a value of 9.98 comes back as $9.98. This is because at https://github.com/PHPOffice/PhpSpreadsheet/blob/1.4.0/src/PhpSpreadsheet/Style/NumberFormat.php#L711 the numberFormat regex will match to the zeros inside the locale ([$-1010409]). Attempts to adjust the numberFormat regex caused regressions in other tests. Adding another step to filter out the locale caused no regression.
Iterators prev() behavior is now consistent with next(), meaning
that it can go out of bounds and it must be validated with valid()
before using it.
Fixes#587Fixes#627
Rowspans/colspans are now respected for each HTML document added to an existing
spreadsheet as a new worksheet. The protected $rowspan class property should
be emptied on each call to `loadIntoExisting`.
Fixes#619Fixes#620
When cloning `BaseDrawing`, its worksheet will be set as null and thus be
orphaned. But when cloning the worksheet, it will re-assign itself as the
new worksheet for the BaseDrawing.
That way we avoid recursive cloning of a Worksheet that would clone a
BaseDrawing that would clone a Worksheet etc.
Fixes#437Fixes#613
* - Refactored Complex Engineering Functions to use external complex number library
- Added calculation engine support for the new complex number functions that were added in MS Excel 2013
- IMCOSH() Returns the hyperbolic cosine of a complex number
- IMCOT() Returns the cotangent of a complex number
- IMCSC() Returns the cosecant of a complex number
- IMCSCH() Returns the hyperbolic cosecant of a complex number
- IMSEC() Returns the secant of a complex number
- IMSECH() Returns the hyperbolic secant of a complex number
- IMSINH() Returns the hyperbolic sine of a complex number
- IMTAN() Returns the tangent of a complex number
* Simplified the parseComplex() method in the PhpOffice\PhpSpreadsheet\Calculation\Engineering class, using Complex\Complex; and docblock flagged as deprecated
* - Added calculation engine support for the new bitwise functions that were added in MS Excel 2013
- BITAND() Returns a Bitwise 'And' of two numbers
- BITOR() Returns a Bitwise 'Or' of two number
- BITXOR() Returns a Bitwise 'Exclusive Or' of two numbers
- BITLSHIFT() Returns a number shifted left by a specified number of bits
- BITRSHIFT() Returns a number shifted right by a specified number of bits
- Fix ISFORMULA() function to work with a cell reference to another worksheet
- Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016
- Text Functions
- CONCAT() Synonym for CONCATENATE()
- NUMBERVALUE() Converts text to a number, in a locale-independent way
- UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally
- UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally
- TEXTJOIN() Joins together two or more text strings, separated by a delimiter
- Logical Functions
- XOR() Returns a logical Exclusive Or of all arguments
- Date/Time Functions
- ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date
- Lookup and Reference Functions
- FORMULATEXT() Returns a formula as a string
- Engineering Functions
- ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit
- ERFC.PRECISE() Synonym for ERFC
- Math and Trig Functions
- SEC() Returns the secant of an angle
- SECH() Returns the hyperbolic secant of an angle
- CSC() Returns the cosecant of an angle
- CSCH() Returns the hyperbolic cosecant of an angle
- COT() Returns the cotangent of an angle
- COTH() Returns the hyperbolic cotangent of an angle
- ACOT() Returns the cotangent of an angle
- ACOTH() Returns the hyperbolic cotangent of an angle
- Financial Functions
- PDURATION() Calculates the number of periods required for an investment to reach a specified value
- RRI() Calculates the interest rate required for an investment to grow to a specified future value
We now always trust the file extension to avoid false positive of mime
detection for most simple cases. But we still try to guess the mime type
if the file extension does not match or is missing.
Fixes#564
Editing a Xlsx document using PhpSpreadsheet should preserve the workbook
view attributes of that document. For example, if the worksheet tabs are
hidden in the original document, they should remain hidden after updating.
Fixes#523Fixes#525
Properly set the selected cells for worksheets with frozen panes when
writing Xlsx documents. Beforehand, the saved Xlsx documents were
generating corruption warnings when opened in Excel.
Fixes#532Closes#535
Conditional operators in the selection parameter of COUNTIF
functions were not being parsed properly, causing evaluations
of formulae with such functions to sometimes fail.
Fixes#526Closes#528
This will let users read a file that contains data that are not properly
supported and write them back to a new file untouched.
- load workbookProtection attributes
- save loaded pageSetup[r:id]
- save loaded sheet's AlternateContent
- save loaded unparsed VmlDrawings
- save loaded drawing files `rId`
- save loaded draw's AlternateContent
- save loaded control properties
- save loaded printer settings
- save loaded unparsed override content types (for ctrlProp, ...)
Closes#435
Fixes a bug when calling `$sheet->freezePane('B2')` without a second argument.
The selected cell will now be `B2` instead of the incorrect `B3`.
Fixes#389Closes#393
This change adds support for newer functions that are prefixed
by _xlfn. (#356). The calculation engine has been updated to
recognise these as functions, and drop the _xlfn. part.
It also add a couple of the new functions such as STDEV.S/P,
MODE.SNGL, ISFORMULA.
Fixes#356Closes#390
Some computer programs will output xlsx files that do not compare 100%
to the standards. Excel will open the file without any problem.
setZoomScaleNormal() should throw exception when manually setting the
scale to less than or equals 0, but when reading files, we should
be able to read a file with such error, as Excel does.
Closes#350
CSV reader used to accept any file without any kind of check. That made
users incorrectly believe that things were ok, even though there is no
way for CSV reader to read anything else that plain text files.
Fixes#167
The behavior is similar to what is done in LibreOffice. That means if there is a
comment it will be shown with a small indicator and the actual comment will be
revealed when mouse hover over the indicator.
Fixes#308Closes#310