We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Restrict document editing

Hello,

I’m using Aspose.Words for generating documents from templates with mail merge fields.

What I’m trying to do, it’s restring a template from being edited partially
In word 2010, Review -> Restrict editing -> Formatting Restrictions checked, Editing restrictions checked (No changes - Read-only) and I add exceptions to some parts of the template.
When I click on “Yes, Start Enforcing Protection”, everything is fine, my template is partially locked.

The thing is, when I “mail merge” this template, the generated document is completely locked.

I tried with Word 2003 and Word 2010, with .doc and .docx (if that matter), but nothing changed.

Is it possible to have the result I wish, or not ?

Thanks,
Yohan

Hello

Thanks for your request. Could you please show me your code and attach your locked input template and output document here for testing. I will check the problem on my side and provide you more information.

Best regards,

Hello,



Thanks for your reply.

My code being a little big I attached it too. (The template is in the zip)

Tell me if you need any explanations.



Thanks again,

Yohan

Hello

Thank you for additional information.. If you would like to fill the document with data and then fill the same document with other data, it is impossible to achieve using mail merge. This is how mail merge works: during mail merge, merge fields are replaced with values (text). So in final document, merge fields are no longer available (in your case readonly). In MS Word, this works exactly the same.

If you need to fill document with data several times, you can consider using bookmarks. Or you can create the template document and use this template each time when you need to insert new images.

Please see the following link to learn how to work with bookmarks in Aspose.Words:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/working-with-bookmarks.html

Hope this helps.

Best regards,

Hello,

I’m not sure I understand quite well what you are saying. I’m not really looking to fill more than one time a merge field.
What I want is keep the “restriction” from the template to the generated document.
In the template all parts between “[xxx]” are exceptions (and merge fields too) and users are supposed to be able to edit these parts on the generated document.
And my problem is that the generated document is completely locked, it’s like these exceptions have been wiped out from the document.

I found a workaround using “Filling in forms” (see attachment), but I need to define “Section breaks”, and “mail merge with regions” must be inside the same section, which is a little problem in some cases.
It’s making me execute more than 1 mail merge on the document to cover all the merge fields.

 Document doc = DocumentBuilder.initializeMailMerge(DocumentConstants.TEMPLATE_MINUTES, in);
doc.getMailMerge().executeWithRegions(new SimpleDataSource(“Minutes”, minutes));
doc.getMailMerge().executeWithRegions(new ComplexDataSource(“Points”, minutes.getPoints()));
doc.getMailMerge().execute(new SimpleDataSource("", minutes));

I’m not see I really clear… so if you want more information, just ask me.

Regards,
Yohan

Hello

Thank you for additional information. It seems what you are talking about is called editable ranges in MS Word. Unfortunately, Aspose.Words does not support editable regions yet. I linked your request to the appropriate issue. You will be notified as soon as this feature is supported.

Best regards,

The issues you have found earlier (filed as WORDSNET-1067) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(4)

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan