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

read from word2007 type, complex paragraphs will break into several lines #1043

Closed
donghaobo opened this issue Apr 8, 2017 · 3 comments
Closed

Comments

@donghaobo
Copy link

donghaobo commented Apr 8, 2017

reader/word2007/abstract::readParagraph
if ($runLinkCount > 1) should create only one textRun as parent, but it created so many
the following change may work well

@@ -167,11 +167,14 @@ abstract class AbstractPart
                 $parent->addTextBreak(null, $paragraphStyle);
             } else {
                 $nodes = $xmlReader->getElements('*', $domNode);
+                if($runLinkCount > 1){
+                                       $parent = $parent->addTextRun($paragraphStyle);
+                               }
                 foreach ($nodes as $node) {
                     $this->readRun(
                         $xmlReader,
                         $node,
-                        ($runLinkCount > 1) ? $parent->addTextRun($paragraphStyle) : $parent,
+                        $parent,
                         $docPart,
                         $paragraphStyle
                     );
@Paperclip-Systems
Copy link

This worked perfectly for me, thank you for submitting a solution.

@xuxiaoshuo
Copy link

Thank

@troosan troosan added this to the v0.14.0 milestone Jun 29, 2017
@troosan troosan self-assigned this Jun 29, 2017
@troosan troosan closed this as completed Jul 3, 2017
Zxurian pushed a commit to tantormedia/PHPWord that referenced this issue Jul 25, 2017
@yt7260
Copy link

yt7260 commented Sep 21, 2017

thanks!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants