PHPOffice

PHPOffice

Member Since 9 years ago

The Internet

Experience Points
0
follower
Lessons Completed
0
follow
Best Reply Awards
7
repos
Jun
22
1 day ago
Activity icon
issue

SailorMax issue comment PHPOffice/PHPWord

SailorMax
SailorMax

TemplateProcessor->setImageValue()

Allow to put images in templates.

Fixes #1079 Fixes #939 Fixes #708

SailorMax
SailorMax

hi, I'm using phpword to insert image with setImageValue, I don't know but the first image don't show and the file word is corrupt

Can you share the sample of source document?

pull request

jasverix pull request PHPOffice/PhpSpreadsheet

jasverix
jasverix

fix 'Illegal offset type' error - authorId is SimpleXmlElement

This is:

  • a bugfix
  • a new feature

Checklist:

Why this change is needed?

Got an 'illegal offset type' trying to read Excel file with comments.

Activity icon
fork

jasverix forked PHPOffice/PhpSpreadsheet

⚡ A pure PHP library for reading and writing spreadsheet files
jasverix MIT License Updated
fork time in 1 day ago
started
started time in 1 day ago
Jun
21
2 days ago
Activity icon
issue

ccimmo issue comment PHPOffice/PhpSpreadsheet

ccimmo
ccimmo

Preparation for the release of PHP 8

This is:

- [ ] a bug report
- [X] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

Travis template needs updating to run against PHP 8 nightly builds once it reaches a stable point (feature freeze) so that we know all functionality will still work with the new version. Initially this should be an "allow fail", giving us a chance to resolve any issues that may be identified without breaking the build.

Also requires updates to composer.json and related dependencies to ensure that they are all at appropriate versions for running with PHP 8.

ccimmo
ccimmo

". Surprisingly, mPDF still runs against PHP8 without any issues; but we may need to change recommendations or the PDF adaptors later as these libraries are modified for PHP8"

Mpdf does not write drawings/charts... phpspreadsheet output the right excel sheet with all drawing (writer\xlsx) but when running new \Phpoffice\phpspreadsheet\Writer\Pdf\Mpdf, the pdf is created without drawings...

Activity icon
issue

oleibman issue comment PHPOffice/PhpSpreadsheet

oleibman
oleibman

Xlsx Reader Better Namespace Handling Phase 1 Try2

This is a replacement for #2088, which has run into merge conflicts. I will close that PR in the near future, however the comments in that PR may prove useful for this one. While that PR has been in draft status all along, I am marking this one as ready. I will gladly add additional tests (and, of course, make code changes) that anyone has to suggest, but, with my most recent test files which I will describe in a separate comment, I have no further ideas on useful additions.

As mentioned in the earlier ticket, this is a risky change. But, as has been demonstrated, delaying it comes with its own set of risks. It would be helpful to have a temporary moratorium on changes to Reader/Xlsx until this change is merged.

The original commit message follows.

There have been a number of issues concerning the handling of legitimate but unexpected namespace prefixes in Xlsx spreadsheets created by software other than Excel and PhpSpreadsheet/PhpExcel.I have studied them, but, till now, have not had a good idea on how to act on them. A recent comment https://github.com/PHPOffice/PhpSpreadsheet/issues/860#issuecomment-824926224 in issue #860 by @IMSoP has triggered an idea about how to proceed.

Gnumeric Reader was recently changed to handle namespaces better. Using that as a model, this PR begins the process of doing the same for Xlsx. Xlsx is much larger and more complicated than Gnumeric, hence the need to tackle it in multiple phases. I believe that this PR handles all of:

  • listWorkSheetNames
  • listWorkSheetInfo. Note that there was a bug in this function which would cause it to count only used columns rather than all columns. That bug is corrected.
  • active sheet
  • selected cell and top left cell
  • cell content (formulas, numbers, text)
  • hyperlinks
  • comments (partial - see below)

This PR does not address:

  • styles
  • images and charts
  • VBA and ribbons
  • many other items, I'm sure

The issue for non-standard namespacing till now has been the use of unexpected prefixes. While I was working on this change, @Lambik introduced issue #2067 PR #2068 which introduced a completely different problem - the use of unexpected URLs. That PR and the issue associated with it were quite well documented, including the supplying of a test file and tests for it. I asked if I could take a look to see if it could be integrated with my change, and the result seems to be yes, so those changes are also part of this PR.

While adding a comment to my test file, I discovered that Microsoft had added "threaded comments" as a new feature. I believe these are not yet supported by PhpSpreadsheet, and I am not going to add it, at least not now. I believe that, among other things, this will make identifying the author of a comment more difficult.

Although there are a number of Phpstan baseline changes as part of this PR, I did not attempt to resolve all Phpstan reports for Reader/Xlsx. Nor did I do anything to increase coverage. This change is already large and complex enough without those efforts.

I will add more detail as comments after I push this change.

This is:

- [x] a bugfix
- [ ] a new feature

Checklist:

Why this change is needed?

oleibman
oleibman

I am going to continue to study the change for a few more days to see if any tweaks or new test files are needed. I expect to give it a "go ahead" signal before Friday.

Activity icon
issue

oleibman issue comment PHPOffice/PhpSpreadsheet

oleibman
oleibman

Xlsx Reader Better Namespace Handling Phase 1 Try2

This is a replacement for #2088, which has run into merge conflicts. I will close that PR in the near future, however the comments in that PR may prove useful for this one. While that PR has been in draft status all along, I am marking this one as ready. I will gladly add additional tests (and, of course, make code changes) that anyone has to suggest, but, with my most recent test files which I will describe in a separate comment, I have no further ideas on useful additions.

As mentioned in the earlier ticket, this is a risky change. But, as has been demonstrated, delaying it comes with its own set of risks. It would be helpful to have a temporary moratorium on changes to Reader/Xlsx until this change is merged.

The original commit message follows.

There have been a number of issues concerning the handling of legitimate but unexpected namespace prefixes in Xlsx spreadsheets created by software other than Excel and PhpSpreadsheet/PhpExcel.I have studied them, but, till now, have not had a good idea on how to act on them. A recent comment https://github.com/PHPOffice/PhpSpreadsheet/issues/860#issuecomment-824926224 in issue #860 by @IMSoP has triggered an idea about how to proceed.

Gnumeric Reader was recently changed to handle namespaces better. Using that as a model, this PR begins the process of doing the same for Xlsx. Xlsx is much larger and more complicated than Gnumeric, hence the need to tackle it in multiple phases. I believe that this PR handles all of:

  • listWorkSheetNames
  • listWorkSheetInfo. Note that there was a bug in this function which would cause it to count only used columns rather than all columns. That bug is corrected.
  • active sheet
  • selected cell and top left cell
  • cell content (formulas, numbers, text)
  • hyperlinks
  • comments (partial - see below)

This PR does not address:

  • styles
  • images and charts
  • VBA and ribbons
  • many other items, I'm sure

The issue for non-standard namespacing till now has been the use of unexpected prefixes. While I was working on this change, @Lambik introduced issue #2067 PR #2068 which introduced a completely different problem - the use of unexpected URLs. That PR and the issue associated with it were quite well documented, including the supplying of a test file and tests for it. I asked if I could take a look to see if it could be integrated with my change, and the result seems to be yes, so those changes are also part of this PR.

While adding a comment to my test file, I discovered that Microsoft had added "threaded comments" as a new feature. I believe these are not yet supported by PhpSpreadsheet, and I am not going to add it, at least not now. I believe that, among other things, this will make identifying the author of a comment more difficult.

Although there are a number of Phpstan baseline changes as part of this PR, I did not attempt to resolve all Phpstan reports for Reader/Xlsx. Nor did I do anything to increase coverage. This change is already large and complex enough without those efforts.

I will add more detail as comments after I push this change.

This is:

- [x] a bugfix
- [ ] a new feature

Checklist:

Why this change is needed?

oleibman
oleibman

Forgot to add "more detail" when I pushed this change. Here it is.

I think this change is ready, but it requires more scrutiny than most changes. It is unusually likely that I didn't dot an "i" or cross a "t" somewhere that isn't caught in unit testing. Part of the reason is because test coverage of Reader/Xlsx isn't all that high in the first place, and a fair proportion of the coverage comes from samples. Here's an explanation for some of what I've done, since my motives won't always be obvious.

Added a Reader/Xlsx/Namespaces class to eliminate the hard-coded urls found in dozens of places throughout Reader/Xlsx and its subclasses.

Added 2 routines, loadZip and loadZipNoNamespace, to handle the reading of the zip files. Both can specify a namespace, but the latter ignores it. Any calls to loadZipNoNamespace should act exactly the same as before, but they indicate that I either haven't analyzed the call yet, or haven't been able to determine whether specifying a namespace would be a more correct action. In a couple of cases, I call both because namespaced seems to work with part of the code that follows, but not with other parts.

Introduced 2 functions, testSimpleXml and xpathNoFalse, to attempt to eliminate the plethora of SimpleXMLElement|false and array|false possibilities that Phpstan (and, doubtless, Scrutinizer) dislike. Similarly, I have tried to cast SimpleXMLElement to string once in cases where it is done several times within a few statements.

I did not do any major refactoring with this PR. Reader/Xlsx is desparately in need of it; I just couldn't figure out how to break it up with this PR. I plan to come back to it. I do, however, have some ideas for how to refactor Styles, which is what I plan to do next if this PR is merged.

The new test file namespacestd.xlsx and the tests associated with are based on the Sylk test file, because I know that covers a lot of cases. The new test file namespacenonstd.xlsx is crafted by hand from this so that they can run identical tests (and also because, despite the number of namespace issues, I couldn't find much in the way of useful example files). Some of the nonstd tests are, of course, marked incomplete for now.

The test file namespacepurl.xlsx and its tests come from @Lambik PR #2068.

The new test file issue2109b.xlsx is based on a file uploaded for issue #2109. I have manually confirmed that I can read and make an unstyled copy of the uploaded file, but it is much too large to add to the unit test suite. I used sed and vim to delete all but the first few rows of the spreadsheet. This brings it to a manageable size for the test suite. Although it required some manual manipulation on my part, I think we can classify it as "naturally" created (as opposed to namespacenonstd).

The new test file openpyxl35.xlsx was created with ancient version 2.3.5 of openpyxl, before its namespacing was changed to be PhpSpreadsheet-compatible. Not all the xml files within it use unexpected namespacing, but xl/themes/theme1.xml, xl/workbook.xml, docprops/app.xml, and docprops/core.xml all do, and I think that the last 3 are definitely involved in the unit tests. The technique used to create this file might prove helpful in targeting future tests.

So, we now have files generated in 4 different ways that would not have been readable by PhpSpreadsheet before this change. I am open to adding new methods, but I think this is a sufficient number.

Activity icon
issue

oleibman issue PHPOffice/PhpSpreadsheet

oleibman
oleibman

Locale Files are Generated with Windows Line-endings

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Files should have Unix line endings.

What is the current behavior?

They have Windows line endings. This causes git to think they have all been changed; at least that's what it thinks on my Windows machine (which I have configured to use Unix line endings). It would be easy enough to change them all, but, since they appear to be generated, I'm not sure any such change would stick.

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

Which versions of PhpSpreadsheet and PHP are affected?

This seems to have been caused by #2111.

Activity icon
issue

oleibman issue comment PHPOffice/PhpSpreadsheet

oleibman
oleibman

Locale Files are Generated with Windows Line-endings

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Files should have Unix line endings.

What is the current behavior?

They have Windows line endings. This causes git to think they have all been changed; at least that's what it thinks on my Windows machine (which I have configured to use Unix line endings). It would be easy enough to change them all, but, since they appear to be generated, I'm not sure any such change would stick.

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

Which versions of PhpSpreadsheet and PHP are affected?

This seems to have been caused by #2111.

Activity icon
delete

MarkBaker in PHPOffice/PhpSpreadsheet delete branch PHP81-Changes-to-Defaults-Requires-Explicit-Arguments

deleted time in 1 day ago
push

MarkBaker push PHPOffice/PhpSpreadsheet

MarkBaker
MarkBaker

Changes to the default arguments for htmlspecialchars() and html_entity_decode() requires setting of the argument value explicitly to prevent changes in behaviour. (#2176)

Specifically, the default for these two functions has been changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE

This PR configures the argument used for those functions in Settings, and then explicitly applies it everywhere they are used in the codebase.

commit sha: 5769885802b8b4394a880398c8fb1a7d919e8da6

push time in 1 day ago
pull request

MarkBaker pull request PHPOffice/PhpSpreadsheet

MarkBaker
MarkBaker

Changes to the default arguments for `htmlspecialchars()` and `html_entity_decode()` for PHP8.1

This is:

- [ ] a bugfix
- [ ] a new feature
- [X] PHP version change

Checklist:

Why this change is needed?

Changes to the default arguments for htmlspecialchars() and html_entity_decode() for PHP8.1 requires setting of the argument value explicitly to prevent changes in behaviour.

Specifically, the default for these two functions has been changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE

This PR configures the argument used for those functions in Settings, and then explicitly applies it everywhere they are used in the codebase.

pull request

MarkBaker pull request PHPOffice/PhpSpreadsheet

MarkBaker
MarkBaker

Changes to the default arguments for `htmlspecialchars()` and `html_entity_decode()` for PHP8.1

This is:

- [ ] a bugfix
- [ ] a new feature
- [X] PHP version change

Checklist:

Why this change is needed?

Changes to the default arguments for htmlspecialchars() and html_entity_decode() for PHP8.1 requires setting of the argument value explicitly to prevent changes in behaviour.

Specifically, the default for these two functions has been changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE

This PR configures the argument used for those functions in Settings, and then explicitly applies it everywhere they are used in the codebase.

Activity icon
created branch

MarkBaker in PHPOffice/PhpSpreadsheet create branch PHP81-Changes-to-Defaults-Requires-Explicit-Arguments

createdAt 1 day ago
pull request

Jouzeyu pull request PHPOffice/PHPWord

Jouzeyu
Jouzeyu

CloneRowAndSetValues adds image condition judgment

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes # (issue)

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
Activity icon
fork

Jouzeyu forked PHPOffice/PHPWord

⚡ A pure PHP library for reading and writing word processing documents
Jouzeyu Updated
fork time in 1 day ago
Activity icon
fork

wkdtndgns forked PHPOffice/PHPExcel

⚡ ARCHIVED
wkdtndgns Updated
fork time in 1 day ago
started
started time in 1 day ago
open pull request

jarrettj wants to merge PHPOffice/PhpSpreadsheet

jarrettj
jarrettj

When image source is a URL, store the URL for use during extraction.

When image source is a link store the link.

This is:

- [ ] a bugfix
- [x] a new feature

Checklist:

Why this change is needed?

Described in issue https://github.com/PHPOffice/PhpSpreadsheet/issues/1997.

jarrettj
jarrettj

Hey, updated the code, onto the tests. Could you point me in the right direction on how to do the tests? Thanks.

pull request

jarrettj merge to PHPOffice/PhpSpreadsheet

jarrettj
jarrettj

When image source is a URL, store the URL for use during extraction.

When image source is a link store the link.

This is:

- [ ] a bugfix
- [x] a new feature

Checklist:

Why this change is needed?

Described in issue https://github.com/PHPOffice/PhpSpreadsheet/issues/1997.

Activity icon
issue

ranolrandria issue comment PHPOffice/PHPWord

ranolrandria
ranolrandria

TemplateProcessor->setImageValue()

Allow to put images in templates.

Fixes #1079 Fixes #939 Fixes #708

ranolrandria
ranolrandria

hi, I'm using phpword to insert image with setImageValue, I don't know but the first image don't show and the file word is corrupt

Activity icon
issue

gaogan779322720 issue PHPOffice/PHPPresentation

gaogan779322720
gaogan779322720

After setting the font, if it is Chinese, the set font has no effect

For example, if I set Microsoft YaHei, it will not be Microsoft YaHei after export, but it is said in the upper left corner that it is Microsoft YaHei. In fact, it is not Microsoft YaHei font

Activity icon
issue

gaogan779322720 issue PHPOffice/PHPPresentation

gaogan779322720
gaogan779322720

设置字体以后,如果是中文则设置的字体没有效果

比如我设置了微软雅黑,导出以后不是微软雅黑,左上角却说他是微软雅黑,真实情况他不是微软雅黑字体

started
started time in 2 days ago
started
started time in 2 days ago
started
started time in 2 days ago