Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support default MS Word heading styles H1 .. H6 when importing HTML #2054

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

lubosdz
Copy link
Contributor

@lubosdz lubosdz commented Apr 12, 2021

Description

Fixes #2053 .

This PR adds support for applying default MS Word styles with BC compatability and option to forcibly enable/disable it.

Example - following H1 tags will now appear styled similarly to MS Word heading 1:

$html = "<h1>Heading 1</h1>";
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
Html::addHtml($section, $html);

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

@lubosdz
Copy link
Contributor Author

lubosdz commented Apr 12, 2021

CS fixer failure looks strange - shows line 1 (?) on unit tests file, does not seem related to this PR.

@troosan troosan added this to the v0.19.0 milestone Apr 15, 2021
@lubosdz
Copy link
Contributor Author

lubosdz commented Apr 15, 2021

CS fixer - I really don't know what & where should be fixed, sorry .. is this tool really useful, if it cannot show error line?

Also opinions wanted:

  • should BC compatability be maintained between major versions (0.18 -> 0.19) ? For that purpose extra option DISABLE_DEFAULT_HEADING_STYLE has beeen introduced. Current default behaviour will be default always apply default heading styles unless explicitly supplied option DISABLE_DEFAULT_HEADING_STYLE = 1. So all existing apps would need to set this option if they wanted to retain BC compatability. However, there si no real reason to keep faulty BC behaviour because <= 0.18.1 global title style could never be applied - because heading styles were named HeadingX while Style object assumed style name Heading_X (underscore). So I dont see much reasons to keep BC compatability. Any opinion?

@troosan
Copy link
Contributor

troosan commented Apr 16, 2021

just run composer check locally, it will tell you what to fix

@lubosdz
Copy link
Contributor Author

lubosdz commented Apr 17, 2021

Thank you for fixing CS fixer formatting issues. I tried to run it locally, but always failed (Windows 10). Though some fixes are disputable e.g. (int) substr($argument1, -1, 1) may not always be the same as intval(substr($argument1, -1, 1)) .

@Progi1984 Progi1984 removed this from the v1.0.0 milestone Nov 16, 2022
@PowerKiKi PowerKiKi changed the base branch from develop to master November 16, 2022 21:15
@mibocs
Copy link

mibocs commented Dec 12, 2022

When could this be released(at least in some dev branch)?

@Progi1984 Progi1984 force-pushed the master branch 3 times, most recently from 2d9f999 to e458249 Compare August 30, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Support default MS Word heading styles H1-H6 on HTML import
4 participants