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

Unsupported type for pageMargin coordinates #2327

Closed
Dheeraj3reddy opened this issue Sep 6, 2023 · 3 comments · Fixed by #2379
Closed

Unsupported type for pageMargin coordinates #2327

Dheeraj3reddy opened this issue Sep 6, 2023 · 3 comments · Fixed by #2379

Comments

@Dheeraj3reddy
Copy link

Hi,
The generated docx documents contains the following pgMar tag in document.xml
<w:pgMar w:top="1in" w:right="1in" w:bottom="1in" w:left="1in" w:header="708" w:footer="708" w:gutter="0"/>
As specified in documentation of Ecma Office Open XML. Section 17.6.11, ( you can also refer it here)

According to it the possible values for the coordinates are in twips.
The possible values for this attribute are defined by the [ST_SignedTwipsMeasure](http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/ST_SignedTwipsMeasure.html) simple [type](http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/type.html) (§2.18.88).

But the generated documents contain the dimensions in inches. Please look into this issue.

@Dheeraj3reddy
Copy link
Author

Hi, any update on this issue?

@rahon6000
Copy link
Contributor

rahon6000 commented Oct 12, 2023

I had similar issue today. Maybe this would help.

Add this properties in the section.

const doc = new Document({
    sections: [
        {
            properties: {
                page: {
                    margin: {
                        top: convertInchesToTwip(1),
                        bottom: convertInchesToTwip(1),
                        left: convertInchesToTwip(1),
                        right: convertInchesToTwip(1)
                    }
                }
            },
...

In my case, (maybe has same origin you wrote) my old word editor doesn't support "inches" unit.

Since some minor editors fail to open samples provide here, I think there should be an option to use twip for inches. (or at least default value should be twip?)

😅

@dolanmiu
Copy link
Owner

Defaults are now Twip:

#2379

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

Successfully merging a pull request may close this issue.

3 participants