Use JavaScript Action to convert the page into word and download it
0
I have a functional requirement to convert the content presented on the page into a word.doc file or pdf file and download it. My idea is to build a button to call a nanoflow, Then nanoflow calls a JavaScript action. But as far as I know, JavaScript actions cannot use <script src=''></script> to reference other libraries or plugins. I tried just pasting the source of JQuery and bootstrap directly into my code snippet like this. In fact, some of the syntax of Jquey can be used. To export files, you also need to use the two plug-ins FileSaver.min.js and FileSaver.min.js. I also tried to paste the source code of these two plugins directly, but it didn't work this time. The error message shows that a method named wordExport cannot be recognized, I realized this wasn't going to work. When I saw the import part in the generated code, I tried to use npm to manage the required libraries. I installed the node.js environment and installed these plugins using npm install. Installed these libraries and plugins into my project directory. After that, you can see that the reference is valid and the path of the file can be displayed. But when I installed the jquery.wordexport.js plugin, the following problem occurred. I have investigated and learned that this plugin may not be a widely used plugin or its maintenance status may be outdated. But I can still download the js source code through git. git address:https://github.com/markswindoll/jQuery-Word-Export Now I have downloaded this file, But I don't know how else Mendix can use this code.