Giter VIP home page Giter VIP logo

canvas-editor-plugin's Issues

编辑器导出docx文档,格式错乱

我想把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时全部失效

编辑器中的换行,导出到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
})
}
}

表格解析问题:既有width,又存在colspan属性,结果显示不正确

 

_HOSPITALNAME_

放射科急诊检查临时报告单(DR)

病例号:_PATCODE_

 

检查时间:

_CHECKDATE_

姓名:

患者1

性别:

年龄:

33岁

门诊号:

_OUTPATNO_

申请医师:

_REFERINGDOCTOR_

科别:

_REFERINGDEPART_

床号:

_SICKBEDNO_

住院号:

_INPATNO_

检查方法:

_EXAMMETHOD_

检查部位:

_CHECKPART_

表现:

 

 

_BEHAVIOR_

 

印象:

 

 

_DIAGRESULT_

 

急诊报告医师:

报告时间:

2024-03-25

急诊检查技师:

_ZHUBANJISHI_

 

 

![image](https://github.com/Hufe921/canvas-editor-plugin/assets/49359010/6a129f28-165c-4d72-b306-fe99650fdbb7)

canvas-editor-plugin-docx 报错,求指点

@hufe921/canvas-editor-plugin-docx
是不是vue不能用呀,按照引用报错index.vue:37 Uncaught (in promise) TypeError: editorInstance.executeExportDocx is not a function
求大佬指点。

导出word文件格式问题

你好,我在使用canvas-editor-plugin-docx插件的时候,导出文档的格式发生了变化,是没有做这个方面的适配吗

Problem with type when trying to use plugin

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.