How to transfer Word Document Content to a SmartForms Control

  • 24 February 2022
  • 0 replies
  • 53 views

Userlevel 5
Badge +20
 

Transfer Word Document Content to SmartForms Control

KBS100082

PRODUCT
K2 blackpearl 4.7
BASED ON
K2 blackpearl 4.7
This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice. This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Objective

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.

 

There is no out of the box component that can be used to transfer the text from the Word document into the SmartForm control, therefore the text would have to be copied or typed over from the document to the RichText control as mentioned in the how to steps.

How-to Steps

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.

Result.png

 

Additional notes:

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:

http://community.k2.com/t5/K2-blackpearl/Putting-lots-of-text-in-smartform/m-p/101857#M33908

 


0 replies

Be the first to reply!

Reply