With v3 release, GcWord adds more features from the Microsoft Word OM features. The special highlight of v3 is the support for merging/splitting documents and document protection.
Let's dive in...
It can be challenging to combine content from multiple Word documents, each with different formatting (and merged content) to fit the destination formatting.
At the same time, there may be a very large Word document from which it may be difficult to find relevant information. The document may need to be split into documents, with relevant content from specific parts of the Word document.
Help - Copy or Move Document Content | Help - Split or Merge Document | Demo - Copy/Move Range | Demo - Split Document | Demo - Merge Documents
If you would like only certain people to open and/or edit a Word document with sensitive information, you can now apply Document protection properties in the Word documents. The properties will help keep the information private or secure. These properties will help control types of modifications applied to the documents. You can also specify if the document draft is the final version for the users.
The GcWord API adds Microsoft Word OM features w.r.t Document Protection and provides several options with the DocumentProtection, EditProtection classes for securing the Word document.
More information and how to set document protection properties here.
In addition to Document protection, you can allow certain portions of text, to be editable by a designated set of people. With GcWord, you can add the range as Editable range, and set the Group editor for that range using the EditableRange and GroupEditor enum.
GcWordDocument doc = new GcWordDocument(); //add new paragraph var para = doc.Body.Paragraphs.Add("Editable paragraph"); //add new EditableRange for this paragraph para.getRange().EditableRanges.Add(new GroupEditor(EditorGroup.Everyone)); //add new paragraph doc.Body.Paragraphs.Add("New paragraph"); //set document region protection mode doc.Settings.DocumentProtection.EditProtection.EditMode = EditProtectionMode.AllowOnlyReading; //enforce document protection doc.Settings.DocumentProtection.EditProtection.isActive = true; //now, first paragraph can be editable by everyone. //rest of the document is ReadOnly doc.Save("EditableRange.docx");
In the document above, the first paragraph is set as an Editable range and editing permissions are provided to everyone. These settings do not apply to the 'New paragraph' so the next paragraph would be read-only and not editable.
In a Word document, formatting of a fragment can be determined in different things:
While programming with Word documents, it is useful to find out where a font comes from a run: from default style, paragraph style, or direct formatting.
GcWord adds the GcWordDocument.GetPropertyValueSource method to get the source of formatting properties. This feature is for advanced users, who want to programmatically determine the formatting of the Word objects uses in the Word document.
This is useful when a user wants to make sure all documents within the organization use pre-defined styles and not direct formatting. In that case, the programmer might want to find out which objects have what formatting properties set in the document and instead set pre-defined styles on the objects to make all documents follow a standard style.
More details here:
What do you think about above features in GcWord? Please leave a comment below.