Formfield edition from browser

Hi,
we are testing the api to handle form fields and images with good results but we would like to edit contents of form fields from a webbrowser like a viewer mode but with permissions to change formfields values.
It is possible with Aspose.Words? how?

Hello

Thanks for your request. Aspose.Words is a class library for processing Word documents programmatically, it does not provide user interface for editing your documents.
Please see the following link to learn how to work with form fields using Aspose.Words:
https://docs.aspose.com/words/net/working-with-form-fields/
You can build your document in MS Word and insert form fields in it. Then, I think, you should protect this document in order to allow the end user to modify only form fields in the document.
Once your end user fill form fields with data and upload the document back to the server, you can read data from the form fields using Aspose.Words. Here is code example:

// Open document.
Document doc = new Document("in.doc");
// Get data from form fields.
// Text inputs
string firstName = doc.Range.FormFields["FirstName"].Result;
string lastName = doc.Range.FormFields["LastName"].Result;
// Combobox
string gender = doc.Range.FormFields["Gender"].Result;
// Checkbox.
bool isMaried = doc.Range.FormFields["IsMaried"].Checked;

Best regards,

thanks for your reply.
We have successfully tested class library to get form field values an to put values on it, but we want that user complet form fields values without need to download and upload document again to the server. Something like convert document to htm, user completes values and then get the form field values to generate document again to print it.

Hello

Thanks for your inquiry. As I mentioned earlier, Aspose.Words does not provide user interface for editing documents. If you are looking for users to edit documents then this is still possible, but you would need to manually create a part of your GUI which would then interface with Aspose.Words to create the document from the client’s input. How complex this will be depends upon the level of editing you would want the user to have access to. In your case, if they are just support to fill FormFields with data, you can program textboxes for the user to enter the data and then using DocumentBuilder you can insert this text into the document template.
Best regards,

Hi there,
Another suggestion in addition to Andrey’s reply. You can also try doing tis directly through export and import HTML as you were looking for.
You will need to do something like this:

  1. Export the document as HTML using Aspose.Words.
  2. Most likely post process the HTML to add Javascript to the page which will write the results of the form fields into the document page (as hidden text) when the user enters them.
  3. Reload this document into Aspose.Words and extract the hidden values and populate the form fields with them.

Also note that in the next version of Aspose.Words, due out in a couple of days. Form fields should be retained during HTML import.
Thanks,

thanks Adam,
we will wait to test the new version.
Only a new comment, I found a gap in html export; textbox generated according each form field retain maxlength configuration but for a for example 4000 characters formfield would be necessary a multiline textbox.
To reduce our html post process it could be a good improvement to generate multiline textbox for a maxlength greater than X (X could be 256 characters for example).

Hi there,
Thanks for your inquiry.
Sure, you will be informed when import of input tags is ready.
Regarding the max length of form fields in HTML, I could not reproduce the issue using a simple test. Could you please attach a sample document demonstrating the issue and I will take another look.
Thanks,

Here it is.
All our documents are similar to this.
Located near of “Clausulas adicionales” in page 2 are the field limited to 4000 caracters, all the other are limited to 200.
Thanks for your attention.

Hi there,
Thanks for attaching your documents here.
I have logged your request. You will be notified as soon as it’s available.
Thanks,

The issues you have found earlier (filed as 981) have been fixed in this update.