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

make FontStyle basedOn paragraph if the paragraph is set on the font #926

Merged
merged 5 commits into from
Sep 17, 2017

Conversation

troosan
Copy link
Contributor

@troosan troosan commented Oct 28, 2016

When we create a FontStyle specifying a ParagraphStyle, the Word2007 writer correctly generates a style of type "paragraph" instead of a "character".

But, in that case we should also set the "w:styleId" and more importantly, the "w:basedOn" should not be "Normal", but the name of the Paragraph.

So, instead of generating

    <w:style w:type="paragraph" w:customStyle="1" w:styleId="BaseStyle">
        <w:name w:val="BaseStyle"/>
        <w:basedOn w:val="Normal"/>
        <w:pPr>
            <w:jc w:val="center"/>
        </w:pPr>
    </w:style>
    <w:style w:type="paragraph">
        <w:name w:val="ChildFontStyle"/>
        <w:basedOn w:val="Normal"/>
        <w:pPr>
            <w:jc w:val="center"/>
        </w:pPr>
        <w:rPr>
            <w:sz w:val="32"/>
            <w:szCs w:val="32"/>
        </w:rPr>
    </w:style>

we should generate

    <w:style w:type="paragraph" w:customStyle="1" w:styleId="BaseStyle">
        <w:name w:val="BaseStyle"/>
        <w:basedOn w:val="Normal"/>
        <w:pPr>
            <w:jc w:val="center"/>
        </w:pPr>
    </w:style>
    <w:style w:type="paragraph" w:styleId="ChildFontStyle">
        <w:name w:val="ChildFontStyle"/>
        <w:basedOn w:val="BaseStyle"/>
        <w:pPr>
            <w:jc w:val="center"/>
        </w:pPr>
        <w:rPr>
            <w:sz w:val="32"/>
            <w:szCs w:val="32"/>
        </w:rPr>
    </w:style>

@troosan troosan changed the title make FontStyle based on paragraph if it set make FontStyle basedOn paragraph if the paragraph is set on the font Oct 29, 2016
@troosan troosan added this to the v0.14.0 milestone Sep 17, 2017
@troosan troosan merged commit 8ce1a19 into PHPOffice:develop Sep 17, 2017
@troosan troosan deleted the fix_font_style_based_on branch September 17, 2017 19:38
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.

None yet

1 participant