I have read numerous posts on protecting text in this forum, but none have been helpful.
I have a rtf document that serves as a template for my users. This document contains serveral paragraphs and several mail merge fields. Currently, users create new documents based off of this template with merged data, but are able to freely modify the results. What I would like to do is allow my users to add paragraphs to this document without allowing them to delete any of the original paragraphs or merge fields. Please explain:
1) How do I protect all of the text of the template, programatically?
2) How do I allow users of the template to add paragraphs (between existing paragraphs) without allowing them to delete any of the text?
3) Should the administrator need to modify the template, what needs be be done to allow this?
I have tried code like this to enable the protection:
var
p : TParagraph;
begin
p := WP.FirstPar;
while p<>nil do begin
p.ASet(WPAT_ParProtected,1);
p := p.NextPar;
end;
WP.ProtectedProp := WP.ProtectedProp + [ppParProtected,ppAllowEditAtTextEnd,ppInsertBetweenProtectedPar,ppDontUseAttrOfProtected];
WP.Refresh;
end;
Alles anzeigen
This protects the text from overtyping, but the user can still select it and press delete. It also allows the user to insert empty paragraphs between paragraphs but only occassionally can they enter text, weird. Also, backspace or delete will not allow them to delete the empty paragraphs that they inserted.
D2007
WPTool 5.39