word-addins

Add-in persistent settings in OSX/Mac

痞子三分冷 提交于 2019-12-10 10:41:51
问题 I am having trouble finding a way to store persistent settings for an office.js add-in on Mac. On windows localStorage works perfect as it saves settings that persist through closing and opening Word. On Mac localStorage does not persist closing and opening Word, not even through a refresh or closing and opening of the add-in. Here is a simple code sample: var settingString = 'mySetting'; var oldValue = localStorage.getItem(settingString); write('oldValue: "' + oldValue + '"'); var d = new

Word insertOoxml method returning Error: Unknown for all input

守給你的承諾、 提交于 2019-12-03 17:16:23
I have an existing Word Add-In solution that has been working well for a long time that now cannot insert OOXML content into Word documents. Trying to break this down I can't get the insertOoxml method to work under any circumstance. To reproduce: await Word.run(async (context) => { context.document.getSelection().insertOoxml(theOoxml, 'Start'); await context.sync(); }); Where theOoxml can be any valid Ooxml string. The reference example I have been using is: <pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage"> <pkg:part pkg:name="/_rels/.rels" pkg:contentType=

Find and Highlight issue in word addin

坚强是说给别人听的谎言 提交于 2019-12-02 17:25:03
问题 I used to highlight the 'word' using this code.It is used inside a 'for each' loop which loops through collection of strings. But the issue is after the all the words are highlighted .. if we try to change any one word in the document all the highlight removed automatically. word.Find find = rng.Find; find.Wrap = word.WdFindWrap.wdFindContinue; find.Font.UnderlineColor = word.WdColor.wdColorRed; find.HitHighlight( FindText: wd, MatchCase: true, TextColor:word.WdColor.wdColorRed,

How to insert document page number in a header with word addin?

爷,独闯天下 提交于 2019-12-02 16:21:38
问题 I know how to insert footer and header, but I wonder how can I insert page number with with my word addin? 'Word.run(function (context) { var mySections = context.document.sections; context.load(mySections, 'body/style'); return context.sync().then(function () {var myFooter = mySections.items[0].getFooter("primary"); myFooter.insertParagraph(footerText.value, "End"); return context.sync().then(function () { console.log("Added a footer to the first section."); }); }); ' 回答1: I finally found

How to insert document page number in a header with word addin?

时光毁灭记忆、已成空白 提交于 2019-12-02 09:18:09
I know how to insert footer and header, but I wonder how can I insert page number with with my word addin? 'Word.run(function (context) { var mySections = context.document.sections; context.load(mySections, 'body/style'); return context.sync().then(function () {var myFooter = mySections.items[0].getFooter("primary"); myFooter.insertParagraph(footerText.value, "End"); return context.sync().then(function () { console.log("Added a footer to the first section."); }); }); ' I finally found time to research and put this together. This code is written ScriptLab. Since ScriptLab complains about XML

Find and Highlight issue in word addin

拥有回忆 提交于 2019-12-02 08:33:08
I used to highlight the 'word' using this code.It is used inside a 'for each' loop which loops through collection of strings. But the issue is after the all the words are highlighted .. if we try to change any one word in the document all the highlight removed automatically. word.Find find = rng.Find; find.Wrap = word.WdFindWrap.wdFindContinue; find.Font.UnderlineColor = word.WdColor.wdColorRed; find.HitHighlight( FindText: wd, MatchCase: true, TextColor:word.WdColor.wdColorRed, MatchWholeWord: true, HighlightColor: word.WdColor.wdColorLightYellow ); By design, HitHighlight only leaves the