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

can't correct read same heading‘s page count #1607

Open
2 tasks
yangweijie opened this issue Apr 1, 2019 · 0 comments
Open
2 tasks

can't correct read same heading‘s page count #1607

yangweijie opened this issue Apr 1, 2019 · 0 comments

Comments

@yangweijie
Copy link

This is:

Expected Behavior

Please describe the behavior you are expecting.
image
there are 3 ways to split one heading into two or more pages.
but

Current Behavior

only “分页符” can read as pageBreak element.
other occasion only nothing elements excepte text.
What is the current behavior?

Failure Information

Please help provide information about the failure.

How to Reproduce

Please provide a code sample that reproduces the issue.

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = \PhpOffice\PhpWord\IOFactory::load('t1.docx');
    	$sections = $phpWord->getSections();
    	$jiedian = [];
    	foreach ($sections as $key => $section) {
    		// dump($section->getStyle());
    		
    		$headers = $section->getHeaders();
    		foreach ($headers as $key => $header) {
	    		
	    		$elements = $header->getElements();
	    		foreach ($elements as $e1) {
	    			$class = get_class($e1); //获取word中对应内容类型类
	    			// dump($class);
	            	$elname = explode("\\", $class)[3];
	            	// dump($elname);
	            	if(false == in_array($elname, $jiedian)){
	            		$jiedian[] = $elname;
	            	}
	    		}
    		}
    		foreach ($section->getElements() as $e1) {
    			$class = get_class($e1); //获取word中对应内容类型类
    			// dump($class);
            	$elname = explode("\\", $class)[3];
            	// dump($elname);
            	if(false == in_array($elname, $jiedian)){
            		$jiedian[] = $elname;
            	}
    		}
    		$footers = $section->getFooters();
    		foreach ($footers as $key => $footer) {
	    		// dump($footers);
	    		$elements = $footer->getElements();
	    		foreach ($elements as $e1) {
	    			$class = get_class($e1); //获取word中对应内容类型类
	    			// dump($class);
	            	$elname = explode("\\", $class)[3];
	            	// dump($elname);
	            	// dump($e1->getText());
	            	if(false == in_array($elname, $jiedian)){
	            		$jiedian[] = $elname;
	            	}
	    		}
    		}
    	}
    	dump($words);

Context

  • PHP version:
  • PHPWord version: 0.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant