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

Improve docx parser to recognise style definition on Headings, which are overriding the default style #1470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anotherjames
Copy link

Description

Inline style differences within headings can currently be missed when reading a docx file. For example, when a heading style is bold, but part of the heading text has been un-bolded. This change ensures that styling that is due to the heading style, is also set on individual Text elements within a TextRun, so they can be differentiated from any that are explicitly overridden.

Previously, all the Text elements within a TextRun that gets set on a Title element, just get the default Font element. That meant, for example, that isBold() returned false, whereas heading styles are often in bold.

@troosan
Copy link
Contributor

troosan commented Dec 27, 2018

Please add unit test and fix syntax

@troosan troosan added the Waiting for feedback Question has been asked, waiting for response from PR author label Dec 27, 2018
@troosan
Copy link
Contributor

troosan commented Dec 28, 2018

@anotherjames As far as I could test your solution only partially works.
I modified the document opened by Sample_11_ReadWord2007.php, making part of the heading not bold. But after parsing it the whole title is still bold. Making part of the title italic works.
So your solution only works when "adding" style, not when "removing" style.

@troosan troosan changed the title Recognise style differences within headings. Improve docx parser to recognise style definition on Headings, which are overriding the default style Dec 29, 2018
@troosan
Copy link
Contributor

troosan commented Dec 29, 2018

@anotherjames I did some more testing. Could you check the sample_11, you will see that

  • Heading 1 is declared as being bold
  • Part of the "PHP Word" is un-bolded, and is Italic in addition

@PowerKiKi PowerKiKi changed the base branch from develop to master November 16, 2022 21:15
@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
Waiting for feedback Question has been asked, waiting for response from PR author
Development

Successfully merging this pull request may close these issues.

None yet

2 participants