Skip to content

Commit 4efef3d

Browse files
ES-1042617 Sample changes
1 parent e28d00a commit 4efef3d

65 files changed

Lines changed: 103 additions & 98 deletions

File tree

  • Bookmarks
    • Get-an-instance-of-bookmark/.NET/Get-an-instance-of-bookmark
    • Insert-paragraph-item-into-bookmark/.NET/Insert-paragraph-item-into-bookmark
    • Replace-content-with-document-part/.NET/Replace-content-with-document-part
  • Fields
    • Cross-reference/.NET/Cross-reference
    • Hide-SEQ-field-result/.NET/Hide-SEQ-field-result
  • Mail-Merge
    • Event-for-image-mail-merge-field/.NET/Event-for-image-mail-merge-field
    • Event-to-bind-data-for-unmerged-fields/.NET/Event-to-bind-data-for-unmerged-fields
    • Event-to-bind-data-for-unmerged-group/.NET/Event-to-bind-data-for-unmerged-group
    • Exception-field-not-in-data source/.NET/Exception-field-not-in-data source
    • Keep-unmerged-merge-fields/.NET/Keep-unmerged-merge-fields
    • Mail-merge-with-dynamic-objects/.NET/Mail-merge-with-dynamic-objects
    • Mail-merge-with-implicit-relational-data/.NET/Mail-merge-with-implicit-relational-data
    • Multiple-documents-as-data-sources/.NET/Multiple-documents-as-data-sources
    • Remove-empty-merge-field-groups/.NET/Remove-empty-merge-field-groups
    • Replace-Merge-field-with-table/.NET/Replace-Merge-field-with-table
    • Replace-merge-field-with-chart/.NET/Replace-merge-field-with-chart
    • Restart-list-numbering-in-mail-merge/.NET/Restart-list-numbering-in-mail-merge
    • Retrieve-merge-field-names/.NET/Retrieve-merge-field-names
    • Start-at-new-page/.NET/Start-at-new-page
  • Paragraphs
    • Add-image-caption/.NET/Add-image-caption
    • Find-an-image-by-title/.NET/Find-an-image-by-title
    • Format-and-rotate-image/.NET/Format-and-rotate-image
    • Increase-or-decrease-list-indent/.NET/Increase-or-decrease-list-indent
    • List-with-prefix-from-previous-level/.NET/List-with-prefix-from-previous-level
    • Multilevel-bulleted-list/.NET/Multilevel-bulleted-list
    • Simple-bulleted-list/.NET/Simple-bulleted-list
    • User-defined-bulleted-list/.NET/User-defined-bulleted-list
  • Shapes/Collection-of-shapes-into-group-shape/.NET/Collection-of-shapes-into-group-shape
  • Tables
    • Apply-vertical-merge-to-cells/.NET/Apply-vertical-merge-to-cells
    • Create-nested-table/.NET/Create-nested-table
    • Iterating-through-table-elements/.NET/Iterating-through-table-elements
    • Resize-table/.NET/Resize-table
  • Word-document
    • Access-styles-in-document/.NET/Access-styles-in-document
    • Add-custom-document-properties/.NET/Add-custom-document-properties
    • Apply-built-in-style/.NET/Apply-built-in-style
    • Apply-gradient-background-to-document/.NET/Apply-gradient-background-to-document
    • Apply-picture-background-to-document/.NET/Apply-picture-background-to-document
    • Clone-whole-Word-document/.NET/Clone-whole-Word-document
    • Create-new-paragraph-style/.NET/Create-new-paragraph-style
    • Find-and-replace-text-with-Excel-content/.NET/Find-and-replace-text-with-Excel-content
    • Iterate-document-elements/.NET/Iterate-document-elements
    • Merge-documents-in-new-page/.NET/Merge-documents-in-new-page
    • Merge-documents-in-same-page/.NET/Merge-documents-in-same-page
    • Modify-built-in-document-properties/.NET/Modify-built-in-document-properties
    • Modify-content-type-properties/.NET/Modify-content-type-properties
    • Modify-custom-document-properties/.NET/Modify-custom-document-properties
    • Print-Word-document/.NET-Framework/Print-Word-document
    • Remove-empty-pages-from-Word-document/.NET/Remove-empty-pages-from-Word-document
    • Remove-paragraph-with-style/.NET/Remove-paragraph-with-style
    • Remove-particular-style-from-document/.NET/Remove-particular-style-from-document
    • Silent-Printing-Word-Document/WinForms/Silent-Printing-Word-Document
    • Split-by-bookmark/.NET/Split-by-bookmark
    • Split-by-heading/.NET/Split-by-heading
    • Split-by-placeholder-text/.NET/Split-by-placeholder-text
    • Split-by-section/.NET/Split-by-section
    • Update-alternate-chunks/.NET/Update-alternate-chunks
    • Update-pages-count/.NET/Update-pages-count
    • Update-words-count/.NET/Update-words-count

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Bookmarks/Get-an-instance-of-bookmark/.NET/Get-an-instance-of-bookmark/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static void Main(string[] args)
1616
{
1717
//Gets the bookmark instance by using FindByName method of BookmarkCollection with bookmark name.
1818
Bookmark bookmark = document.Bookmarks.FindByName("Northwind");
19-
//Accesses the bookmark starts owner paragraph by using bookmark and changes its back color.
19+
//Accesses the bookmark start's owner paragraph by using the bookmark and changes its back color.
2020
bookmark.BookmarkStart.OwnerParagraph.ParagraphFormat.BackColor = Color.AliceBlue;
2121
//Creates file stream.
2222
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite))

Bookmarks/Insert-paragraph-item-into-bookmark/.NET/Insert-paragraph-item-into-bookmark/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ static void Main(string[] args)
2424
picture.LoadImage(imageStream);
2525
picture.WidthScale = 50;
2626
picture.HeightScale = 50;
27+
//Disposes the image stream
28+
imageStream.Dispose();
2729
//Creates file stream.
2830
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.ReadWrite))
2931
{

Bookmarks/Replace-content-with-document-part/.NET/Replace-content-with-document-part/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static void Main(string[] args)
2929
bookmarkNavigator = new BookmarksNavigator(document);
3030
//Moves the virtual cursor to the location before the end of the bookmark "NorthwindDB".
3131
bookmarkNavigator.MoveToBookmark("NorthwindDB");
32-
//Replaces the bookmark content with word body part.
32+
//Replaces the bookmark content with WordDocumentPart.
3333
bookmarkNavigator.ReplaceContent(wordDocumentPart);
3434
//Close the WordDocumentPart instance.
3535
wordDocumentPart.Close();

Fields/Cross-reference/.NET/Cross-reference/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void Main(string[] args)
2828
//Gets the collection of bookmark start in the word document.
2929
List<Entity> items = document.GetCrossReferenceItems(ReferenceType.Bookmark);
3030
paragraph.AppendText("Bookmark Cross Reference starts here ");
31-
//Appends the cross reference for bookmark Title with ContentText as reference kind.
31+
//Appends the cross reference for bookmark "Title" with ContentText as reference kind.
3232
paragraph.AppendCrossReference(ReferenceType.Bookmark, ReferenceKind.ContentText, items[0], true, false, false, string.Empty);
3333
//Updates the document Fields.
3434
document.UpdateDocumentFields();

Fields/Hide-SEQ-field-result/.NET/Hide-SEQ-field-result/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static void Main(string[] args)
1414
//Accesses sequence field in the document.
1515
WTable table = document.LastSection.Body.ChildEntities[1] as WTable;
1616
WSeqField field = ((table[2, 1].ChildEntities[0] as WParagraph).ChildEntities[0] as WSeqField);
17-
//Enables a flag to to hide the sequence field result .
17+
//Enables a flag to hide the sequence field result.
1818
field.HideResult = true;
1919
//Accesses sequence field in the document.
2020
field = ((table[4, 1].ChildEntities[0] as WParagraph).ChildEntities[0] as WSeqField);

Mail-Merge/Event-for-image-mail-merge-field/.NET/Event-for-image-mail-merge-field/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void Main(string[] args)
1818
//Specifies the field names and field values.
1919
string[] fieldNames = new string[] { "Logo" };
2020
string[] fieldValues = new string[] { "Logo.png" };
21-
//Executes the mail merge with groups.
21+
//Executes the mail merge.
2222
document.MailMerge.Execute(fieldNames, fieldValues);
2323
//Creates file stream.
2424
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))

Mail-Merge/Event-to-bind-data-for-unmerged-fields/.NET/Event-to-bind-data-for-unmerged-fields/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ static void Main(string[] args)
1515
//Opens the template document.
1616
using (WordDocument document = new WordDocument(fileStream, FormatType.Docx))
1717
{
18-
//Sets “ClearFields” to true to remove empty mail merge fields from document.
18+
//Sets “ClearFields” to false to keep empty mail merge fields in the document.
1919
document.MailMerge.ClearFields = false;
20-
//Uses the mail merge event to clear the unmerged field while perform mail merge execution.
20+
//Uses the mail merge event to clear the unmerged field while performing mail merge execution.
2121
document.MailMerge.BeforeClearField += new BeforeClearFieldEventHandler(BeforeClearFieldEvent);
2222
//Execute mail merge.
2323
document.MailMerge.ExecuteGroup(GetDataTable());

Mail-Merge/Event-to-bind-data-for-unmerged-group/.NET/Event-to-bind-data-for-unmerged-group/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ static void Main(string[] args)
1515
//Opens the template document.
1616
using (WordDocument document = new WordDocument(fileStream, FormatType.Docx))
1717
{
18-
//Sets “ClearFields” to true to remove empty mail merge fields from document.
18+
//Sets “ClearFields” to false to keep empty mail merge fields in the document.
1919
document.MailMerge.ClearFields = false;
2020
//Uses the mail merge event to clear the unmerged group field while perform mail merge execution.
2121
document.MailMerge.BeforeClearGroupField += new BeforeClearGroupFieldEventHandler(BeforeClearFields);
22-
//Gets the employee details as IEnumerable collection.
22+
//Gets the employee details as IEnumerable collection.
2323
List<Employees> employeeList = GetEmployees();
24-
//Creates an instance of MailMergeDataTable by specifying mail merge group name and IEnumerable collection.
24+
//Creates an instance of MailMergeDataTable by specifying mail merge group name and IEnumerable collection.
2525
MailMergeDataTable dataTable = new MailMergeDataTable("Employees", employeeList);
2626
//Performs Mail merge
2727
document.MailMerge.ExecuteNestedGroup(dataTable);
@@ -47,6 +47,7 @@ private static void BeforeClearFields(object sender, BeforeClearGroupFieldEventA
4747
string[] groupName = args.GroupName.Split(':');
4848
if (groupName[groupName.Length - 1] == "Orders")
4949
{
50+
//Gets the field names in the group
5051
string[] fields = args.FieldNames;
5152
List<OrderDetails> orderList = GetOrders();
5253
//Binds the data to the unmerged fields in group as alternative values.

Mail-Merge/Exception-field-not-in-data source/.NET/Exception-field-not-in-data source/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void Main(string[] args)
1515
//Opens the template document.
1616
using (WordDocument document = new WordDocument(fileStream, FormatType.Docx))
1717
{
18-
//Sets “ClearFields” to true to remove empty mail merge fields from document.
18+
//Sets “ClearFields” to false to keep empty mail merge fields in the document.
1919
document.MailMerge.ClearFields = false;
2020
//Uses the mail merge event to throw exception if the field is not in the data source.
2121
document.MailMerge.BeforeClearField += new BeforeClearFieldEventHandler(BeforeClearFieldEvent);

Mail-Merge/Keep-unmerged-merge-fields/.NET/Keep-unmerged-merge-fields/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static void Main(string[] args)
1313
//Opens the template document.
1414
using (WordDocument document = new WordDocument(fileStream, FormatType.Docx))
1515
{
16-
//Sets “ClearFields” to true to remove empty mail merge fields from document.
16+
//Sets “ClearFields” to false to keep empty mail merge fields in the document.
1717
document.MailMerge.ClearFields = false;
1818
string[] fieldNames = new string[] { "EmployeeName", "EmployeeId", "City" };
1919
string[] fieldValues = new string[] { "John", "101", "London" };

0 commit comments

Comments
 (0)