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

Header Reference in document.xml #54

Closed
Nimaskalisto opened this issue Jan 22, 2018 · 4 comments
Closed

Header Reference in document.xml #54

Nimaskalisto opened this issue Jan 22, 2018 · 4 comments

Comments

@Nimaskalisto
Copy link

Nimaskalisto commented Jan 22, 2018

Hello @dolanmiu

First of all I would like to say, that your module is superb, you've done really, really good job! I like the idea of collecting parts of docx into one.I was able to do almost all customization without changing a single line of .js/.ts code. Modifications were done by chaning/adding xml files:

template/[Content_Types].xml - added lines:

<Override PartName="/word/media/image1.png" ContentType="image/png"/> <Override PartName="/word/header1.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"/>

template/word/document.xml.rels - added lines:

<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/>

and adding files:

template/media/image1.png
template/word/header1.xml (i took file contents from file generated by libreoffice writer file with header with image).

However, there is still one part which i wasn't able to do by modification of xml files, due document.xml is creating in a fly. The thing i am trying to achieve is adding a section with header reference into the body tag, to be exact right before closing the body tag:

<w:sectPr><w:headerReference w:type="default" r:id="rId3"/><w:type w:val="nextPage"/><w:pgSz w:w="11906" w:h="16838"/><w:pgMar w:left="1134" w:right="1134" w:header="1134" w:top="1693" w:footer="0" w:bottom="1134" w:gutter="0"/><w:pgNumType w:fmt="decimal"/><w:formProt w:val="false"/><w:textDirection w:val="lrTb"/></w:sectPr>

I tested it, by adding manually this piece of code into document.xml file in file I generated by using Your module, and that did the trick.

I am also aware that this is hackish style of solving that problem, so maybe there is other, more beautiful way to achieve it?

I attached document where all modifications are included. My Document.docx

Thank you!

@dolanmiu
Copy link
Owner

Thanks so much for the feedback!

I will add header support soon. Right now, it is not supported.

I have been working on a big feature, which will bring images to docx! So you can do doc.createImage("FILE_PATH") ;

I will release this soon.

What you have wrote will help a lot in the development.

@Nimaskalisto
Copy link
Author

@dolanmiu You are welcome! If i can help somehow in development, let me know, i gonna study more structure of your module.

@dolanmiu
Copy link
Owner

dolanmiu commented Jan 23, 2018

Yes, if you can help that will be great!

Are footers similar to headers?

Added the big changes yesterday, it should improve code quality substantially

@dolanmiu
Copy link
Owner

Done now in #56

Will merge soon, and will be available in version 4.0.0

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