Added the word document import function to FCKeditor (tested)

Source: Internet
Author: User

This was obtained by referring to some posts on the Internet. Some posts cannot be debugged due to the poor key steps. Although I am at the cainiao level, I made some modifications step by step and finally got it out accidentally, happy!

FCKeditor uses FCKeditor. net_2.6.3 and fckeditor_2.6.4.1.

The default FCKeditor can be used to paste images from MS Word. However, when your Word documents contain images, an error occurs that the images cannot be displayed,

Here we want to import the Word documents directly. If the pictures are included, the pictures will be automatically separated and uploaded to the server and displayed in FCKeditor. (However, the import process is slow when the Word documents are large)

1. Add a Custom button for FCKeditor

Files to be modified:

1. fckconfig. js

2. zh-cn.js

3. fckeditorcode_ie.js (similar to gecko)

Fckconfig. JS: add the word document import button

Find fckconfig. toolbarsets ["default"] = [...

'Paste ', 'pastetext', 'pasteword', insert 'importword' after pasteword '.

Zh-cn.js

Set the Chinese description of the buttons above

Pasteword: "pasting from MS word ",

Importword: "importing Word documents ",

Fckeditorcode_ie.js display button in the button

Find

Case 'pasteword': B = new fcktoolbarbutton ('pasteword', fcklang. pasteword, null, null, false, true, 11); break;

This line is added later

Case 'importword': B = new fcktoolbarbutton ('importword', fcklang. importword, null, null, false, true, 11); break; add function for button

Find

Case 'pasteword': B = new fckpastewordcommand (); break;

This line is added later

Case 'importword': B = new fckdialogcommand ('importword', fcklang. importword, 'Dialog/importword. asp', 700,600); break;

In this way, the Custom button is set. When you click this button, the importword. aspx file is automatically displayed.

The rest is the work of. net. A folder download is provided here.

Http://download.csdn.net/source/1681907

Contains Microsoft. office. interOP. word. DLL and importword folders. The importword folder contains (importword. aspx \ importword. aspx. CS ). usage: Reference Microsoft. office. interOP. word. DLL. put the importword folder in the FCKeditor \ editor \ dialog folder and modify the two files.

1 \ modify the. CS file:

Doctype. invokemember ("saveas", system. reflection. bindingflags. invokemethod,

Null, Doc, new object [] {savefilename, wdsaveformat. wdformatfilteredhtml });

2 \ modify the. aspx File

<SCRIPT src = "../common/fck_dialog_common.js" type = "text/JavaScript"> </SCRIPT>

Success!

However, I think it is not convenient. Continue to study...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.