-
Notifications
You must be signed in to change notification settings - Fork 26
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
编辑器中的换行,导出到docx时全部失效 #13
Comments
解决了吗 ? |
Hello, the plugin itself does not handle line wrapping and most styling, so when you export the document it will be completely unconfigured. I made a PR with the handling of styles, including line wrapping. It has not yet been accepted, I believe because the author does not have time available. But if you want to check, here is the changes: |
您好,能发给我一个完整的包吗?感谢🙏 [email protected] |
Hello, for it to work I had to directly implement the plugin in my project, I couldn't make it work by installing via npm. I will attach the package with the implementation files. Just unzip and call within the editor implementation like this:
Here are the plugin implementation files... if you have any questions, I'm at your disposal, I hope it helps. |
Thank you. That’s very kind of you. It's very helpful to me,Can you give me the “trunk” function? |
Sorry, I hadn't noticed the lack of this code, it's simply a function that truncates a number. Here's the function:
|
Thank you, the exported docx is very beautiful now.Solved a big problem, thank you again! |
阳
***@***.***
Thank you, the exported docx is very beautiful now.Solved a big problem, thank you again!
------------------ 原始邮件 ------------------
发件人: "Hufe921/canvas-editor-plugin" ***@***.***>;
发送时间: 2024年6月19日(星期三) 中午11:22
***@***.***>;
***@***.******@***.***>;
主题: Re: [Hufe921/canvas-editor-plugin] 编辑器中的换行,导出到docx时全部失效 (Issue #13)
Sorry, I hadn't noticed the lack of this code, it's simply a function that truncates a number. Here's the function:
export function trunk(valor: number, casas: number) { if (!valor) return valor let valorString if (valor.toString().indexOf('.') != -1) { let decimais = valor.toString().substring(valor.toString().indexOf('.') + 1) casas = casas > decimais.length ? decimais.length : casas decimais = decimais.substring(0, casas) valorString = valor.toString().substring(0, valor.toString().indexOf('.')) + '.' + decimais } else { valorString = valor.toString() } return parseFloat(valorString) }
Thank you, the exported docx is very beautiful now.Solved a big problem, thank you again!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
你好,拷贝了你的docx,有些地方文件的引用找不到 |
Hello, what references cannot be found? |
你这个代码能够保障导出的docx文档行间距,字体样式,字体大小等等保持一致吗?我刚修改了一下源码,将他的elemet.font和element.rowMargin进行动态获取,然后写了一个方法进行换算成兼容docx的变量赋值给了new paragragh()对象中的spacing属性,效果还不错!!! |
I couldn't understand exactly what you mean (due to the translation). But at that time I think the use of rowMargin was a bit limited in the editor. So I tried to focus on some of the styles (at least the ones that made the most sense to me at the time). |
我的意思就是想问,你目前修改了关于这个编辑器的导出docx插件的bug有哪些?我给你看看我在这个exportDocx.ts上面的修改。 |
你用wechat吗?加个联系方式讨论一下 |
编辑器中的换行,导出到docx时全部失效,能是因为啥呢?框架vue
saveWord() {
let that = this
if (
this.$refs.child.instance
) {
this.$message.error('请先生成文章')
} else {
this.$refs.child.instance.use(docxPlugin)
this.$refs.child.instance.command.executeExportDocx({
fileName: that.docData.title
})
}
}
The text was updated successfully, but these errors were encountered: