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

StackOverflowError for custom style with default name #547

Open
VolodymyrPashynskyi opened this issue Apr 27, 2023 · 1 comment
Open

StackOverflowError for custom style with default name #547

VolodymyrPashynskyi opened this issue Apr 27, 2023 · 1 comment

Comments

@VolodymyrPashynskyi
Copy link

I received from client docx document where except default Normal style

    <w:style w:type="paragraph" w:default="1" w:styleId="Normal">
        <w:name w:val="Normal"/>
        <w:pPr>
            <w:spacing w:after="200" w:line="276" w:lineRule="auto"/>
            <w:ind w:left="0" w:right="0" w:firstLine="0"/>
        </w:pPr>
        <w:rPr>
            <w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri"/>
            <w:sz w:val="22"/>
            <w:szCs w:val="22"/>
        </w:rPr>
    </w:style>

exist another style with the same name Normal that is based default one

    <w:style w:type="paragraph" w:styleId="Normal">
        <w:name w:val="Normal"/>
        <w:basedOn w:val="Normal"/>
        <w:next w:val="Normal"/>
        <w:pPr>
            <w:jc w:val="left"/>
            <w:ind w:left="0" w:right="0"/>
            <w:bidi w:val="false"/>
        </w:pPr>
        <w:rPr>
            <w:rFonts w:ascii="Arial" w:eastAsia="Arial" w:hAnsi="Arial" w:cs="Arial"/>
            <w:sz w:val="24"/>
            <w:szCs w:val="24"/>
        </w:rPr>
    </w:style>

It leads to StackOverflowError in PropertyResolver class on call fillPPrStack

I was not able to reproduce such document in Microsoft Word, but the original document is successfully openin

@plutext
Copy link
Owner

plutext commented May 1, 2023

There are actually 2 problems here. The first is the duplicate styleId which you noticed.

The second (which leads to the StackOverflowError) is having a style based on itself:

    <w:style w:type="paragraph" w:styleId="Normal">
        <w:basedOn w:val="Normal"/>

Do you know how this docx was created?

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

No branches or pull requests

2 participants