hi!
I want to lock the fields !
Like MS OFFICE as the shortcut key Ctrl+F11!
Please tell me the way to achieve it use java!
Aspose.words for java!
Hi Gong,
<span lang=“EN-GB” style=“font-size:10.0pt;font-family:“Courier New”;color:#2B91AF;mso-font-kerning:
0pt;mso-no-proof:yes”>Document<span lang=“EN-GB” style=“font-size:10.0pt;
font-family:“Courier New”;mso-font-kerning:0pt;mso-no-proof:yes”> doc = new Document(MYDir
- “in.docx”);<o:p></o:p>
FieldChar fieldStart = (FieldChar)doc.getChild(NodeType.FIELD_START, 0, true);
fieldStart.isLocked(true);
String[] fieldNames = new String[] { "LockField" };
Object[] fieldValues = new Object[] { "LockField value test" };
doc.getMailMerge().execute(fieldNames, fieldValues);
doc.save(MYDir + "AsposeOut-Java.docx");
Document doc = new Document(MYDir + "1.doc");
for(FieldChar fieldStart : (Iterable<FieldChar>)doc.getChildNodes(NodeType.FIELD_START, true))
{
fieldStart.isLocked(true);
}
doc.updateFields();
doc.save(MYDir + "AsposeOut-Java.docx");
Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.
As a workaround, first save document to Docx file format and than save it again to Doc file format as shown in following code snippet.
Document doc = new Document(MYDir
+ "Test41.doc"); for(FieldChar fieldStart : (Iterable)doc.getChildNodes(NodeType.FIELD_START, true)) {
fieldStart.isLocked(true); } ByteArrayOutputStream dstStream = new
ByteArrayOutputStream(); doc.save(dstStream, SaveFormat.DOCX); InputStream
inputStream = new
ByteArrayInputStream(dstStream.toByteArray()); doc = new
Document(inputStream); doc.save(MYDir + "AsposeOut-Java.doc");
We apologize for your inconvenience.
The issues you have found earlier (filed as WORDSNET-7346) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.