hufe921 / canvas-editor-plugin Goto Github PK
View Code? Open in Web Editor NEWplugins for canvas-editor
Home Page: https://hufe.club/canvas-editor-plugin
License: MIT License
plugins for canvas-editor
Home Page: https://hufe.club/canvas-editor-plugin
License: MIT License
Module parse failed: Unexpected token (6675:253)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
我想把canvas-editor编辑器编写的内容导出成docx文件。
1、引入插件并使用:
import docxPlugin from '@hufe921/canvas-editor-plugin-docx';
//使用插件 导出文档方法
function executeWord() {
instance.use(docxPlugin);
if (instance && instance.command && instance.command.executeExportDocx) {
instance.command.executeExportDocx({
fileName: fileName.value
});
}
}
2、导出文档问题,导出文件使用微软office打开:
关于普通文本:
1)字体类型、大小
编辑器内:微软雅黑字体,字号大小默认小四;
导出文件使用微软office打开:中文正文,字号21;
关于图片:
1)图片宽高失真,无法像在编辑器一样被保留下来;
关于表格:
1)表格内文字大小和文字在表格中的位置无法居中或者居左;
2)表格无法设置底纹颜色;
3) 表格无法自适应;
编辑器中的换行,导出到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
})
}
}
|
_HOSPITALNAME_ |
|||||||||||||
放射科急诊检查临时报告单(DR) |
||||||||||||||
病例号:_PATCODE_ |
|
检查时间: |
_CHECKDATE_ |
|||||||||||
姓名: |
患者1 |
性别: |
男 |
年龄: |
33岁 |
门诊号: |
_OUTPATNO_ |
|||||||
申请医师: |
_REFERINGDOCTOR_ |
科别: |
_REFERINGDEPART_ |
床号: |
_SICKBEDNO_ |
住院号: |
_INPATNO_ |
|||||||
检查方法: |
_EXAMMETHOD_ |
检查部位: |
_CHECKPART_ |
|||||||||||
表现: |
|
|||||||||||||
|
_BEHAVIOR_ |
|
||||||||||||
印象: |
|
|||||||||||||
|
_DIAGRESULT_ |
|
||||||||||||
急诊报告医师: |
|
报告时间: |
2024-03-25 |
|||||||||||
急诊检查技师: |
_ZHUBANJISHI_ |
|
|
希望可以增加 导入word doc、docx格式文件,友好的兼容模式
@hufe921/canvas-editor-plugin-docx
是不是vue不能用呀,按照引用报错index.vue:37 Uncaught (in promise) TypeError: editorInstance.executeExportDocx is not a function
求大佬指点。
你好,我在使用canvas-editor-plugin-docx插件的时候,导出文档的格式发生了变化,是没有做这个方面的适配吗
1
Hello, when I try to use the docx plugin the following error appears regarding the type of the docxPlugin function:
instance.use(docxPlugin) show:
Argument of type '(editor: Editor) => void' is not assignable to parameter of type 'PluginFunction<unknown>'.
Types of parameters 'editor' and 'editor' are incompatible.
Type 'import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/src/editor/index").default' is not assignable to type 'import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/node_modules/@hufe921/canvas-editor/dist/src/editor/index").default'.
Types of property 'eventBus' are incompatible.
Type 'import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/src/editor/core/event/eventbus/EventBus").EventBus<import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/src/editor/interface/EventBus").EventBusMap>' is not assignable to type 'import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/node_modules/@hufe921/canvas-editor/dist/src/editor/core/event/eventbus/EventBus").EventBus<import("e:/Downloads/projects/canvas-editor-versions/compile-to-polisoftware/canvas-editor/node_modules/@hufe921/canvas-editor/dist/sr...'.
Types have separate declarations of a private property 'eventHub'.ts(2345)
And instance.command show:
Conversion of type 'Command' to type 'CommandWithDocx' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
Property 'executeExportDocx' is missing in type 'Command' but required in type '{ executeExportDocx(options: IExportDocxOption): void; }'.ts(2352)
Excuse my ignorance, but I'm new to typescript, so I was confused on how to proceed, isn't the PluginFunction type the same as the imported function docxPlugin ? How do I adjust this? Thanks in advance.
编辑器中进行分页处理,导出后会异常,n页
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.