Skip to content

Add support for reading <w:tab/> element in runs. #1299

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

Merged
merged 4 commits into from
Mar 18, 2018

Conversation

zobo
Copy link
Contributor

@zobo zobo commented Mar 1, 2018

Description

Adds support for Word2007 reader to understand <w:tab/> element in <w:r>. All samples seen so far had only either w:tab or w:t elements. Encoded as "\t" character. This will still display correctly in MS Word, however a proper writer should also be implemented.

Related to #862 .

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 update the documentation to describe the changes

@troosan
Copy link
Contributor

troosan commented Mar 2, 2018

Hi @zobo w:tab is already supported (PhpOffice\PhpWord\Style\Tab), only indeed, the reader part is missing. Would you mind reading it as such instead of a simple /t?

@zobo
Copy link
Contributor Author

zobo commented Mar 4, 2018

Hi! Thanks for your comment. As far as I can tell from ECMA-376 there are two different w:tab elements. The one already defined in the code you refer to, I believe, is the one present in w:pPr/w:tabs . There is another w:tab element, defined in 17.3.3.32 chapter of Ecma Office Open XML Part 1 - Fundamentals And Markup Language Reference.pdf. This one doesn't have the same properties, however I couldn't find the relevant XML definition...
I noticed an example at the end of the chapter 11.3.9, page 50. It shows there that within one w:r there can be a combination of w:t and w:tab elements. I have changed the code to support such case.

If you thing a special element is needed anyway, I can try to figure out how to do that and define a different Tab class.

@troosan
Copy link
Contributor

troosan commented Mar 4, 2018

indeed, you are right. You are referring to http://www.datypic.com/sc/ooxml/e-w_tab-2.html

@troosan troosan mentioned this pull request Mar 18, 2018
3 tasks
@troosan troosan merged commit 9ffce35 into PHPOffice:develop Mar 18, 2018
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.

2 participants