This article shows you how to transfer numerous amounts of text from a Word document to a K2 SmartForm control.
Before You Begin
You will need to add text data from the Word document to the RichText control manually in order to identify the text data's html format, which can then be used to call the text data as is.
Please follow these steps:
- First, you will need to createhave an item view containing a RichText Control (Important note: After adding the RichText Control, do not modify its properties).
- Save and finish the view.
- Open the Word document containing your text data, keep it on one side.
- Run the item view which contains the RichText control.
- When the view is initialized you will then need to copy the text data from the Word Document and paste it into the RichText control.
- Now that the Text data from the Word document is on the RichText control you can select the "HTML" option in the RichText control which can be located at the bottom.
- This will provide you with the HTML for the Text data contained in the RichText Control.
- Copy the HTML Text Data and then edit the Item view once more.
- While the item view is in edit mode, select the RichText control and locate its property called "HTML." In this property you will then paste the HTML Text Data. (Important: Sometimes when you paste the HTML Text Data in the HTML property, the property still looks blank. However that is not the case, as you will notice when you save and run the view).
- Save and Finish the item view.
- Run the view again and all your data that has been copied from the Word document to the item view should load as expected without any value limits.
Negative effects: The styling and image formatting will be lost. This can however be re-added directly to the text in the RichText control prior to preforming step 6 of solution 1 manually.
Once Step 6 is performed the HTML is captured, therefore if there are any additional changes made to the text in the RichText control the HTML will first need to be recaptured and replaced with the HTML data from the RichText control properties. If this is not done then the changes will not stick and will dissappear when the view is reloaded.
How to add the Images:
Simply copy and paste the images from the word document to the RichText control.
How to add the Text formatting:
You can use the RichText controls tools to re-add the formatting as required.
This scenario has been tested with a Word document containing 16 pages of text and the results was satisfactory, see screenshot below.
Should you want the controls in the RichText control to be invisible to the the usercustomer then you can apply the below setting to the RichText control post performing the above steps for solution 1.
Ensure that the "Read Only" property for the RichText control is Checked.
Ensure that the "Design View" property for the RichText control is Unchecked.
This solution is based on K2 4.7 however the behaviour would be the same when using K2 Five.
For more suggestions to achieve the same behaviour, please see this community article: