I am trying to build a library using docx. And I wanted to implement plugin architecture. So, the data provided by plugin should work well with the eco-system.
But strangely, when I compare the data with JSON.stringify, the same data when created directly using docx library instance in the app works but the same data geenrated in some other library using the docx library does not work.
Initially I had no clue. But I just tested out this
// this is the simplified code
new Documnet({
sections: [
children: {
Object.assign({}, new Paragraph("some text"));
}
]
})
If you don't use Object.assign, it works well. But it created corrupted document when I used Object.assign.
When I compared the working and non-working files, I noted that the corrupt file had <rootKey>w:r</rootKey>
in document.xml
in place of <w:r><w:t xml:space="preserve">some text here</w:t></w:r>
.
Also check out this issue -
I tried going through the codebase but didn't find any obvious reason. Can anyone help with this please.
Here's the exact code - .ts#L106
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744789430a4593824.html
评论列表(0条)