Ephox EditLive! for Java allows users to copy-and-paste content created in Microsoft Word into Ephox EditLive! for Java without losing the formatting and layout of the content. This is achieved by importing the Microsoft Word document styles into EditLive! for Java.
This article explains all aspects of this feature including:
Note: This Word Import feature is currently only available on client machines running the Windows operating system. It also requires Microsoft Office 2000 or XP to be installed on the client machine.
When a user pastes in content from Microsoft Word, EditLive! for Java will detect that the content is from Microsoft Word and will present the end user with the option of importing the content with or without the Microsoft Word style rules.
If the end user selects "Yes", the formatting of the content within EditLive! for Java closely resembles the content from Microsoft Word.
Alternatively, if the end user selects "No", all styles formatting will be removed from the content and the content will be displayed only with the block formatting options preserved (e.g. H1, P). If any default cascading style sheet (CSS) rules exist in the EditLive! for Java document the content will be displayed in accordance with these rules.
If the end user selects "Yes", the Microsoft Word document's CSS rules are imported into the EditLive! document. The imported rules are placed in the STYLE element of the HEAD section of the document. Any CSS rules that have been previously defined in either a linked external style sheet or in the EditLive! for Java document's STYLE element will not be imported.
Alternatively, if the end user selects "No", all style attributes and definitions will be removed from the Microsoft Word content. The block formatting options will be preserved (e.g. H1, P) and the default CSS rules in the EditLive! for Java document will be applied to the content instead.
Note: When choosing to import style information from Microsoft Word the imported style information will not overwrite any existing style information within the document in EditLive! for Java.
If, as a developer, you do not want to give the end user the choice of whether the Microsoft Word formatting is merged with the current document formatting or removed, you can use the EditLive! for Java configuration information to set which behvaior you wish EditLive! for Java to exhibit. The easiest way to set this configuration information is to use the EditLive! for Java Configuration Tool. Below is a list of the options you may set.
MERGE |
When an end user pastes content into EditLive! for Java from Microsoft Word then EditLive! for Java will behave as if the user had chosen to import the Microsoft Word styles. The user will not be prompted. |
CLEAN |
When an end user pastes content into EditLive! for Java from Microsoft Word then EditLive! for Java will behave as if the user had chosen NOT to import the Microsoft Word styles. The user will not be prompted. |
USER_PROMPT |
This will ensure that the end user is presented with the dialog box. This is the default option for Microsoft Word import in EditLive! for Java. |
To set the manner with which EditLive! for Java will behave in this situation, launch the EditLive! for Java Configuration Tool and click on the HTMLFilter tab. In the Word Import section of the form choose your desired option from the Style Option box.
The style information that is imported into EditLive! with the Microsoft Word content is retrieved from EditLive! for Java in a similar manner to the main document content.
The main EditLive! for Java content is retrieved by populating a hidden field
with its contents automatically rather than the developer calling for the
contents explicitly. The name of the hidden field is contained within the same
form as the EditLive! for Java instance and is given the name that was specified
by the developer when the EditLive! for Java instance was created. For
example, ELJApplet1 was specified as the applet name (editlivejava1 = new EditLiveJava
("ELJApplet1", "600", "400");
) then
EditLive! for Java would store its contents in the
hidden field named ELJApplet1. This hidden field is then posted with the
rest of the form data when the submit button is pressed.
If style information has been imported into EditLive! for Java, it will be passed to a hidden form field called APPLET_NAME_styles. For example, in line with the above naming convention, the styles information will be passed to the hidden form field called ELJApplet1_styles.
As with the main EditLive! for Java content retrieval, EditLive! for Java automatically updates the hidden field by attaching itself to the form's onsubmit() handler. If there is already a function specified in the onsubmit() handler then this function will run after the hidden field has been updated. This means that you can still use the onsubmit() handler to run your own JavaScript functions. If you use another button/image/event to submit the form by calling form.submit() the browser will not call the onsubmit() handler and EditLive! for Java will not populate the hidden field with data. For this reason, please ensure you use form.onsubmit() to avoid this problem.
The EditLive! for Java API offers a property specifically for loading the style information into EditLive! for Java when the applet is initialized. This property is called the setStyles property. This setStyles property is passed the style rules as an escaped string. The setStyles property will load the style rules into a STYLE element included within the HEAD of the EditLive! for Java document. For more information on how this property works please see the setStyles property reference page.
EditLive! for Java allows documents created in Microsoft Word to be easily published to a Web site or Intranet by providing a means to preserve all Word formatting within the content, or to remove formatting so that corporate style guidelines can be applied. This behavior can be specified by the system administrator, meaning that they can define whether formatting from Microsoft Word is kept or removed. This means that stylistic control can be maintained if desired.
Copyright © 2001-2004 Ephox Corporation. All Rights Reserved.