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

Style not matching with title #1431

Closed
2 of 3 tasks
begnini opened this issue Jul 16, 2018 · 0 comments
Closed
2 of 3 tasks

Style not matching with title #1431

begnini opened this issue Jul 16, 2018 · 0 comments

Comments

@begnini
Copy link
Contributor

begnini commented Jul 16, 2018

This is:

Expected Behavior

MS Word uses a w:name tag to indicate Headings instead w:styleId. In Word Portuguese version, per example, the parameter w:styleId contains the class name in Portuguese (Titulo1) and Word infers if the paragraph is a title looking at <w:name /> tag.

The expected Behavior from phpword is to add a title when find a w:name tag inside a <style> with w:val having "heading" in the text.

Current Behavior

PHPWord is ignoring titles because the Portuguese name.

How to Reproduce

Please provide a code sample that reproduces the issue.

<?php
         Style::resetStyles();

        $xml = '<w:style w:type="paragraph" w:styleId="Ttulo1">
            <w:name w:val="heading 1"/>
            <w:basedOn w:val="Normal"/>
            <w:uiPriority w:val="1"/>
            <w:qFormat/>
            <w:pPr>
                <w:outlineLvl w:val="0"/>
            </w:pPr>
            <w:rPr>
                <w:rFonts w:ascii="Times New Roman" w:eastAsia="Times New Roman" w:hAnsi="Times New Roman"/>
                <w:b/>
                <w:bCs/>
            </w:rPr>
        </w:style>';

        $name = 'Heading_1';

        $phpWord = $this->getDocumentFromString(array('styles' => $xml));
        # printing null, should print a PhpOffice\PhpWord\Style\Font instance
         var_dump(Style::getStyle($name));

Context

  • PHP version: 7.2.2
  • PHPWord version: 0.15
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