poornima.binu@gmail.com
Forum Replies Created
-
AuthorPosts
-
Thank you for your reply.
Basically I am not able to set any new value(big or small) to any of the page margin attributes .Please find the JS code written for the same.
Word.run(function (context) {
var body = context.document.body;
body.insertOoxml(“<pkg:package xmlns:pkg=’http://schemas.microsoft.com/office/2006/xmlPackage’><pkg:part pkg:name=’/_rels/.rels’ pkg:contentType=’application/vnd.openxmlformats-package.relationships+xml’ pkg:padding=’512′><pkg:xmlData><Relationships xmlns=’http://schemas.openxmlformats.org/package/2006/relationships’><Relationship Id=’rId1′ Type=’http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument’ Target=’word/document.xml’/></Relationships></pkg:xmlData></pkg:part><pkg:part pkg:name=’/word/document.xml’ pkg:contentType=’application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml’><pkg:xmlData><w:document xmlns:w=’http://schemas.openxmlformats.org/wordprocessingml/2006/main’ ><w:body><w:p><w:pPr><w:rPr><w:color w:val=’70AD47′ w:themeColor=’accent6’/><w:sz w:val=’28’/></w:rPr></w:pPr><w:r><w:rPr><w:color w:val=’70AD47′ w:themeColor=’accent6’/><w:sz w:val=’28’/></w:rPr><w:t>Set the page Margins</w:t></w:r></w:p><w:sectPr w:rsidR=’00000000′><w:pgSz w:w=’12240′ w:h=’15840’/><w:pgMar w:top=’2880′ w:right=’2880′ w:bottom=’2880′ w:left=’2880′ w:header=’1440′ w:footer=’1440′ w:gutter=’0’/><w:cols w:space=’720’/></w:sectPr></w:body></w:document></pkg:xmlData></pkg:part></pkg:package>”, Word.InsertLocation.start);
return context.sync().then(function () {
});
})
.catch(function (error) {
});I couldn’t see any change in the newly generated file.There is no change in values even after saving and opening it.The below page margin attributes are seen in the OOXML file for the newly generated word document.
<w:pgMar w:top=”1440″ w:right=”1440″ w:bottom=”1440″ w:left=”1440″ w:header=”720″ w:footer=”720″ w:gutter=”0″/>
I am not sure whether it is a limitation in JS API code.Is there any way to edit the word page setup values in javascript?
- This reply was modified 8 years, 4 months ago by poornima.binu@gmail.com.
-
AuthorPosts