Comments (4)
@NickAtk btw this was a known issue and was fixed and will be available soon.
This is the code that i tried in the updated build and it just replaces the text. Tried it in a list context and also works ok. (just replaces the text without modifying the list format). Would be great if you can share the HTML and the OOXML you are trying to insert to verify it. thanks!
`
function replaceWithHTML() {
Word.run(function (ctx) {
var myRange = ctx.document.getSelection().insertHtml("<b>some bold text!</b>", "replace");
return ctx.sync();
});
}
function replaceWithText() {
Word.run(function (ctx) {
var myRange = ctx.document.getSelection().insertText("This is the Text!", "replace");
return ctx.sync();
});
}
function replaceWithOOXML() {
Word.run(function (ctx) {
var myRange = ctx.document.getSelection().insertOoxml("<w:p xmlns:w='http://schemas.microsoft.com/office/word/2003/wordml'><w:r><w:rPr><w:b/><w:b-cs/><w:color w:val='FF0000'/><w:sz w:val='28'/><w:sz-cs w:val='28'/></w:rPr><w:t>Hello world (this should be bold, red, size 14).</w:t></w:r></w:p>", "replace");
return ctx.sync();
});
}
`
from office-js-docs.
Thank you @NickAtk for reporting this issue. Does this occur with any OOXML you insert into the paragraph that is part of a bulleted list?
from office-js-docs.
The sort of thing I am doing is simple replacement of some text with some other text. However even if the text is unchanged it happens. Every time. Very consistent.
I have tried OOXML with (and without) the numbering.xml data (relationship http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering) which I haven't altered from what Word gives me (except removing the mc:Ignorable attribute).
Word appears to change the information in the numbering.xml data in a way that doesn't preserve the appearance of the paragraph.
from office-js-docs.
@NickAtk thanks for reporting this. I have a quick question, if you are just replacing text why not use insertText method? or why is it that you need OOXML or HTML ? thanks!
from office-js-docs.
Related Issues (20)
- Access to DOM in order to render React component HOT 1
- Event Listener for when conditional formatting changes [Excel] [Feature Request] HOT 7
- Is it possible to add an office add-in manifest file to excel programmatically on a certain action? HOT 1
- Word Online: OBJ characters get inserted in a document having fields HOT 2
- Word Online: SmartArt disappears from document HOT 2
- Event Listeners for when defined name is created or modified [Excel] [Feature Request] HOT 2
- Unique Identifier for a defined name (name range) [Excel] [feature Request] HOT 3
- [Important]Need events for Office Web versions of Word and Excel HOT 1
- Is there a Changelog or Release Notes HOT 4
- When support the Shape object? HOT 3
- Excel Add-In getting 7000 Permission denied HOT 1
- Will database connectivity be implemented in office.js? HOT 2
- Adding Vuetify package to Excel addin made with VueJS framework HOT 1
- Range.find SearchCriteria parameter should be optional HOT 1
- Excel.SearchDirection enum names inconsistent HOT 1
- Casing suggestions in Excel 1.9 APIs HOT 1
- does Office Online Server embed page supported ?
- pivotTable have support Insert Calculated Field HOT 1
- [excel] can taskpane display left side of excel HOT 1
- Compatibility with office Excel 2019 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from office-js-docs.