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

Free Support Forum - aspose.com

How do I restrict certian mail merge fileds from editing using Aspose.Word

Hi,

We are creating one word document referring an document template file(.dotx) file. We have used MailMerge fields in the .dotx file and while generating the document we are assigning values to them.
We are using the Book mark filed to get the values if edited in that document later also.

Customer Failure Site:

«FASite»

Customer Point of Failure:

«POF»

Customer Part Number:

«PartNum»


Assigning BookMark
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>ZH-TW</w:LidThemeAsian>
<w:LidThemeComplexScript>HE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif"; mso-fareast-language:EN-US; mso-bidi-language:AR-SA;}

<![endif]–>
foreach (string fieldName in doc.MailMerge.GetFieldNames())
{
if (fieldName.Equals("<span style=“font-size:8.0pt;font-family:“Arial”,“sans-serif”;mso-no-proof:yes”>FASite"))
{
builder.MoveToMergeField(fieldName, false, false);

builder.StartBookmark(fieldName);
builder.MoveToMergeField(fieldName, true, false);
builder.EndBookmark(fieldName);
}
else if (fieldName.Equals("<span style=“font-size:8.0pt;font-family:“Arial”,“sans-serif”;mso-no-proof:yes”>POF"))
{
builder.MoveToMergeField(fieldName, false, false);
builder.StartBookmark(fieldName);
builder.MoveToMergeField(fieldName, true, false);
builder.EndBookmark(fieldName);
}
}

So if user is changing some thing in that “FASite” or “POF” filed then I can get the changes text by referring to the bookmark value.

However we required that the document should not be made editable to user completely, rather than some parts lets say only “POF” can be edited by user.

Could you please let us know, if we can achieve the same using Aspose.Word?

Please let us know, if any further information required.

Thanks,
Rajesh

Hi Rajesh,


Thanks for your inquiry. I think, you could set document protection (read-only for example) but allow “everyone” editing to a part of the document (POF field for example). It seems EditableRangeStart, EditableRangeEnd and EditableRange classes are what you can use to meet this requirement. But, unfortunately, currently, these classes don’t have any public constructors which can be used to define new Editable ranges. Your request has been linked to the appropriate issue (WORDSNET-9000) in our issue tracking system and you will be notified as soon as it is supported. Sorry for the inconvenience.

Best regards,

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


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