diff --git a/Document-Processing/Word/Word-Library/NET/Accepting-or-Rejecting-Track-Changes.md b/Document-Processing/Word/Word-Library/NET/Accepting-or-Rejecting-Track-Changes.md index ad075f937c..cbb5673cad 100644 --- a/Document-Processing/Word/Word-Library/NET/Accepting-or-Rejecting-Track-Changes.md +++ b/Document-Processing/Word/Word-Library/NET/Accepting-or-Rejecting-Track-Changes.md @@ -7,14 +7,14 @@ documentation: UG --- # Accepting or Rejecting Track Changes -It is used to keep track of the changes made to a Word document. It helps to maintain the record of author, name and time for every insertion, deletion, or modification in a document. This can be enabled by using the [TrackChanges](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_TrackChanges) property of the Word document. +Track changes is used to keep track of the changes made to a Word document. It helps to maintain the record of the author, date, and time for every insertion, deletion, or modification in a document. This can be enabled by using the [TrackChanges](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_TrackChanges) property of the Word document. -N> With this support, the changes made in the Word document by DocIO library cannot be tracked. +N> With this support, the changes made in the Word document by the DocIO library cannot be tracked. -To quickly start to handle Tracked Changes in Word document, please check out this video: +To quickly start handling tracked changes in a Word document, please check out this video: {% youtube "https://www.youtube.com/watch?v=Md-Ft4QFHYk" %} -The following code example illustrates how to enable track changes of the document. +The following code example illustrates how to enable track changes in the document. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -32,11 +32,11 @@ IWTextRange text = paragraph.AppendText("This sample illustrates how to track th //Sets font name and size for text text.CharacterFormat.FontName = "Times New Roman"; text.CharacterFormat.FontSize = 14; -text = paragraph.AppendText("This track changes is useful in shared environment."); +text = paragraph.AppendText("This track changes is useful in a shared environment."); text.CharacterFormat.FontSize = 12; //Turns on the track changes option document.TrackChanges = true; -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Closes the document @@ -55,7 +55,7 @@ IWTextRange text = paragraph.AppendText("This sample illustrates how to track th //Sets font name and size for text text.CharacterFormat.FontName = "Times New Roman"; text.CharacterFormat.FontSize = 14; -text = paragraph.AppendText("This track changes is useful in shared environment."); +text = paragraph.AppendText("This track changes is useful in a shared environment."); text.CharacterFormat.FontSize = 12; //Turns on the track changes option document.TrackChanges = true; @@ -76,7 +76,7 @@ Dim text As IWTextRange = paragraph.AppendText("This sample illustrates how to t 'Sets font name and size for text text.CharacterFormat.FontName = "Times New Roman" text.CharacterFormat.FontSize = 14 -text = paragraph.AppendText("This track changes is useful in shared environment.") +text = paragraph.AppendText("This track changes is useful in a shared environment.") text.CharacterFormat.FontSize = 12 'Turns on the track changes option document.TrackChanges = True @@ -91,7 +91,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Accept all changes -You can **accept all track changes in Word document** using [AcceptAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.RevisionCollection.html#Syncfusion_DocIO_DLS_RevisionCollection_AcceptAll) method. +You can **accept all track changes in a Word document** using the [AcceptAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.RevisionCollection.html#Syncfusion_DocIO_DLS_RevisionCollection_AcceptAll) method. The following code example shows how to accept all the tracked changes. @@ -139,13 +139,13 @@ System.Diagnostics.Process.Start("Sample.docx") You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Track-Changes/Accept-all-changes). -By executing the above code example, it generates output Word document as follows. +Executing the above code example generates the following output Word document. ![Accepting all track changes in Word document](WorkingWithTrackChanges_images/AcceptAll.png) ## Reject all changes -You can **reject all track changes in Word document** using [RejectAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.RevisionCollection.html#Syncfusion_DocIO_DLS_RevisionCollection_RejectAll) method. +You can **reject all track changes in a Word document** using the [RejectAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.RevisionCollection.html#Syncfusion_DocIO_DLS_RevisionCollection_RejectAll) method. The following code example shows how to reject all the tracked changes. @@ -192,15 +192,15 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Track-Changes/Reject-all-changes). -By executing the above code example, it generates output Word document as follows. +Executing the above code example generates the following output Word document. ![Rejecting all track changes in Word document](WorkingWithTrackChanges_images/RejectAll.png) ## Accept all changes by a particular reviewer -You can **accept all changes made by the author** in the Word document using [Accept](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.Revision.html#Syncfusion_DocIO_DLS_Revision_Accept) method. +You can **accept all changes made by a specific reviewer** in the Word document using the [Accept](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.Revision.html#Syncfusion_DocIO_DLS_Revision_Accept) method. -The following code example shows how to accept the tracked changes made by the author. +The following code example shows how to accept the tracked changes made by a specific reviewer. The reviewer is identified by the `Author` property of each revision. {% tabs %} @@ -214,7 +214,7 @@ for (int i = document.Revisions.Count - 1; i >= 0; i--) //Checks the author of current revision and accepts it. if (document.Revisions[i].Author == "Nancy Davolio") document.Revisions[i].Accept(); - //Resets to last item when accept the moving related revisions. + //Resets to last item when accepting the moving related revisions. if (i > document.Revisions.Count - 1) i = document.Revisions.Count; } @@ -234,7 +234,7 @@ for (int i = document.Revisions.Count - 1; i >= 0; i--) //Checks the author of current revision and accepts it. if (document.Revisions[i].Author == "Nancy Davolio") document.Revisions[i].Accept(); - //Resets to last item when accept the moving related revisions. + //Resets to last item when accepting the moving related revisions. if (i > document.Revisions.Count - 1) i = document.Revisions.Count; } @@ -249,10 +249,10 @@ Dim document As WordDocument = New WordDocument("Template.docx", FormatType.Docx 'Iterates into all the revisions in Word document For i As Integer = document.Revisions.Count - 1 To 0 Step -1 'Checks the author of current revision and accepts it. - If document.Revisions(i).Author Is "Nancy Davolio" Then + If document.Revisions(i).Author = "Nancy Davolio" Then document.Revisions(i).Accept() End If - 'Resets to last item when accept the moving related revisions. + 'Resets to last item when accepting the moving related revisions. If i > document.Revisions.Count - 1 Then i = document.Revisions.Count End If @@ -266,11 +266,11 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Track-Changes/Accept-all-changes-made-by-author). -## Reject all changes by particular reviewer +## Reject all changes by a particular reviewer -You can **reject all changes made by the author** in the Word document using [Reject](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.Revision.html#Syncfusion_DocIO_DLS_Revision_Reject) method. +You can **reject all changes made by a specific reviewer** in the Word document using the [Reject](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.Revision.html#Syncfusion_DocIO_DLS_Revision_Reject) method. -The following code example shows how to reject the tracked changes made by the author. +The following code example shows how to reject the tracked changes made by a specific reviewer. The reviewer is identified by the `Author` property of each revision. {% tabs %} @@ -284,7 +284,7 @@ for (int i = document.Revisions.Count - 1; i >= 0; i--) //Checks the author of current revision and rejects it. if (document.Revisions[i].Author == "Nancy Davolio") document.Revisions[i].Reject(); - //Resets to last item when reject the moving related revisions. + //Resets to last item when rejecting the moving related revisions. if (i > document.Revisions.Count - 1) i = document.Revisions.Count; } @@ -304,7 +304,7 @@ for (int i = document.Revisions.Count - 1; i >= 0; i--) //Checks the author of current revision and rejects it. if (document.Revisions[i].Author == "Nancy Davolio") document.Revisions[i].Reject(); - //Resets to last item when reject the moving related revisions. + //Resets to last item when rejecting the moving related revisions. if (i > document.Revisions.Count - 1) i = document.Revisions.Count; } @@ -319,10 +319,10 @@ Dim document As WordDocument = New WordDocument("Template.docx", FormatType.Docx 'Iterates into all the revisions in Word document For i As Integer = document.Revisions.Count - 1 To 0 Step -1 'Checks the author of current revision and rejects it. - If document.Revisions(i).Author Is "Nancy Davolio" Then + If document.Revisions(i).Author = "Nancy Davolio" Then document.Revisions(i).Reject() End If - 'Resets to last item when accept the moving related revisions. + 'Resets to last item when rejecting the moving related revisions. If i > document.Revisions.Count - 1 Then i = document.Revisions.Count End If @@ -340,6 +340,8 @@ You can download a complete working sample from [GitHub](https://github.com/Sync You can get the **revision information of track changes** in the Word document like author name, date, and type of revision. +The `RevisionType` property returns a [RevisionType](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.RevisionType.html) enum value that indicates the kind of change, such as `Insertion`, `Deletion`, `Formatting`, `MoveFrom`, or `MoveTo`. + The following code example shows how to get the details about the revision information of track changes. {% tabs %} @@ -386,8 +388,6 @@ Dim author As String = revision.Author Dim dateTime As Date = revision.Date ' Gets the type of the track changes revision Dim revisionType As RevisionType = revision.RevisionType -'Closes the document -document.Close() 'Saves and closes the document document.Save("Sample.docx", FormatType.Docx) document.Close() diff --git a/Document-Processing/Word/Word-Library/NET/Applying-Watermark.md b/Document-Processing/Word/Word-Library/NET/Applying-Watermark.md index 8c811535e5..04d3c5e20c 100644 --- a/Document-Processing/Word/Word-Library/NET/Applying-Watermark.md +++ b/Document-Processing/Word/Word-Library/NET/Applying-Watermark.md @@ -40,7 +40,7 @@ textWatermark.Layout = WatermarkLayout.Horizontal; textWatermark.Semitransparent = false; //Sets the text watermark text color textWatermark.Color = Color.Black; -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Closes the document @@ -65,7 +65,7 @@ textWatermark.Layout = WatermarkLayout.Horizontal; textWatermark.Semitransparent = false; //Sets the text watermark text color textWatermark.Color = Color.Black; -//Sets the text to text watermark text +//Sets the text to the text watermark textWatermark.Text = "TextWatermark"; document.Save("TextWatermark.docx", FormatType.Docx); document.Close(); @@ -105,6 +105,8 @@ You can add or modify picture watermark in the Word document. [PictureWatermark] The following code example illustrates how to add a picture watermark to the Word document. +N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. + {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Watermark/Add-picture-watermark/.NET/Add-picture-watermark/Program.cs" %} @@ -127,7 +129,7 @@ BinaryReader br = new BinaryReader(imageStream); byte[] image = br.ReadBytes((int)imageStream.Length); //Sets the image to the picture watermark. picWatermark.LoadPicture(image); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Closes the document @@ -150,7 +152,7 @@ picWatermark.Washout = true; //Sets the picture watermark to document document.Watermark = picWatermark; //Sets the image to the picture watermark -picWatermark.Picture = Image.FromFile(ImagesPath + "Water lilies.jpg"); +picWatermark.Picture = Image.FromFile("Water lilies.jpg"); document.Save("PictureWatermark.docx", FormatType.Docx); document.Close(); {% endhighlight %} @@ -167,10 +169,10 @@ Dim picWatermark As New PictureWatermark() 'Sets the scaling to picture picWatermark.Scaling = 120.0F picWatermark.Washout = True -Set the picture watermark to document +'Sets the picture watermark to document document.Watermark = picWatermark -Set the image to the picture watermark -picWatermark.Picture = Image.FromFile(ImagesPath + "Water lilies.jpg") +'Sets the image to the picture watermark +picWatermark.Picture = Image.FromFile("Water lilies.jpg") document.Save("PictureWatermark.docx", FormatType.Docx) document.Close() {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Assemblies-Required.md b/Document-Processing/Word/Word-Library/NET/Assemblies-Required.md index b8567d5e26..4d07737347 100644 --- a/Document-Processing/Word/Word-Library/NET/Assemblies-Required.md +++ b/Document-Processing/Word/Word-Library/NET/Assemblies-Required.md @@ -43,9 +43,9 @@ T> 1. If you encounter issues while using the .NET Word library in ASP.NET Core, T> 2. Switch to NuGet packages for a seamless experience: T> * Get frequent bug fixes every week. T> * Upgrade quickly with no manual effort. -T> Note: To avoid trail watermark when using NuGet packages, it is recommended to register license key in application. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. +T> Note: To avoid the trial watermark when using NuGet packages, it is recommended to register a license key in the application. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to learn about registering the Syncfusion® license key in your application to use our components. T> -T> Refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required) to know more about NuGet packages required. +T> Refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required) to learn more about the NuGet packages required. #### Retired Platforms @@ -99,14 +99,14 @@ Syncfusion.DocIO.Base
Syncfusion.Compression.Base
Syncfusion.OfficeChart Syncfusion.DocIO.Portable
Syncfusion.Compression.Portable
Syncfusion.OfficeChart.Portable
-N> 1. Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. -N> 2. Syncfusion® components are available in [nuget.org](https://www.nuget.org/) -N> 3. Starting with v15.3.0.x, a new Visual Studio add-in "Syncfusion® Reference Manager" for WPF, and Windows Forms platforms is included. Using this add-in, you can easily add the necessary reference assemblies to your projects in an automated way. Please refer to this [link](https://help.syncfusion.com/extension/syncfusion-reference-manager/overview) for more information. +N> 1. Starting with v16.2.0.x, if you reference Syncfusion® assemblies from the trial setup or from the NuGet feed, you also have to add the "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to learn about registering the Syncfusion® license key in your application to use our components. +N> 2. Syncfusion® components are available on [nuget.org](https://www.nuget.org/). +N> 3. Starting with v15.3.0.x, a new Visual Studio add-in "Syncfusion® Reference Manager" for WPF and Windows Forms platforms is included. Using this add-in, you can easily add the necessary reference assemblies to your projects in an automated way. Please refer to this [link](https://help.syncfusion.com/extension/syncfusion-reference-manager/overview) for more information. N> 4. Starting with v17.3.0.x, Syncfusion® provides support to .NET Core 3.0. You can use the above WPF or Windows Forms platform assemblies for .NET Core 3.0 targeting applications and use the same "C# tab" code examples for it. -## Converting Word document to PDF +## Converting a Word document to PDF -For converting a Word document to PDF, the following assemblies need to be referenced in your application +For converting a Word document to PDF, the following assemblies need to be referenced in your application: @@ -152,14 +152,14 @@ Syncfusion.DocIO.Base
Syncfusion.Compression.Base
Syncfusion.OfficeChart Syncfusion.DocIO.Portable
Syncfusion.Compression.Portable
Syncfusion.OfficeChart.Portable
Syncfusion.Pdf.Portable
Syncfusion.DocIORenderer.Portable
Syncfusion.Pdf.Imaging.Portable
Syncfusion.MetafileRenderer.Portable
SkiaSharp.HarfBuzz
Syncfusion.SkiaSharpHelper.Portable
-N> 1. Word to PDF conversion is supported in ASP.NET Core and Xamarin from 2018 Volume 1 release (v16.1.0.24) using SkiaSharp graphics library. -N> 2. Word to PDF conversion is not supported in Silverlight, Windows Phone, WinRT, Universal applications. -N> 3. Starting with the v24.1.x, if you reference "Syncfusion.DocIORenderer", you have to add the "Syncfusion.Pdf.Imaging" assembly reference in your projects to perform Word to PDF conversion. -N> 4. Starting with the v27.1.x, if you reference "Syncfusion.DocIORenderer", you have to add the "Syncfusion.MetafileRenderer" assembly reference in your projects to perform Word to PDF conversion. +N> 1. Word to PDF conversion is supported in ASP.NET Core and Xamarin from the 2018 Volume 1 release (v16.1.0.24) using the SkiaSharp graphics library. +N> 2. Word to PDF conversion is not supported in Silverlight, Windows Phone, WinRT, or Universal applications. +N> 3. Starting with v24.1.x, if you reference "Syncfusion.DocIORenderer", you have to add the "Syncfusion.Pdf.Imaging" assembly reference in your projects to perform Word to PDF conversion. +N> 4. Starting with v27.1.x, if you reference "Syncfusion.DocIORenderer", you have to add the "Syncfusion.MetafileRenderer" assembly reference in your projects to perform Word to PDF conversion. -## Converting Word document to image +## Converting a Word document to an image -For converting a Word document to image, the following assemblies need to be referenced in your application. +For converting a Word document to an image, the following assemblies need to be referenced in your application. @@ -207,7 +207,7 @@ Syncfusion.DocIO.Portable
Syncfusion.Compression.Portable
Syncfusion.Off ## Converting Charts -The following assemblies are required to be referred in addition to the above mentioned assemblies for converting the chart present in the Word document into PDF and image. +The following assemblies are required in addition to the above-mentioned assemblies for converting the chart present in the Word document into PDF and image.
diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Area.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Area.md index 60ab063f5f..6dd4d887cb 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Area.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Area.md @@ -1,6 +1,6 @@ --- -title: Modify the Appearance of Chart Area | Syncfusion -description: Learn how to modify the appearance of chart area in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. +title: Modify the Appearance of Chart Area | DocIO | Syncfusion +description: Learn how to modify the appearance of chart area in a chart in a Word document using Syncfusion® Word library without Microsoft Word. platform: document-processing control: DocIO documentation: UG @@ -51,7 +51,7 @@ chartArea.Border.LineWeight = OfficeChartLineWeight.Hairline ## Customization of Color -The following code snippet illustrates how to fill the color in chart area. +The following code snippet illustrates how to fill the chart area with color. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -192,7 +192,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Add Image in Chart Area -The following code snippet illustrates how to fill the image in chart area. +The following code snippet illustrates how to fill the chart area with an image. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -219,7 +219,7 @@ chartArea.Fill.UserPicture("Image.png") ## Set the Transparency level -The following code snippet illustrates how to make transparency in chart area. +The following code snippet illustrates how to set the transparency of the chart area. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Axis.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Axis.md index 20f5019159..c28803e69d 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Axis.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Axis.md @@ -1,5 +1,5 @@ --- -title: Modify the Appearance of Axes in Chart | Syncfusion +title: Modify the Appearance of Axes in Chart | DocIO | Syncfusion description: Learn how to modify the appearance of axes in a chart in a Word document using the Syncfusion® .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -49,7 +49,7 @@ chart.PrimaryValueAxis.Title = "In Dollars" ## Customization of Border -The following code snippet illustrates how to customize the border of Horizontal and vertical category axis. +The following code snippet illustrates how to customize the border of the Horizontal and Vertical axes. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -66,13 +66,11 @@ chart.PrimaryValueAxis.Border.LineWeight = OfficeChartLineWeight.Hairline; {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} - //Customize the horizontal category axis. chart.PrimaryCategoryAxis.Border.LinePattern = OfficeChartLinePattern.CircleDot; chart.PrimaryCategoryAxis.Border.LineColor = Color.Blue; chart.PrimaryCategoryAxis.Border.LineWeight = OfficeChartLineWeight.Hairline; -//Customize the vertical category axis. chart.PrimaryValueAxis.Border.LinePattern = OfficeChartLinePattern.CircleDot; chart.PrimaryValueAxis.Border.LineColor = Color.Blue; chart.PrimaryValueAxis.Border.LineWeight = OfficeChartLineWeight.Hairline; @@ -95,7 +93,7 @@ chart.PrimaryValueAxis.Border.LineWeight = OfficeChartLineWeight.Hairline ## Customization of Font -The following code snippet illustrates how to customize the border of Horizontal and vertical category axis. +The following code snippet illustrates how to customize the font of the Horizontal and Vertical axes. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -106,7 +104,7 @@ chart.PrimaryCategoryAxis.Font.FontName = "Calibri"; chart.PrimaryCategoryAxis.Font.Bold = true; chart.PrimaryCategoryAxis.Font.Size = 20; -//Customize the vertical category axis font. +//Customize the vertical value axis font. chart.PrimaryValueAxis.Font.Color = OfficeKnownColors.Red; chart.PrimaryValueAxis.Font.FontName = "Calibri"; chart.PrimaryValueAxis.Font.Bold = true; @@ -121,7 +119,7 @@ chart.PrimaryCategoryAxis.Font.FontName = "Calibri"; chart.PrimaryCategoryAxis.Font.Bold = true; chart.PrimaryCategoryAxis.Font.Size = 20; -//Customize the vertical category axis font. +//Customize the vertical value axis font. chart.PrimaryValueAxis.Font.Color = OfficeKnownColors.Red; chart.PrimaryValueAxis.Font.FontName = "Calibri"; chart.PrimaryValueAxis.Font.Bold = true; @@ -490,10 +488,10 @@ using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx) //Number format for axis. chart.PrimaryValueAxis.NumberFormat = "0.0"; - //Hiding major gridlines. + //Showing major gridlines. chart.PrimaryValueAxis.HasMajorGridLines = true; - //Showing minor gridlines. + //Hiding minor gridlines. chart.PrimaryValueAxis.HasMinorGridLines = false; using (FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../Sample.docx"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)) @@ -563,10 +561,10 @@ using (WordDocument document = new WordDocument("Template.docx")) //Number format for axis. chart.PrimaryValueAxis.NumberFormat = "0.0"; - //Hiding major gridlines. + //Showing major gridlines. chart.PrimaryValueAxis.HasMajorGridLines = true; - //Showing minor gridlines. + //Hiding minor gridlines. chart.PrimaryValueAxis.HasMinorGridLines = false; //Save the Word file. @@ -635,10 +633,10 @@ Using document As New WordDocument("Template.docx") ' Number format for axis. chart.PrimaryValueAxis.NumberFormat = "0.0" - ' Hiding major gridlines. + ' Showing major gridlines. chart.PrimaryValueAxis.HasMajorGridLines = True - ' Showing minor gridlines. + ' Hiding minor gridlines. chart.PrimaryValueAxis.HasMinorGridLines = False ' Save the Word file. diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Data-Lables.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Data-Lables.md index bd15fdcd0d..ddd0cca5cd 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Data-Lables.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Data-Lables.md @@ -1,6 +1,6 @@ --- -title: Modify the Appearance of Data Labels | Syncfusion -description: Learn how to modify the appearance of data labels in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. +title: Modify the Appearance of Data Labels | DocIO | Syncfusion +description: Learn how to modify the appearance of data labels in a chart in a Word document using Syncfusion® Word library without Microsoft Word. platform: document-processing control: DocIO documentation: UG @@ -12,7 +12,7 @@ Data Labels on a chart make it easier to understand. They show important informa ## Enable Data Labels in Chart -The following code snippet illustrates how to visible the data label in chart. +The following code snippet illustrates how to show the data label in chart. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Legend.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Legend.md index 5b7655bb21..94caff020a 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Legend.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Legend.md @@ -1,5 +1,5 @@ --- -title: Modify the Appearance of Legend | Syncfusion +title: Modify the Appearance of Legend | DocIO | Syncfusion description: Learn how to modify the appearance of legend in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -8,7 +8,7 @@ documentation: UG # Customize Chart Legend -Legends are visual pictorial hints that provide a viewer information that helps them understand an chart. Using DocIO, you can **customize the legend in the chart**. +Legends are visual pictorial hints that provide a viewer information that helps them understand a chart. Using DocIO, you can **customize the legend in the chart**. ## Set the Position of Legend @@ -50,14 +50,14 @@ The following code snippet illustrates how to prevent the overlapping the legend {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Set the position of legend. -chart.Legend.Position = OfficeLegendPosition.Bottom; +//Legend without overlapping the chart. +chart.Legend.IncludeInLayout = true; {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -' Set the position of legend. -chart.Legend.Position = OfficeLegendPosition.Bottom +' Legend without overlapping the chart. +chart.Legend.IncludeInLayout = True {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Plot-Area.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Plot-Area.md index f824ef9526..d6160873ef 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Plot-Area.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Plot-Area.md @@ -1,5 +1,5 @@ --- -title: Modify the Appearance of Plot Area | Syncfusion +title: Modify the Appearance of Plot Area | DocIO | Syncfusion description: Learn how to modify the appearance of plot area in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -194,7 +194,7 @@ The following code snippet illustrates how to fill the image in plot area. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} -//Appeend image in plot area. +//Append image in plot area. FileStream imageStream = new FileStream("Data/Image.png", FileMode.Open, FileAccess.Read); Image image = Image.FromStream(imageStream); chartPlotArea.Fill.UserPicture(image, "image"); @@ -202,7 +202,7 @@ chartPlotArea.Fill.UserPicture(image, "image"); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Appeend image in plot area. +//Append image in plot area. chartPlotArea.Fill.UserPicture("Image.png"); {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Series.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Series.md index eb36cd4a34..3c3877f9ff 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Series.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Series.md @@ -1,5 +1,5 @@ --- -title: Modify the Appearance of Series | Syncfusion +title: Modify the Appearance of Series | DocIO | Syncfusion description: Learn how to modify the appearance of series in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -260,7 +260,7 @@ using (WordDocument document = new WordDocument()) //Sets position of legend. chart.Legend.Position = OfficeLegendPosition.Bottom; - //Saves the Word document to file stream. + //Saves the Word document. document.Save("Sample.docx"); } diff --git a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Title.md b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Title.md index f24ca91ee2..57e61f8eec 100644 --- a/Document-Processing/Word/Word-Library/NET/Charts/Chart-Title.md +++ b/Document-Processing/Word/Word-Library/NET/Charts/Chart-Title.md @@ -1,6 +1,6 @@ --- -title: Modify the Appearance of Chart Title | Syncfusion -description: Learn how to modify the appearance of chart title in a chart in a Word document using Syncfusion® .NET Word (DocIO) library without Microsoft Word. +title: Modify the Appearance of Chart Title | DocIO | Syncfusion +description: Learn how to modify the appearance of chart title in a chart in a Word document using Syncfusion® Word library without Microsoft Word. platform: document-processing control: DocIO documentation: UG @@ -227,7 +227,7 @@ using (WordDocument document = new WordDocument()) chart.ChartData.SetValue(2, 2, 141.396); chart.ChartData.SetValue(3, 1, "Stanley Hudson"); chart.ChartData.SetValue(3, 2, 80.368); - //Creates a new chart series with the name “Sales”. + //Creates a new chart series with the name "Sales". IOfficeChartSerie pieSeries = chart.Series.Add("Sales"); pieSeries.Values = chart.ChartData[2, 2, 3, 2]; //Sets category labels. @@ -261,12 +261,12 @@ using (WordDocument document = new WordDocument()) chart.ChartData.SetValue(2, 2, 141.396); chart.ChartData.SetValue(3, 1, "Stanley Hudson"); chart.ChartData.SetValue(3, 2, 80.368); - //Creates a new chart series with the name “Sales”. + //Creates a new chart series with the name "Sales". IOfficeChartSerie pieSeries = chart.Series.Add("Sales"); pieSeries.Values = chart.ChartData[2, 2, 3, 2]; //Sets category labels. chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 3, 1]; - //Saves the document + //Saves the document. document.Save("Sample.docx"); //Closes the document. document.Close(); @@ -293,14 +293,14 @@ using (WordDocument document = new WordDocument()) chart.ChartData.SetValue(2, 2, 141.396) chart.ChartData.SetValue(3, 1, "Stanley Hudson") chart.ChartData.SetValue(3, 2, 80.368) -'Creates a new chart series with the name “Sales”. +'Creates a new chart series with the name "Sales". Dim pieSeries As IOfficeChartSerie = chart.Series.Add("Sales") pieSeries.Values = chart.ChartData(2, 2, 3, 2) 'Sets category labels. chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 3, 1) -'Saves the document +'Saves the document. document.Save("Sample.docx", FormatType.Docx) -'Closes the document +'Closes the document. document.Close() {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Conversion.md b/Document-Processing/Word/Word-Library/NET/Conversion.md index 9699250153..654ed2511a 100644 --- a/Document-Processing/Word/Word-Library/NET/Conversion.md +++ b/Document-Processing/Word/Word-Library/NET/Conversion.md @@ -9,34 +9,34 @@ documentation: UG ## Working with Document Conversions -The Essential® DocIO converts documents from one format to another format. Each file format document can be categorized as flow layout document or fixed layout document. +Essential® DocIO converts documents from one format to another. Each file format document can be categorized as a flow layout document or a fixed layout document. **Flow layout document** * A flow document is designed to "reflow content" depending on the application. * Does not contain any information about the position of its content. -* Dynamically renders the content by application at run time. +* Dynamically renders the content by the application at run time. * Example: DOC, DOCX, HTML, EPUB, RTF, and TEXT file formats. **Fixed layout document** -* This format of fixed document is like "what you see is what you get". -* Maintains the fixed position for each content. -* Statically preserves the content in specified position. +* This type of fixed document is "what you see is what you get". +* Maintains a fixed position for each content element. +* Statically preserves the content at a specified position. * Example: Image and PDF. -Essential® DocIO can convert various flow document as fixed document by using our layout engine. The following conversions are supported by Essential® DocIO: +Essential® DocIO can convert various flow documents into fixed documents by using the layout engine. The following conversions are supported by Essential® DocIO: * Word document to PDF * Word document to Image -* HTML Conversions -* Markdown Conversions -* RTF Conversions -* Text Conversions +* HTML conversions +* Markdown conversions +* RTF conversions +* Text conversions * Word document to ODT * Word document to EPUB -* Microsoft Word file format Conversions +* Microsoft Word file format conversions ## Converting Word document to PDF @@ -66,7 +66,7 @@ Essential® DocIO supports converting Word documents to images usi ## HTML conversion -Essential® DocIO supports converting the HTML file into Word document and vice versa. It supports only HTML files that meet the validation against the either XHTML 1.0 strict or XHTML 1.0 Transitional schema. +Essential® DocIO supports converting an HTML file into a Word document and vice versa. It supports only HTML files that validate against either the XHTML 1.0 Strict or XHTML 1.0 Transitional schema. For further information, kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/html-conversions). @@ -87,7 +87,7 @@ You can customize the Word to HTML conversion with the following options: * Extract the images used in the HTML document at the specified file directory * Specify to export the header and footer of the Word document in the HTML -* Specify to consider Text Input field as a editable fields or text +* Specify whether to consider Text Input fields as editable fields or text * Specify the CSS style sheet type and its name N> @@ -95,11 +95,11 @@ While exporting the header and footer, DocIO exports the first section's header For further information, kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/html-conversions#customizing-the-word-to-html-conversion). -### Supported Document elements +### Supported document elements -Kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/html-conversions#supported-and-unsupported-items) for the document elements and attributes are supported by DocIO in Word to HTML and HTML to Word conversions. +Kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/html-conversions#supported-and-unsupported-items) for the document elements and attributes that are supported by DocIO in Word to HTML and HTML to Word conversions. -## Markdown conversion +## Markdown Conversion Essential® DocIO supports converting Markdown files to Word documents and vice versa. @@ -107,11 +107,11 @@ For further information, kindly refer to the following links: * [Markdown to Word conversion](https://help.syncfusion.com/document-processing/word/conversions/markdown-to-word-conversion) * [Word to Markdown conversion](https://help.syncfusion.com/document-processing/word/conversions/word-to-markdown-conversion) -## RTF conversion +## RTF Conversion Essential® DocIO supports converting RTF documents to Word documents and vice versa. For further information, kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/rtf-conversions). -## Text conversion +## Text Conversion Essential® DocIO supports converting Word documents to text files and vice versa. For further information, kindly refer [here](https://help.syncfusion.com/document-processing/word/conversions/text-conversions). diff --git a/Document-Processing/Word/Word-Library/NET/Document-Object-Model-representation.md b/Document-Processing/Word/Word-Library/NET/Document-Object-Model-representation.md index a36e909fe6..14c17e4f3e 100644 --- a/Document-Processing/Word/Word-Library/NET/Document-Object-Model-representation.md +++ b/Document-Processing/Word/Word-Library/NET/Document-Object-Model-representation.md @@ -1,13 +1,13 @@ --- title: Document Object Model of .NET Word library | Syncfusion -description: Learn here all about the Document Object Model (DOM) representation of Word documents and their elements in the Syncfusion® .NET Word (DocIO) library. +description: Learn here all about the Document Object Model (DOM) representation of Word documents and their elements in the Syncfusion® Word library. platform: document-processing control: DocIO documentation: UG --- -# Document Object Model representation in File Formats DocIO +# Document Object Model representation in .NET Word (DocIO) library -When an existing document is opened or a new document is created, the DocIO library creates a **Document Object Model** (DOM) of the document in main memory. This object model can be used to manipulate the document as needed. +When an existing document is opened or a new document is created, the .NET Word (DocIO) library builds a **Document Object Model** (DOM) of the document in memory. This in-memory object model can be traversed and modified programmatically through the DocIO API to manipulate the document as needed. ![Document Object Model representation in File Formats DocIO](DocumentObjectModelrepresentation_images/DocumentObjectModelrepresentation_img1.png) diff --git a/Document-Processing/Word/Word-Library/NET/FAQ.md b/Document-Processing/Word/Word-Library/NET/FAQ.md index f38eb56734..5a64aa9e80 100644 --- a/Document-Processing/Word/Word-Library/NET/FAQ.md +++ b/Document-Processing/Word/Word-Library/NET/FAQ.md @@ -7,14 +7,14 @@ documentation: UG --- # Frequently Asked Questions in Word Library -The frequently asked questions under each category in Essential® DocIO are listed below. +The frequently asked questions under each category in Syncfusion® DocIO are listed below. ## Word Document * [How to open a document from stream using DocIO?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#how-to-open-a-document-from-stream-using-docio) * [How to attach a Template to a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#how-to-attach-a-template-to-a-word-document) * [How to check the compatibility mode of the Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#how-to-check-the-compatibility-mode-of-the-word-document) -* [Which units does Essential® DocIO uses for measurement properties such as size, margins, etc, in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#which-units-does-essential-docio-uses-for-measurement-properties-such-as-size-margins-etc-in-a-word-document) +* [Which units does Syncfusion® DocIO use for measurement properties such as size, margins, etc., in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#which-units-does-essential-docio-uses-for-measurement-properties-such-as-size-margins-etc-in-a-word-document) * [How to convert Units (cm, mm, or inches) to Points for DocIO?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#how-to-convert-units-cm-mm-or-inches-to-points-for-docio) * [Why does the ‘File Not Supported’ exception occur in Syncfusion® DocIO?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#why-does-the-file-not-supported-exception-occur-in-syncfusion-docio) * [Why do documents remain locked after use?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-document-faqs#why-do-documents-remain-locked-after-use) @@ -71,9 +71,9 @@ The frequently asked questions under each category in Essential® * [Example: Triangle Ink Trace Points](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#example:-triangle-ink-trace-points) * [How to Set Stroke Thickness?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#how-to-set-stroke-thickness) -## Mail merge +## Mail Merge -* [Is it possible to format merge fields with image formats before performing a mail merge?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/mail-merge-faqs) +* [Is it possible to format merge fields with image formats before performing a mail merge?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/mail-merge-faqs#is-it-possible-to-format-merge-fields-with-image-formats-before-performing-a-mail-merge) * [Why does DocIO use merge field values from the parent group when the nested group data does not contain a value?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/mail-merge-faqs#why-does-docio-use-merge-field-values-from-the-parent-group-when-the-nested-group-data-does-not-contain-a-value) * [How to identify merge fields that do not exist in the data source?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/mail-merge-faqs#how-to-identify-merge-fields-that-do-not-exist-in-the-data-source) * [Why is each record merging on a new page during mail merge?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/mail-merge-faqs#why-is-each-record-merging-on-a-new-page-during-mail-merge) @@ -83,10 +83,10 @@ The frequently asked questions under each category in Essential® ## Tables * [How to insert a DataTable in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-insert-a-datatable-in-a-word-document) -* [How to insert a table from HTML string in Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-insert-a-table-from-html-string-in-word-document) +* [How to insert a table from HTML string in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-insert-a-table-from-html-string-in-word-document) * [How to set table cell width?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-set-table-cell-width) * [How to position a table in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-position-a-table-in-a-word-document) -* [How to set the text direction to a table in Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-set-the-text-direction-to-a-table-in-word-document) +* [How to set the text direction to a table in a Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-to-set-the-text-direction-to-a-table-in-word-document) * [How can I obtain the height of a cell or row in a Word document using the DocIO library?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#how-can-i-obtain-the-height-of-a-cell-or-row-in-a-word-document-using-the-docio-library) * [Why does setting the top or bottom padding for one cell in a Word document apply the same padding to all cells in the row?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#why-does-setting-the-top-or-bottom-padding-for-one-cell-in-a-word-document-apply-the-same-padding-to-all-cells-in-the-row) * [Is it possible to insert a page break inside a table using DocIO?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/tables-faqs#is-it-possible-to-insert-a-page-break-inside-a-table-using-docio) @@ -102,7 +102,7 @@ The frequently asked questions under each category in Essential® * [Why track changes color are different in Word document?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/track-changes-faqs#why-track-changes-color-are-different-in-word-document) * [Is it possible to track changes made programmatically using the DocIO library?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/track-changes-faqs#is-it-possible-to-track-changes-made-programmatically-using-the-docio-library) -## Word to PDF and Image conversions +## Word to PDF and Image Conversions * [Could not find Syncfusion.OfficeChartToImageConverter assembly in .NET 3.5 Framework, does it mean there is no support for chart conversion in this Framework?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-to-pdf-and-image-conversions-faqs#could-not-find-syncfusionofficecharttoimageconverter-assembly-in-net-35-framework-does-it-mean-there-is-no-support-for-chart-conversion-in-this-framework) * [Is it possible to convert 3D charts to PDF or image?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/word-to-pdf-and-image-conversions-faqs#is-it-possible-to-convert-3d-charts-to-pdf-or-image) diff --git a/Document-Processing/Word/Word-Library/NET/Feature-Matrix.md b/Document-Processing/Word/Word-Library/NET/Feature-Matrix.md index ac1186707d..f78af382bd 100644 --- a/Document-Processing/Word/Word-Library/NET/Feature-Matrix.md +++ b/Document-Processing/Word/Word-Library/NET/Feature-Matrix.md @@ -48,7 +48,7 @@ The following table outlines the supported features across different Word format - +
Update page count.YesYesYes
Access, create, and modify document sections, headers, and footers.YesYesYes
Iterate over document content.YesYesYes
Access and move elements between documents.NoYesNo
Move elements between documents.NoYesNo
Insert HTML text.YesYesYes
@@ -186,9 +186,9 @@ The following table outlines the supported features across different Word format Perform mail merge from any .NET data source such as string array, DataSet, DataTable, DataView, and DataReader.YesYesYes Perform mail merge from any data source such as IEnumerable collection and dynamic objects.YesYesYes Format the merged text, images, or other elements during mail merge.YesYesYes - Event hander to bind data for unmerged fields.YesYesYes + Event handler to bind data for unmerged fields.YesYesYes Map the merge field names with column names in the data source.YesYesYes - Skip to merge particular a image during the mail merge process.YesYesYes + Skip merging a particular image during the mail merge process.YesYesYes Start a new page for each group of records.YesYesYes diff --git a/Document-Processing/Word/Word-Library/NET/Getting-Started.md b/Document-Processing/Word/Word-Library/NET/Getting-Started.md index 1e5a3193cf..4e83a3d5e2 100644 --- a/Document-Processing/Word/Word-Library/NET/Getting-Started.md +++ b/Document-Processing/Word/Word-Library/NET/Getting-Started.md @@ -6,12 +6,12 @@ platform: document-processing control: DocIO documentation: UG --- -# Getting started with simple word document +# Getting Started with a Simple Word Document -To quickly get started with the .NET Word (DOCIO) Library, please check out this video: +To quickly get started with the .NET Word (DocIO) Library, please check out this video: {% youtube "https://www.youtube.com/watch?v=ptbMtxIv3CY" %} -In this page, you can see how to create a simple Word document by using Essential® DocIO’s API. For creating and manipulating a Word document, the following assemblies are required to be referenced in your application. +On this page, you can learn how to create a simple Word document by using Essential® DocIO’s API. For creating and manipulating a Word document, the following assemblies must be referenced in your application. @@ -42,7 +42,7 @@ N> 2. Syncfusion components are available in [nuget.org](https://www.nuget.org/) N> You can also explore our [.NET Word Library](https://www.syncfusion.com/demos/fileformats/word-library) demo that shows how to create and modify word files from C# with just five lines of code on different platforms. -Include the following namespaces in your .cs or .vb file +Include the following namespaces in your .cs or .vb file. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -73,12 +73,12 @@ Imports Syncfusion.DocIO.DLS ## Creating a new Word document with few lines of code -The following code example explains how to create a new Word document with few lines of code +The following code example explains how to create a new Word document with a few lines of code. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Getting-Started/Create-Word-document/.NET/Create-Word-document/Program.cs" %} -//Creates a new instance of WordDocument (Empty Word Document) +//Creates an instance of WordDocument (Empty Word Document) WordDocument document = new WordDocument(); //Adds a section and a paragraph to the document document.EnsureMinimal(); @@ -92,25 +92,25 @@ document.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates an instance of WordDocument Instance (Empty Word Document) +//Creates an instance of WordDocument (Empty Word Document) WordDocument document = new WordDocument(); -//Add a section & a paragraph in the empty document +//Adds a section and a paragraph in the empty document document.EnsureMinimal(); -//Append text to the last paragraph of the document +//Appends text to the last paragraph of the document document.LastParagraph.AppendText("Hello World"); -//Save and close the Word document +//Saves and closes the Word document document.Save("Result.docx"); document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates an instance of WordDocument Instance (Empty Word Document) +'Creates an instance of WordDocument (Empty Word Document) Dim document As New WordDocument() -'Add a section & a paragraph in the empty document +'Adds a section and a paragraph in the empty document document.EnsureMinimal() -'Append text to the last paragraph of the document +'Appends text to the last paragraph of the document document.LastParagraph.AppendText("Hello World") -'Save and close the Word document +'Saves and closes the Word document document.Save("Result.docx") document.Close() {% endhighlight %} @@ -121,16 +121,16 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Creating a new Word document from scratch with basic elements -An entire Word document is represented by an instance of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html) and it is root element of DocIO’s DOM. Word document contains a collection of sections. A Word document must contain at least one section. +An entire Word document is represented by an instance of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html) and it is the root element of DocIO’s DOM. A Word document contains a collection of sections. A Word document must contain at least one section. -A section represents group of paragraphs, tables etc., that have a specific set of properties used to define the pages, number of columns, headers and footers and so on that decides how the text appears. A section should contain at least one paragraph in this body. +A section represents a group of paragraphs, tables, etc., that have a specific set of properties used to define the pages, number of columns, headers and footers, and so on that decide how the text appears. A section should contain at least one paragraph in its body. The following code example explains how to add a section into a [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html) instance. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Getting-Started/Create-Word-with-basic-elements/.NET/Create-Word-with-basic-elements/Program.cs" %} -//Creates an instance of WordDocument Instance (Empty Word Document) +//Creates an instance of WordDocument (Empty Word Document) WordDocument document = new WordDocument(); //Adds a new section into the Word document IWSection section = document.AddSection(); @@ -139,7 +139,7 @@ section.PageSetup.Margins.All = 50f; {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Creates an instance of WordDocument Instance (Empty Word Document) +//Creates an instance of WordDocument (Empty Word Document) WordDocument document = new WordDocument(); //Adds a new section into the Word document IWSection section = document.AddSection(); @@ -148,7 +148,7 @@ section.PageSetup.Margins.All = 50f; {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Creates an instance of WordDocument Instance (Empty Word Document) +'Creates an instance of WordDocument (Empty Word Document) Dim document As New WordDocument() 'Adds a new section into the Word document Dim section As IWSection = document.AddSection() @@ -158,9 +158,9 @@ section.PageSetup.Margins.All = 50.0F {% endtabs %} -All the textual contents in a Word document is represented by Paragraphs. Within the paragraph, textual contents are grouped into one or more child elements such as TextRange, field etc. Each TextRange represents a region of text with a common set of rich text formatting. +All the textual contents in a Word document are represented by paragraphs. Within the paragraph, textual contents are grouped into one or more child elements such as TextRange, field, etc. Each TextRange represents a region of text with a common set of rich text formatting. -The following code example explains how to add a Paragraph into a Word document +The following code example explains how to add a paragraph into a Word document. {% tabs %} @@ -171,13 +171,13 @@ IWParagraph firstParagraph = section.AddParagraph(); firstParagraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Justify; //Adds a text range into the paragraph IWTextRange firstTextRange = firstParagraph.AppendText("AdventureWorks Cycles,"); -//sets the font formatting of the text range +//Sets the font formatting of the text range firstTextRange.CharacterFormat.Bold = true; firstTextRange.CharacterFormat.FontName = "Calibri"; firstTextRange.CharacterFormat.FontSize = 14; //Adds another text range into the paragraph IWTextRange secondTextRange = firstParagraph.AppendText(" the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company."); -//sets the font formatting of the text range +//Sets the font formatting of the text range secondTextRange.CharacterFormat.FontName = "Calibri"; secondTextRange.CharacterFormat.FontSize = 11; {% endhighlight %} @@ -189,13 +189,13 @@ IWParagraph firstParagraph = section.AddParagraph(); firstParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Justify; //Adds a text range into the paragraph IWTextRange firstTextRange = firstParagraph.AppendText("AdventureWorks Cycles,"); -//sets the font formatting of the text range +//Sets the font formatting of the text range firstTextRange.CharacterFormat.Bold = true; firstTextRange.CharacterFormat.FontName = "Calibri"; firstTextRange.CharacterFormat.FontSize = 14; //Adds another text range into the paragraph IWTextRange secondTextRange = firstParagraph.AppendText(" the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company."); -//sets the font formatting of the text range +//Sets the font formatting of the text range secondTextRange.CharacterFormat.FontName = "Calibri"; secondTextRange.CharacterFormat.FontSize = 11; {% endhighlight %} @@ -207,13 +207,13 @@ Dim firstParagraph As IWParagraph = section.AddParagraph() firstParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Justify 'Adds a text range into the paragraph Dim firstTextRange As IWTextRange = firstParagraph.AppendText("AdventureWorks Cycles, ") -'sets the font formatting of the text range +'Sets the font formatting of the text range firstTextRange.CharacterFormat.Bold = True firstTextRange.CharacterFormat.FontName = "Calibri" firstTextRange.CharacterFormat.FontSize = 14 'Adds another text range into the paragraph Dim secondTextRange As IWTextRange = firstParagraph.AppendText("the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company.") -'sets the font formatting of the text range +'Sets the font formatting of the text range secondTextRange.CharacterFormat.FontName = "Calibri" secondTextRange.CharacterFormat.FontSize = 11 {% endhighlight %} @@ -228,12 +228,12 @@ The following code example shows how to add an image into the Word document. //Adds another paragraph and aligns it as center IWParagraph paragraph = section.AddParagraph(); paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; -//Sets after spacing for paragraph. +//Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 8; //Adds a picture into the paragraph FileStream image1 = new FileStream("DummyProfilePicture.jpg", FileMode.Open, FileAccess.Read); IWPicture picture = paragraph.AppendPicture(image1); -//Specify the size of the picture +//Specifies the size of the picture picture.Height = 100; picture.Width = 100; {% endhighlight %} @@ -242,11 +242,11 @@ picture.Width = 100; //Adds another paragraph and aligns it as center IWParagraph paragraph = section.AddParagraph(); paragraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center; -//Sets after spacing for paragraph. +//Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 8; //Adds a picture into the paragraph IWPicture picture = paragraph.AppendPicture(Image.FromFile("DummyProfilePicture.jpg")); -//Specify the size of the picture +//Specifies the size of the picture picture.Height = 100; picture.Width = 100; {% endhighlight %} @@ -255,7 +255,7 @@ picture.Width = 100; 'Adds another paragraph and aligns it as center Dim paragraph As IWParagraph = section.AddParagraph() paragraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center -'Sets after spacing for paragraph. +'Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 8 'Adds a picture into the paragraph Dim picture As IWPicture = paragraph.AppendPicture(Image.FromFile("DummyProfilePicture.jpg")) @@ -266,7 +266,7 @@ picture.Width = 100 {% endtabs %} -Table is another important element in Word that contains a set of paragraphs arranged in rows and columns. You can create simple as well as complex table by using Essential DocIO’s API. The following code example creates a simple table and adds contents into it. Each table cell must contain at least one paragraph. +A table is another important element in Word that contains a set of paragraphs arranged in rows and columns. You can create simple as well as complex tables by using Essential DocIO’s API. The following code example creates a simple table and adds contents into it. Each table cell must contain at least one paragraph. {% tabs %} @@ -279,11 +279,11 @@ table.ResetCells(2, 2); WTableCell firstCell = table.Rows[0].Cells[0]; //Specifies the width of the cell firstCell.Width = 150; -//Adds a paragraph into the cell; a cell must have atleast 1 paragraph +//Adds a paragraph into the cell; a cell must have at least 1 paragraph paragraph = firstCell.AddParagraph(); IWTextRange textRange = paragraph.AppendText("Profile picture"); textRange.CharacterFormat.Bold = true; -//Accesses the instance of cell (first row, second cell) +//Accesses the instance of the cell (first row, second cell) WTableCell secondCell = table.Rows[0].Cells[1]; secondCell.Width = 330; paragraph = secondCell.AddParagraph(); @@ -292,7 +292,7 @@ textRange.CharacterFormat.Bold = true; firstCell = table.Rows[1].Cells[0]; firstCell.Width = 150; paragraph = firstCell.AddParagraph(); -//Sets after spacing for paragraph. +//Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 6; FileStream image2 = new FileStream("DummyProfile-Picture.jpg", FileMode.Open, FileAccess.Read); IWPicture profilePicture = paragraph.AppendPicture(image2); @@ -308,16 +308,16 @@ textRange = paragraph.AppendText("AdventureWorks Cycles, the fictitious company //Adds a table into the Word document IWTable table = section.AddTable(); //Creates the specified number of rows and columns -table.ResetCells(2,2); +table.ResetCells(2, 2); //Accesses the instance of the cell (first row, first cell) WTableCell firstCell = table.Rows[0].Cells[0]; //Specifies the width of the cell firstCell.Width = 150; -//Adds a paragraph into the cell; a cell must have atleast 1 paragraph +//Adds a paragraph into the cell; a cell must have at least 1 paragraph paragraph = firstCell.AddParagraph(); IWTextRange textRange = paragraph.AppendText("Profile picture"); textRange.CharacterFormat.Bold = true; -//Accesses the instance of cell (first row, second cell) +//Accesses the instance of the cell (first row, second cell) WTableCell secondCell = table.Rows[0].Cells[1]; secondCell.Width = 330; paragraph = secondCell.AddParagraph(); @@ -326,9 +326,9 @@ textRange.CharacterFormat.Bold = true; firstCell = table.Rows[1].Cells[0]; firstCell.Width = 150; paragraph = firstCell.AddParagraph(); -//Sets after spacing for paragraph. +//Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 6; -IWPicture profilePicture = paragraph.AppendPicture(Image.FromFile(DummyProfile-Picture.jpg")); +IWPicture profilePicture = paragraph.AppendPicture(Image.FromFile("DummyProfile-Picture.jpg")); profilePicture.Height = 100; profilePicture.Width = 100; secondCell = table.Rows[1].Cells[1]; @@ -346,11 +346,11 @@ table.ResetCells(2, 2) Dim firstCell As WTableCell = table.Rows(0).Cells(0) 'Specifies the width of the cell firstCell.Width = 150 -'Adds a paragraph into the cell; a cell must have atleast 1 paragraph +'Adds a paragraph into the cell; a cell must have at least 1 paragraph paragraph = firstCell.AddParagraph() Dim textRange As IWTextRange = paragraph.AppendText("Profile picture") textRange.CharacterFormat.Bold = True -'Accesses the instance of cell (first row, second cell) +'Accesses the instance of the cell (first row, second cell) Dim secondCell As WTableCell = table.Rows(0).Cells(1) secondCell.Width = 330 paragraph = secondCell.AddParagraph() @@ -359,7 +359,7 @@ textRange.CharacterFormat.Bold = True firstCell = table.Rows(1).Cells(0) firstCell.Width = 150 paragraph = firstCell.AddParagraph() -'Sets after spacing for paragraph. +'Sets after spacing for the paragraph. paragraph.ParagraphFormat.AfterSpacing = 6 Dim profilePicture As IWPicture = paragraph.AppendPicture(Image.FromFile("DummyProfile-Picture.jpg")) profilePicture.Height = 100 @@ -372,14 +372,14 @@ textRange = paragraph.AppendText("AdventureWorks Cycles, the fictitious company {% endtabs %} -Essential® DocIO allow you to create simple and multi-level lists. The following code snippet explains about how to create a numbered and bulleted list. +Essential® DocIO allows you to create simple and multi-level lists. The following code snippet explains how to create a numbered and bulleted list. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Getting-Started/Create-Word-with-basic-elements/.NET/Create-Word-with-basic-elements/Program.cs" %} //Writes default numbered list. paragraph = section.AddParagraph(); -//Sets before spacing for paragraph. +//Sets before spacing for the paragraph. paragraph.ParagraphFormat.BeforeSpacing = 6; paragraph.AppendText("Level 0"); //Applies the default numbered list formats @@ -390,7 +390,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 1"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Increments the list level paragraph.ListFormat.IncreaseIndentLevel(); @@ -419,7 +419,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 1"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Increments the list level paragraph.ListFormat.IncreaseIndentLevel(); @@ -429,7 +429,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 0"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Decrements the list level paragraph.ListFormat.DecreaseIndentLevel(); @@ -443,7 +443,7 @@ section.AddParagraph(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Writes default numbered list. paragraph = section.AddParagraph(); -//Sets before spacing for paragraph. +//Sets before spacing for the paragraph. paragraph.ParagraphFormat.BeforeSpacing = 6; paragraph.AppendText("Level 0"); //Applies the default numbered list formats @@ -454,7 +454,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 1"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Increments the list level paragraph.ListFormat.IncreaseIndentLevel(); @@ -483,7 +483,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 1"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Increments the list level paragraph.ListFormat.IncreaseIndentLevel(); @@ -493,7 +493,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18; paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left; paragraph = section.AddParagraph(); paragraph.AppendText("Level 0"); -//Specifies the list format to continue from last list +//Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering(); //Decrements the list level paragraph.ListFormat.DecreaseIndentLevel(); @@ -507,7 +507,7 @@ section.AddParagraph(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Writes default numbered list. paragraph = section.AddParagraph() -'Sets before spacing for paragraph. +'Sets before spacing for the paragraph. paragraph.ParagraphFormat.BeforeSpacing = 6 paragraph.AppendText("Level 0") 'Applies the default numbered list formats @@ -518,7 +518,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18 paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left paragraph = section.AddParagraph() paragraph.AppendText("Level 1") -'Specifies the list format to continue from last list +'Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering() 'Increments the list level paragraph.ListFormat.IncreaseIndentLevel() @@ -547,7 +547,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18 paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left paragraph = section.AddParagraph() paragraph.AppendText("Level 1") -'Specifies the list format to continue from last list +'Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering() 'Increments the list level paragraph.ListFormat.IncreaseIndentLevel() @@ -557,7 +557,7 @@ paragraph.ListFormat.CurrentListLevel.ParagraphFormat.FirstLineIndent = -18 paragraph.ListFormat.CurrentListLevel.NumberAlignment = ListNumberAlignment.Left paragraph = section.AddParagraph() paragraph.AppendText("Level 0") -'Specifies the list format to continue from last list +'Specifies the list format to continue from the last list paragraph.ListFormat.ContinueListNumbering() 'Decrements the list level paragraph.ListFormat.DecreaseIndentLevel() @@ -570,31 +570,31 @@ section.AddParagraph() {% endtabs %} -Finally, save the document in file system and close its instance. +Finally, save the document to the file system and close its instance. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Getting-Started/Create-Word-with-basic-elements/.NET/Create-Word-with-basic-elements/Program.cs" %} MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); stream.Position = 0; -//Download Word document in the browser +//Downloads the Word document in the browser return File(stream, "application/msword", outputFileName); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Saves the document in the given name and format +//Saves the document with the given name and format document.Save(outputFileName, FormatType.Docx); -//Releases the resources occupied by WordDocument instance +//Releases the resources occupied by the WordDocument instance document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Saves the document in the given name and format +'Saves the document with the given name and format document.Save(outputFileName, FormatType.Docx) -'Releases the resources occupied by WordDocument instance +'Releases the resources occupied by the WordDocument instance document.Close() {% endhighlight %} @@ -608,19 +608,19 @@ The resultant Word document looks as follows. ## Modifying an existing Word document -Essential® DocIO allows you to manipulate an existing Word document, RTF, WordML, HTML and Plain text files. You can modify the documents either by manipulating DocIO’s DOM or by using DocIO’s built-in functionalities such as Find and Replace, replacing bookmark contents etc. +Essential® DocIO allows you to manipulate an existing Word document, RTF, WordML, HTML, and plain text files. You can modify the documents either by manipulating DocIO’s DOM or by using DocIO’s built-in functionalities such as Find and Replace, replacing bookmark contents, etc. -Here, you can see how an existing Word document is loaded into DocIO’s DOM, replaces an existing content with another and finally saves the Word document. +Here, you can see how an existing Word document is loaded into DocIO’s DOM, an existing content is replaced with another, and finally the Word document is saved. -You can open an existing Word document either by using constructor of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument__ctor_System_String_) class or by using [Open](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Open_System_String_) method of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html) class that reads the document and populates DocIO’s DOM. The following code example shows how to load an existing document. +You can open an existing Word document either by using the constructor of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument__ctor_System_String_) class or by using the [Open](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Open_System_String_) method of [WordDocument](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html) class that reads the document and populates DocIO’s DOM. The following code example shows how to load an existing document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Find-and-Replace/Find-and-replace-all/.NET/Find-and-replace-all/Program.cs" %} -FileStream fileStream = new FileStream(@"Giant Panda.docx",FileMode.Open,FileAccess.ReadWrite); +FileStream fileStream = new FileStream(@"Giant Panda.docx", FileMode.Open, FileAccess.ReadWrite); //Loads an existing Word document into DocIO instance WordDocument document = new WordDocument(fileStream, FormatType.Automatic); -//Replaces the word "bear" as "panda" +//Replaces the word "bear" with "panda" document.Replace("bear", "panda", false, true); //Saves the Word document to MemoryStream. MemoryStream stream = new MemoryStream(); @@ -632,7 +632,7 @@ document.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads an existing Word document into DocIO instance WordDocument document = new WordDocument("Giant Panda.docx"); -//Replaces the word "bear" as "panda" +//Replaces the word "bear" with "panda" document.Replace("bear", "panda", false, true); //Saves the Word document document.Save("Result.docx"); @@ -643,11 +643,11 @@ document.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads an existing Word document into DocIO instance Dim document As New WordDocument("Giant Panda.docx") -'Replaces the word "bear" as "panda" +'Replaces the word "bear" with "panda" document.Replace("bear", "panda", False, True) 'Saves the Word document document.Save("Result.docx") -'Closes the document +'Closes the document document.Close() {% endhighlight %} @@ -655,15 +655,15 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Find-and-Replace/Find-and-replace-all). -The following code example explains how to search a particular text and highlight it. +The following code example explains how to search for a particular text and highlight it. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Find-and-Replace/Find-and-highlight-all/.NET/Find-and-highlight-all/Program.cs" %} -FileStream fileStream = new FileStream(@"Test.docx",FileMode.Open,FileAccess.ReadWrite); +FileStream fileStream = new FileStream(@"Test.docx", FileMode.Open, FileAccess.ReadWrite); //Loads an existing Word document into DocIO instance WordDocument document = new WordDocument(fileStream, FormatType.Automatic); -//Finds the occurrence of the Word "panda" in the document +//Finds the occurrence of the word "panda" in the document TextSelection[] textSelection = document.FindAll("panda", false, true); //Iterates through each occurrence and highlights it foreach (TextSelection selection in textSelection) @@ -681,7 +681,7 @@ document.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads an existing Word document into DocIO instance WordDocument document = new WordDocument(@"../../Data/Giant Panda.docx"); -//Finds the occurrence of the Word "panda" in the document +//Finds the occurrence of the word "panda" in the document TextSelection[] textSelection = document.FindAll("panda", false, true); //Iterates through each occurrence and highlights it foreach (TextSelection selection in textSelection) @@ -714,7 +714,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Performing Mail merge -Essential® DocIO allows to generate documents by filling data in template document from data source. Mail merge operation automatically maps the column name in the data source and names of the merge fields in the template Word document and fills the data. +Essential® DocIO allows you to generate documents by filling data in a template document from a data source. The Mail merge operation automatically maps the column name in the data source and the names of the merge fields in the template Word document and fills the data. The following data sources are supported by Essential® DocIO for performing Mail merge. @@ -723,17 +723,17 @@ The following data sources are supported by Essential® DocIO for * Business Objects * Dynamic objects -Also, you can perform more than one Mail merge operations over the same template to generate document as per your requirement. +Also, you can perform more than one Mail merge operation over the same template to generate the document as per your requirement. -Follow the given steps to perform simple Mail merge in a Word document. +Follow the given steps to perform a simple Mail merge in a Word document. Let’s consider that you have a template Word document with merge fields as shown. ![Performing Mail merge input document](GettingStarted_images/GettingStarted_img2.jpeg) -The [MailMerge](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.MailMerge.html) class provides various overloads for [Execute](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.MailMerge.html#Syncfusion_DocIO_DLS_MailMerge_Execute_System_String___System_String___) method to perform Mail merge from various data source. The Mail merge operation replaces the matching merge fields with the respective data. +The [MailMerge](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.MailMerge.html) class provides various overloads for the [Execute](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.MailMerge.html#Syncfusion_DocIO_DLS_MailMerge_Execute_System_String___System_String___) method to perform Mail merge from various data sources. The Mail merge operation replaces the matching merge fields with the respective data. -The following code example shows how to perform simple Mail merge by using string array. +The following code example shows how to perform a simple Mail merge by using a string array. {% tabs %} @@ -786,28 +786,28 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Mail-Merge/Mail-merge-with-string-arrays). -The resultant Word document look as follows. +The resultant Word document looks as follows. ![Performing Mail merge output document](GettingStarted_images/GettingStarted_img3.jpeg) ### Simple Mail merge with Group -You can perform Mail merge with group to append multiple records from data source into a single document. Group is a part of the document enclosed by two special merge fields named «TableStart:TableName» and «TableEnd:TableName» +You can perform Mail merge with a group to append multiple records from a data source into a single document. A group is a part of the document enclosed by two special merge fields named «TableStart:TableName» and «TableEnd:TableName». * «TableStart:TableName» - denotes the start of the group * «TableEnd:TableName» - denotes the end of the group -The region between these two merge fields get repeated for every record from the data source. +The region between these two merge fields gets repeated for every record from the data source. For example – let’s consider that you have a template document as shown. ![Simple Mail merge with Group input document](GettingStarted_images/GettingStarted_img4.jpeg) -Here, in this template, Employees is the group name and exact same name should be used while performing Mail merge through code. There are two special merge fields “TableStart:Employees” and “TableEnd:Employees”, to denote the start and end of the Mail merge group. +Here, in this template, Employees is the group name, and the exact same name should be used while performing Mail merge through code. There are two special merge fields “TableStart:Employees” and “TableEnd:Employees”, to denote the start and end of the Mail merge group. -To merge an image in the replace of a merge field, you need to add a prefix (“Image:”)the merge field name. +To merge an image in place of a merge field, you need to add a prefix (“Image:”) to the merge field name. -For example: the merge field name should be like “<>”(<>) +For example: the merge field name should be like “<>” (<>). The following code example shows how to perform Mail merge with objects. @@ -845,7 +845,7 @@ document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -//Loads the template document +'Loads the template document Dim document As New WordDocument("../../Data/EmployeesTemplate.doc") 'Gets the employee details as IEnumerable collection Dim employeeList As List(Of Employee) = GetEmployees() @@ -860,7 +860,7 @@ document.Close() {% endtabs %} -The following code example provides supporting methods and class for the above code +The following code example provides supporting methods and classes for the above code. {% tabs %} @@ -1025,13 +1025,13 @@ Public Class Employee Private m_Photo As Image Public Sub New(firstName As String, lastName As String, title As String, address As String, city As String, region As String, country As String, photoFilePath As String) - firstName = firstName - lastName = lastName - title = title - address = address - city = city - region = region - country = country + Me.FirstName = firstName + Me.LastName = lastName + Me.Title = title + Me.Address = address + Me.City = city + Me.Region = region + Me.Country = country Photo = Image.FromFile(photoFilePath) End Sub End Class @@ -1047,27 +1047,27 @@ The resultant document looks as follows. ## Converting Word document to PDF -Essential® DocIO allows you to convert a Word document into PDF document in a few lines of code. +Essential® DocIO allows you to convert a Word document into a PDF document in a few lines of code. Refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/assemblies-required#converting-word-document-to-pdf) to know about the assemblies required to perform Word to PDF conversion in your application. -[DocToPDFConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocToPDFConverter.DocToPDFConverter.html) class is responsible for converting a Word document into PDF. +The [DocToPDFConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocToPDFConverter.DocToPDFConverter.html) class is responsible for converting a Word document into PDF. In portable projects, `DocIORenderer` is responsible for converting a Word document into PDF. -The following code example illustrates how to convert a Word document into PDF document. +The following code example illustrates how to convert a Word document into a PDF document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Word-to-PDF-Conversion/Convert-Word-document-to-PDF/.NET/Convert-Word-document-to-PDF/Program.cs" %} -FileStream fileStream = new FileStream(@"EmployeesTemplate.docx", FileMode.Open,FileAccess.ReadWrite); +FileStream fileStream = new FileStream(@"EmployeesTemplate.docx", FileMode.Open, FileAccess.ReadWrite); //Loads an existing Word document into DocIO instance WordDocument wordDocument = new WordDocument(fileStream, FormatType.Automatic); //Creates an instance of DocToPDFConverter - responsible for Word to PDF conversion DocIORenderer converter = new DocIORenderer(); //Converts Word document into PDF document PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument); -//Save the document into stream. +//Saves the document into stream. MemoryStream outputStream = new MemoryStream(); pdfDocument.Save(outputStream); //Closes the instance of PDF document object @@ -1077,8 +1077,8 @@ wordDocument.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads the template document -WordDocument wordDocument = new WordDocument(inputWordDocument, FormatType.Automatic ); -//Initializes chart to image converter for converting charts during Word to pdf conversion +WordDocument wordDocument = new WordDocument(inputWordDocument, FormatType.Automatic); +//Initializes chart to image converter for converting charts during Word to PDF conversion wordDocument.ChartToImageConverter = new ChartToImageConverter(); wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal; //Creates an instance of DocToPDFConverter - responsible for Word to PDF conversion @@ -1087,15 +1087,15 @@ DocToPDFConverter converter = new DocToPDFConverter(); PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument); //Saves the PDF file to file system pdfDocument.Save("Sample.pdf"); -//closes the instance of document objects +//Closes the instance of document objects pdfDocument.Close(); wordDocument.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Loads the template document +'Loads the template document Dim wordDocument As New WordDocument(inputWordDocument, FormatType.Automatic) -'Initializes chart to image converter for converting charts during Word to pdf conversion +'Initializes chart to image converter for converting charts during Word to PDF conversion wordDocument.ChartToImageConverter = New ChartToImageConverter() wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal 'Creates an instance of DocToPDFConverter - responsible for Word to PDF conversion @@ -1104,7 +1104,7 @@ Dim converter As New DocToPDFConverter() Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument) 'Saves the PDF file to file system pdfDocument.Save("Sample.pdf") -'closes the instance of document objects +'Closes the instance of document objects pdfDocument.Close() wordDocument.Close() {% endhighlight %} @@ -1113,8 +1113,8 @@ wordDocument.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Word-to-PDF-Conversion/Convert-Word-document-to-PDF). -N> 1. When the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) object is not initialized, then the charts in Word document gets skipped during Word to PDF conversion. -N> 2. [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) is supported from .NET Framework 4.0 onwards +N> 1. When the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) object is not initialized, the charts in the Word document are skipped during Word to PDF conversion. +N> 2. [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) is supported from .NET Framework 4.0 onwards. ## Online Demo @@ -1136,3 +1136,5 @@ N> 2. [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing * [Create Word document in Docker](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-linux-docker) * [Create Word document in Mac OS](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-mac) + +N> Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Loading-and-Saving-document.md b/Document-Processing/Word/Word-Library/NET/Loading-and-Saving-document.md index da43b33cb3..5b94fad546 100644 --- a/Document-Processing/Word/Word-Library/NET/Loading-and-Saving-document.md +++ b/Document-Processing/Word/Word-Library/NET/Loading-and-Saving-document.md @@ -1,6 +1,6 @@ --- title: Loading & Saving Word document in C# | DocIO | Syncfusion -description: Learn to open and save the Word document in C# and VB.NET using Syncfusion® .NET Word (DocIO) library without Microsoft Word or interop dependencies. +description: Learn to open and save the Word document in C# and VB.NET using Syncfusion® Word library without Microsoft Word or interop dependencies. platform: document-processing control: DocIO documentation: UG @@ -11,6 +11,8 @@ documentation: UG The following namespaces of Essential® DocIO need to be included in your application to load and save the Word document. +N> Install the DocIO NuGet package before referencing these namespaces: [Syncfusion.DocIO.WinForms](https://www.nuget.org/packages/Syncfusion.DocIO.WinForms/) for WinForms/WPF, or [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/) for ASP.NET Core / cross-platform applications. Refer to the [installation and configuration](../installation/Installation-errors) section for complete setup steps. + N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. {% tabs %} @@ -139,7 +141,7 @@ document.Open(wordDocumentStream, FormatType.Automatic) {% endtabs %} -You can download a complete working sample from Stream from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document). +You can download a complete working sample for opening from a stream from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document). ## Opening an Encrypted Word document @@ -169,10 +171,14 @@ Dim document As New WordDocument(fileName, FormatType.Automatic, "password") {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} -//Open an existing document from stream through constructor of WordDocument class. -FileStream fileStreamPath = new FileStream(@"Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); -//Open an encrypted Word document. -WordDocument document = new WordDocument(fileStreamPath, "password"); +//Creates an empty Word document instance +using (WordDocument document = new WordDocument()) +{ + //Loads or opens an existing encrypted word document from stream + FileStream fileStreamPath = new FileStream(@"Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); + //Opens an encrypted Word document through Open method of WordDocument class + document.Open(fileStreamPath, "password"); +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -191,11 +197,11 @@ document.Open(wordDocumentStream, FormatType.Automatic, "password") {% endtabs %} -You can download a complete working sample from Stream from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Open-encrypted-Word-document). +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Open-encrypted-Word-document). -## Opening the read only Word document +## Opening the read-only Word document -You can open the ready only documents or read only streams using the [OpenReadOnly](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_OpenReadOnly_System_String_Syncfusion_DocIO_FormatType_) method. If the Word document for reading is opened by any other application such as Microsoft Word, then the same document can be opened using DocIO in ReadOnly mode. The following code sample demonstrates the same. +You can open the read-only documents or read-only streams using the [OpenReadOnly](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_OpenReadOnly_System_String_Syncfusion_DocIO_FormatType_) method. If the Word document for reading is opened by any other application such as Microsoft Word, then the same document can be opened using DocIO in read-only mode. The following code sample demonstrates the same. {% tabs %} @@ -206,20 +212,20 @@ You can open the ready only documents or read only streams using the [OpenReadOn {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates an empty WordDocument instance WordDocument document = new WordDocument(); -//Loads or opens an existing word document using read only stream +//Loads or opens an existing word document using read-only stream document.OpenReadOnly("Template.docx", Syncfusion.DocIO.FormatType.Docx); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates an empty WordDocument instance Dim document As WordDocument = New WordDocument -'Loads or opens an existing word document using read only stream +'Loads or opens an existing word document using read-only stream document.OpenReadOnly("Template.docx", Syncfusion.DocIO.FormatType.Docx) {% endhighlight %} {% endtabs %} -You can also open an existing encrypted document in read only mode using the overloads as mentioned below. +You can also open an existing encrypted document in read-only mode using the overloads as mentioned below. {% tabs %} @@ -230,14 +236,14 @@ You can also open an existing encrypted document in read only mode using the ove {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates an empty WordDocument instance WordDocument document = new WordDocument(); -//Loads or opens an existing encrypted word document using read only stream -document.OpenReadOnly("Template.docx", Syncfusion.DocIO.FormatType.Docx , "password"); +//Loads or opens an existing encrypted word document using read-only stream +document.OpenReadOnly("Template.docx", Syncfusion.DocIO.FormatType.Docx, "password"); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates an empty WordDocument instance Dim document As WordDocument = New WordDocument -'Loads or opens an existing encrypted word document using read only stream +'Loads or opens an existing encrypted word document using read-only stream document.OpenReadOnly("Template.docx", Syncfusion.DocIO.FormatType.Docx, "password") {% endhighlight %} @@ -263,28 +269,33 @@ document.Save(outputStream, FormatType.Docx); document.Close(); outputStream.Flush(); outputStream.Dispose(); +inputStream.Dispose(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates an empty WordDocument instance WordDocument document = new WordDocument(); -//opens an existing Word document through Open method of WordDocument class +//Opens an existing Word document through Open method of WordDocument class document.Open(fileName); //To-Do some manipulation //To-Do some manipulation //Saves the document in file system document.Save(outputFileName, FormatType.Docx); +//Closes the document +document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates an empty WordDocument instance Dim document As New WordDocument() -'opens an existing Word document through Open method of WordDocument class +'Opens an existing Word document through Open method of WordDocument class document.Open(fileName) 'To-Do some manipulation 'To-Do some manipulation 'Saves the document in file system document.Save(outputFileName, FormatType.Docx) +'Closes the document +document.Close() {% endhighlight %} {% endtabs %} @@ -327,6 +338,8 @@ document.Open(fileName); MemoryStream stream = new MemoryStream(); //Saves the document to stream document.Save(stream, FormatType.Docx); +//Closes the document +document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -340,6 +353,8 @@ document.Open(fileName) Dim stream As New MemoryStream() 'Saves the document to stream document.Save(stream, FormatType.Docx) +'Closes the document +document.Close() {% endhighlight %} {% endtabs %} @@ -348,7 +363,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Sending to a client browser -You can save and send the document to a client browser from a web site or web application by invoking the following shown overload of [Save](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_System_Web_HttpResponse_Syncfusion_DocIO_HttpContentDisposition_) method. This method explicitly makes use of an instance of [HttpResponse](https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse?view=netframework-4.8) as its parameter in order to stream the document to client browser. So this overload is suitable for web application that references System.Web assembly. +You can save and send the document to a client browser from a web site or web application by invoking the following overload of [Save](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_System_Web_HttpResponse_Syncfusion_DocIO_HttpContentDisposition_) method. This method explicitly makes use of an instance of [HttpResponse](https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse?view=netframework-4.8) as its parameter in order to stream the document to the client browser. So this overload is suitable for web applications that reference the System.Web assembly. {% tabs %} @@ -362,7 +377,7 @@ IWParagraph paragraph = section.AddParagraph(); //Appends the text to the created paragraph paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company."); MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); stream.Position = 0; @@ -377,10 +392,9 @@ WordDocument document = new WordDocument(); document.Open(fileName); //To-Do some manipulation //To-Do some manipulation -//Creates an instance of memory stream -MemoryStream stream = new MemoryStream(); -//Saves the document to stream +//Saves the document to the client browser document.Save(outputFileName, FormatType.Docx, Response, HttpContentDisposition.Attachment); +document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -390,17 +404,16 @@ Dim document As New WordDocument() document.Open(fileName) 'To-Do some manipulation 'To-Do some manipulation -'Creates an instance of memory stream -Dim stream As New MemoryStream() -'Saves the document to stream +'Saves the document to the client browser document.Save(outputFileName, FormatType.Docx, Response, HttpContentDisposition.Attachment) +document.Close() {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Send-Word-to-client-browser). -N> If you are using [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/) package, then the [Save](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_System_Web_HttpResponse_Syncfusion_DocIO_HttpContentDisposition_) API used in the above sample is not available in it. So, we suggest you to save the document as stream and then download. You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Send-Word-to-client-browser/ASP.NET). +N> If you are using [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/) package, then the [Save](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_System_Web_HttpResponse_Syncfusion_DocIO_HttpContentDisposition_) API used in the above sample is not available in it. So, we suggest saving the document as a stream and then downloading it. You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Send-Word-to-client-browser/ASP.NET). ## Closing a document @@ -430,7 +443,7 @@ using (WordDocument document = new WordDocument()) {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates an empty WordDocument instance WordDocument document = new WordDocument(); -//opens an existing word document through Open method of WordDocument class +//Opens an existing word document through Open method of WordDocument class document.Open(fileName); //To-Do some manipulation //To-Do some manipulation @@ -443,9 +456,9 @@ document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'creates an empty WordDocument instance +'Creates an empty WordDocument instance Dim document As New WordDocument() -'opens an existing word document through Open method of WordDocument class +'Opens an existing word document through Open method of WordDocument class document.Open(fileName) 'To-Do some manipulation 'To-Do some manipulation diff --git a/Document-Processing/Word/Word-Library/NET/NuGet-Packages-Required.md b/Document-Processing/Word/Word-Library/NET/NuGet-Packages-Required.md index b533ae115e..47695ca666 100644 --- a/Document-Processing/Word/Word-Library/NET/NuGet-Packages-Required.md +++ b/Document-Processing/Word/Word-Library/NET/NuGet-Packages-Required.md @@ -8,9 +8,9 @@ documentation: UG # NuGet Packages Required for Word Library -## Installing Syncfusion® DocIO through NuGet Packages +## Installing the Syncfusion® DocIO Library through NuGet Packages -NuGet is the one of the easiest way to download and install DocIO library to read, write and edit the Word documents. The following NuGet packages need to be installed in your application. +NuGet is one of the easiest ways to download and install the DocIO library to read, write, and edit Word documents. The following NuGet packages need to be installed in your application based on the platform.
@@ -157,14 +157,14 @@ Install-Package Syncfusion.Xamarin.DocIO
-N> 1. Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. -N> 2. Syncfusion® components are available in [nuget.org](https://www.nuget.org/) -N> 3. Starting with v17.3.0.x, Syncfusion® provides support to .NET Core 3.0. You can use the above WPF or Windows Forms platform NuGet packages for .NET Core 3.0 targeting applications and use the same "C# tab" code examples for it. +N> 1. Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add the "Syncfusion.Licensing" assembly reference and include a license key in your project. Refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to learn about registering the Syncfusion® license key in your application to use our components. +N> 2. Syncfusion® components are available in [nuget.org](https://www.nuget.org/). +N> 3. Starting with v17.3.0.x, Syncfusion® provides support for .NET Core 3.0. You can use the above WPF or Windows Forms platform NuGet packages for .NET Core 3.0 targeting applications and use the same "C# tab" code examples for it. N> 4. Syncfusion has **deprecated the ASP.NET package**. We strongly recommend upgrading your applications to ASP.NET Core. Refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/migrate-from-net-framework-to-net-core) to migrate from .NET Framework to .NET Core. -## Converting Word document to PDF +## Converting a Word document to PDF -For converting Word document into PDF, the following NuGet packages need to be installed in your application. +For converting a Word document to PDF, the following NuGet packages need to be installed in your application based on the platform. @@ -243,7 +243,7 @@ Install-Package Syncfusion.DocToPdfConverter.AspNet.Mvc5 Syncfusion.DocIORenderer.Net.Core.nupkg

Note:
-Please refer {{'[here](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/linux-faqs#what-are-the-nuget-packages-to-be-installed-to-perform-word-to-pdf-conversion-in-linux-os)'| markdownify }} to know about the NuGet packages that need to be installed to perform Word to PDF conversion in Linux OS.
+Please refer {{'[here](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/linux-faqs#what-are-the-nuget-packages-to-be-installed-to-perform-word-to-pdf-conversion-in-linux-os)'| markdownify }} to learn about the NuGet packages that need to be installed to perform Word to PDF conversion in Linux OS.
Install-Package Syncfusion.DocIORenderer.Net.Core @@ -306,9 +306,9 @@ Install-Package Syncfusion.Xamarin.DocIORenderer
-N> 1. Please refer the procedure to deploy your .NET Core application in Linux OS from [here](https://support.syncfusion.com/kb/article/7626/how-to-deploy-net-core-application-with-word-to-pdf-conversion-capabilities-in-linux-os). -N> 2. From v32.1.19, the dependent package SkiaSharp is upgraded from 3.116.1 to 3.119.1 version and it is mandatory to use SkiaSharp.NativeAssets.Linux v3.119.1 and HarfBuzzSharp.NativeAssets.Linux v8.3.1.2 packages for converting Word documents into PDF in Linux environment. -N> 3. "DocIO supports Word to PDF conversion in UWP application using DocIORenderer." For further information, please refer [here](https://support.syncfusion.com/kb/article/8902/how-to-convert-word-document-to-pdf-in-uwp) +N> 1. Please refer to the procedure to deploy your .NET Core application in Linux OS from [here](https://support.syncfusion.com/kb/article/7626/how-to-deploy-net-core-application-with-word-to-pdf-conversion-capabilities-in-linux-os). +N> 2. From v32.1.19, the dependent package SkiaSharp is upgraded from version 3.116.1 to 3.119.1, and it is mandatory to use SkiaSharp.NativeAssets.Linux v3.119.1 and HarfBuzzSharp.NativeAssets.Linux v8.3.1.2 packages for converting Word documents to PDF in Linux environments. +N> 3. DocIO supports Word to PDF conversion in UWP applications using DocIORenderer. For further information, refer [here](https://support.syncfusion.com/kb/article/8902/how-to-convert-word-document-to-pdf-in-uwp). ### Additional NuGet packages required for Linux @@ -351,9 +351,9 @@ The following table illustrates the native assets NuGet packages and their appli -## Converting Word document to image +## Converting a Word document to an image -For converting Word document into image, the following NuGet packages need to be installed in your application. +For converting a Word document to an image, the following NuGet packages need to be installed in your application based on the platform. @@ -432,7 +432,7 @@ ASP.NET Core, Console Application (Targeting .NET Core) and Blazor Syncfusion.DocIORenderer.Net.Core.nupkg

Note:
-Please refer {{'[here](https://help.syncfusion.com/document-processing/word/word-library/net/faq#what-are-the-nuget-packages-to-be-installed-to-perform-word-to-image-conversion-in-linux-os)'| markdownify }} to know about the NuGet packages that need to be installed to perform Word to Image conversion in Linux OS.
+Please refer {{'[here](https://help.syncfusion.com/document-processing/word/word-library/net/faqs#what-are-the-nuget-packages-to-be-installed-to-perform-word-to-image-conversion-in-linux-os)'| markdownify }} to learn about the NuGet packages that need to be installed to perform Word to image conversion in Linux OS.
- @@ -212,13 +217,15 @@ Download the helper files from this [link](https://www.syncfusion.com/downloads/ -
Install-Package Syncfusion.DocIORenderer.Net.Core @@ -536,7 +536,9 @@ The following table illustrates the native assets NuGet packages and their appli ## Converting Charts -The following NuGet package need to be installed additionally to preserve chart as image in Word to PDF, and Image conversions. +The following NuGet package needs to be installed additionally to preserve charts as images in Word to PDF and image conversions. + +N> For ASP.NET Core, Blazor, UWP, WinUI, and .NET MAUI applications, chart preservation during Word to PDF or image conversion is handled by the corresponding DocIORenderer package (Syncfusion.DocIORenderer.Net.Core or Syncfusion.DocIORenderer.NET). A separate OfficeChartToImageConverter package is not required for these platforms. @@ -631,7 +633,7 @@ Install-Package Syncfusion.OfficeChartToImageConverter.AspNet ## NuGet Package Installation and Uninstallation -To use Syncfusion® NuGet packages in your project, please refer the NuGet Package [Installation](https://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-packages) and [Uninstallation](https://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-uninstallation-process#) sections. +To use Syncfusion® NuGet packages in your project, please refer to the NuGet Package [Installation](https://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-packages) and [Uninstallation](https://help.syncfusion.com/extension/syncfusion-nuget-packages/nuget-uninstallation-process#) sections. DocIO NuGet packages can be installed and uninstalled using Package Manager Console. In Visual Studio, select Tools > NuGet Package Manager > Package Manager Console and execute the following commands. @@ -639,7 +641,7 @@ DocIO NuGet packages can be installed and uninstalled using Package Manager Cons **NuGet Package:** Syncfusion.DocIO.WinForms -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -652,7 +654,7 @@ Uninstall-Package Syncfusion.DocIO.WinForms -RemoveDependencies **NuGet Package:** Syncfusion.DocToPdfConverter.WinForms -The package contains the DocToPdfConverter .NET library that allows you to convert the Word documents to PDF. +The package contains the DocToPdfConverter .NET library that allows you to convert Word documents to PDF. ~~~ // Install package @@ -665,7 +667,7 @@ Uninstall-Package Syncfusion.DocToPdfConverter.WinForms -RemoveDependencies **NuGet Package:** Syncfusion.OfficeChartToImageConverter.WinForms -The package contains OfficeChartToImageConverter .NET library for converting the chart present in word document to image. +The package contains the OfficeChartToImageConverter .NET library for converting the chart present in a Word document to an image. ~~~ // Install package @@ -680,7 +682,7 @@ Uninstall-Package Syncfusion.OfficeChartToImageConverter.WinForms -RemoveDepende **NuGet Package:** Syncfusion.DocIO.Wpf -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -693,7 +695,7 @@ Uninstall-Package Syncfusion.DocIO.Wpf -RemoveDependencies **NuGet Package:** Syncfusion.DocToPdfConverter.Wpf -The package contains the DocToPdfConverter .NET library that allows you to convert the Word documents to PDF. +The package contains the DocToPdfConverter .NET library that allows you to convert Word documents to PDF. ~~~ // Install package @@ -706,7 +708,7 @@ Uninstall-Package Syncfusion.DocToPdfConverter.Wpf -RemoveDependencies **NuGet Package:** Syncfusion.OfficeChartToImageConverter.Wpf -The package contains OfficeChartToImageConverter .NET library for converting the chart present in word document to image. +The package contains the OfficeChartToImageConverter .NET library for converting the chart present in a Word document to an image. ~~~ // Install package @@ -721,7 +723,7 @@ Uninstall-Package Syncfusion.OfficeChartToImageConverter.Wpf -RemoveDependencies **NuGet Package:** Syncfusion.DocIO.AspNet.Mvc4 -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -734,7 +736,7 @@ Uninstall-Package Syncfusion.DocIO.AspNet.Mvc4 -RemoveDependencies **NuGet Package:** Syncfusion.DocToPdfConverter.AspNet.Mvc4 -The package contains the DocToPdfConverter .NET library that allows you to convert the Word documents to PDF. +The package contains the DocToPdfConverter .NET library that allows you to convert Word documents to PDF. ~~~ // Install package @@ -747,7 +749,7 @@ Uninstall-Package Syncfusion.DocToPdfConverter.AspNet.Mvc4 -RemoveDependencies **NuGet Package:** Syncfusion.OfficeChartToImageConverter.AspNet.Mvc4 -The package contains OfficeChartToImageConverter .NET library for converting the chart present in word document to image. +The package contains the OfficeChartToImageConverter .NET library for converting the chart present in a Word document to an image. ~~~ // Install package @@ -762,7 +764,7 @@ Uninstall-Package Syncfusion.OfficeChartToImageConverter.AspNet.Mvc4 -RemoveDepe **NuGet Package:** Syncfusion.DocIO.AspNet.Mvc5 -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -775,7 +777,7 @@ Uninstall-Package Syncfusion.DocIO.AspNet.Mvc5 -RemoveDependencies **NuGet Package:** Syncfusion.DocToPdfConverter.AspNet.Mvc5 -The package contains the DocToPdfConverter .NET library that allows you to convert the Word documents to PDF. +The package contains the DocToPdfConverter .NET library that allows you to convert Word documents to PDF. ~~~ // Install package @@ -788,7 +790,7 @@ Uninstall-Package Syncfusion.DocToPdfConverter.AspNet.Mvc5 -RemoveDependencies **NuGet Package:** Syncfusion.OfficeChartToImageConverter.AspNet.Mvc5 -The package contains OfficeChartToImageConverter .NET library for converting the chart present in word document to image. +The package contains the OfficeChartToImageConverter .NET library for converting the chart present in a Word document to an image. ~~~ // Install package @@ -803,7 +805,7 @@ Uninstall-Package Syncfusion.OfficeChartToImageConverter.AspNet.Mvc5 -RemoveDepe **NuGet Package:** Syncfusion.DocIO.Net.Core -The package contains DocIO portable library that allows you to create, read and edit Word documents. +The package contains the DocIO portable library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -816,7 +818,7 @@ Uninstall-Package Syncfusion.DocIO.Net.Core -RemoveDependencies **NuGet Package:** Syncfusion.DocIORenderer.Net.Core -The package contains the DocIORenderer .NET portable library that allows you to convert the Word documents to PDF. +The package contains the DocIORenderer .NET portable library that allows you to convert Word documents to PDF. ~~~ // Install package @@ -831,7 +833,7 @@ Uninstall-Package Syncfusion.DocIORenderer.Net.Core -RemoveDependencies **NuGet Package:** Syncfusion.DocIO.UWP -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -846,7 +848,7 @@ Uninstall-Package Syncfusion.DocIO.UWP -RemoveDependencies **NuGet Package:** Syncfusion.DocIO.NET -The package contains DocIO library that allows you to create, read and edit Word documents. +The package contains the DocIO library that allows you to create, read, and edit Word documents. ~~~ // Install package @@ -859,7 +861,7 @@ Uninstall-Package Syncfusion.DocIO.NET -RemoveDependencies **NuGet Package:** Syncfusion.DocIORenderer.NET -The package contains the DocIORenderer .NET library that allows you to convert the Word documents to PDF. +The package contains the DocIORenderer .NET library that allows you to convert Word documents to PDF. ~~~ // Install package diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-Save-Word-Document-in-ASP-NET-Core-WEB-API.md b/Document-Processing/Word/Word-Library/NET/Open-and-Save-Word-Document-in-ASP-NET-Core-WEB-API.md index 1cc29367ac..ad06d6dbdf 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-Save-Word-Document-in-ASP-NET-Core-WEB-API.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-Save-Word-Document-in-ASP-NET-Core-WEB-API.md @@ -12,7 +12,7 @@ Syncfusion® DocIO is a [.NET Core Word library](https://www.syncf ## Steps to open and save Word document programmatically: -The below steps illustrate open and save a simple Word document in ASP.NET Core Web API. +The below steps illustrate opening and saving a simple Word document in ASP.NET Core Web API. Step 1: Create a new C# ASP.NET Core Web API project. @@ -22,7 +22,15 @@ Step 2: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/S ![Install Syncfusion.DocIO.Net.Core NuGet Package](ASP-NET-Core-WEB-API-images/Open-and-save-Nuget-package.png) -N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. +N> **Starting with v16.2.0.x**, if you reference Syncfusion® assemblies from the trial setup or from the NuGet feed, you must add a reference to the **Syncfusion.Licensing** assembly and include a valid license key in your application. +N> +N> Install the [Syncfusion.Licensing](https://www.nuget.org/packages/Syncfusion.Licensing) NuGet package and register the license key during application startup. +N> +N> ```csharp +N> Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY"); +N> ``` +N> +N> For more information about generating and registering a license key, refer to the [Syncfusion® licensing documentation](https://help.syncfusion.com/common/essential-studio/licensing/overview). Step 3: Add a new API controller empty file in the project. @@ -42,7 +50,7 @@ using Syncfusion.DocIO.DLS; {% endtabs %} -Step 5: Add a new action method DownloadWordDocument in **ValuesController.cs** and include the below code snippet to Open and save an Word file and download it. +Step 5: Add a new action method DownloadWordDocument in **ValuesController.cs** and include the below code snippet to open and save a Word file and download it. {% tabs %} @@ -120,7 +128,7 @@ Step 1: Create a console application. N> Ensure your ASP.NET Core Web API is running on the specified port before running this client. Adjust the port number if your Web API runs on a different port (check the ASP.NET Core app's launch settings). -Step 2: Add the below code snippet in the **Program.cs** file for accessing the Web API using HTTP requests. +Step 2: Add the below code snippet in the **Program.cs** file for accessing the Web API using HTTP requests. This example uses C# top-level statements with `await` (supported in .NET 6 and later). This method sends a GET request to the Web API endpoint to retrieve and save the generated Word document. @@ -139,7 +147,7 @@ using (HttpClient client = new HttpClient()) // Check if the response is successful if (response.IsSuccessStatusCode) { - // Read the content as a string + // Read the response content as a stream Stream responseBody = await response.Content.ReadAsStreamAsync(); FileStream fileStream = File.Create("../../../Output/Output.docx"); responseBody.CopyTo(fileStream); diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-Core.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-Core.md index 10ae31db44..71a3d4ff71 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-Core.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-Core.md @@ -10,7 +10,7 @@ documentation: UG Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, and edit **Word** documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in ASP.NET Core**. -## Steps to open and save Word document programmatically: +## Steps to open and save Word document programmatically Step 1: Create a new ASP.NET Core Web application (Model-View-Controller) project. @@ -20,7 +20,7 @@ Step 2: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/S ![Install Syncfusion.DocIO.Net.Core NuGet package](ASP-NET-Core_images/Install_Nuget.png) -N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/document-processing/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. Step 3: Include the following namespaces in the HomeController.cs file. @@ -56,14 +56,13 @@ Html.EndForm(); {% endtabs %} -Step 6: Add a new action method **OpenAndSaveDocument** in HomeController.cs and include the below code snippet to **open an existing Word document in ASP.NET Core**. +Step 6: Add a new action method **OpenAndSaveDocument** in HomeController.cs and include the below code snippet to **open an existing Word document in ASP.NET Core**. Place the **Input.docx** file in the project's `wwwroot` folder (or a path accessible to the application) before running. {% tabs %} {% highlight c# tabtitle="C#" %} //Open an existing Word document. WordDocument document = new WordDocument(new FileStream("Input.docx", FileMode.Open, FileAccess.Read), FormatType.Automatic); - {% endhighlight %} {% endtabs %} @@ -94,6 +93,8 @@ Step 8: Add below code example to **save the Word document in ASP.NET Core**. //Save the Word document to MemoryStream. MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); +//Closes the Word document. +document.Close(); stream.Position = 0; //Download Word document in the browser. @@ -102,10 +103,10 @@ return File(stream, "application/msword", "Sample.docx"); {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/ASP.NET-Core) +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/ASP.NET-Core). By executing the program, you will get the **Word document** as follows. -![ASP.Net Core output Word document](ASP-NET-Core_images/OpenAndSaveOutput.png) +![ASP.NET Core output Word document](ASP-NET-Core_images/OpenAndSaveOutput.png) Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-MVC.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-MVC.md index e9c4352e8b..d299e13fd4 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-MVC.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET-MVC.md @@ -10,7 +10,7 @@ documentation: UG Syncfusion® DocIO is a [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to **create, read, and edit Word documents** programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in ASP.NET MVC**. -## Steps to open and save Word document programmatically: +## Steps to open and save Word document programmatically Step 1: Create a new ASP.NET Web application project. @@ -24,7 +24,7 @@ Step 3: Install the [Syncfusion.DocIO.AspNet.Mvc5](https://www.nuget.org/package ![Install Syncfusion.DocIO.AspNet.Mvc5 NuGet package](ASP-NET-MVC_images/Install_Nuget.jpg) -N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/document-processing/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. Step 4: Include the following namespace in that HomeController.cs file. @@ -60,7 +60,7 @@ Html.EndForm(); Step 7: Add a new action method **OpenAndSaveDocument** in HomeController.cs. -Step 8: Add below code example to **open an existing Word document in ASP.NET MVC**. +Step 8: Add below code example to **open an existing Word document in ASP.NET MVC**. Place the **Input.docx** file in the project's root or `App_Data` folder before running. {% tabs %} @@ -95,6 +95,8 @@ Step 10: Add below code example to **save the Word document in ASP.NET MVC**. {% highlight c# tabtitle="C#" %} //Save the Word document and download as attachment. document.Save("Sample.docx", FormatType.Docx, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment); +//Closes the Word document. +document.Close(); {% endhighlight %} {% endtabs %} @@ -103,6 +105,6 @@ You can download a complete working sample from [GitHub](https://github.com/Sync By executing the program, you will get the **Word document** as follows. -![ASP.Net MVC open and save Word document](ASP-NET-MVC_images/OpenAndSaveOutput.png) +![ASP.NET MVC open and save Word document](ASP-NET-MVC_images/OpenAndSaveOutput.png) Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET.md index 415ceafa3b..f2dd9eea3e 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-ASP-NET.md @@ -6,13 +6,13 @@ control: DocIO documentation: UG --- -# Open and Save Word document in ASP.NET +# Open and save Word document in ASP.NET Syncfusion® DocIO is a [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to **create, read, and edit Word documents** programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in ASP.NET Web Forms**. N> This ASP.NET Web Form platform is deprecated, you can use the same product from ASP.NET Core platform. For more information on migrating the .NET Word library from .NET Framework to .NET Core, refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/migrate-from-net-framework-to-net-core). -## Steps to open and save Word document programmatically: +## Steps to open and save Word document programmatically Step 1: Create a new ASP.NET Web application project. @@ -26,7 +26,7 @@ Step 3: Install the [Syncfusion.DocIO.AspNet](https://www.nuget.org/packages/Syn ![Install Syncfusion.DocIO.AspNet NuGet package](ASP-NET_images/Install_Nuget.jpg) -N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/document-processing/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. Step 4: Add a new Web Form in your project. Right click on the project and select **Add > New Item** and add a Web Form from the list. Name it as MainPage. @@ -53,7 +53,7 @@ Step 5: Add a new button in the **MainPage.aspx** as shown below. {% endtabs %} -Step 6. Include the following namespace in your **MainPage.aspx.cs** file. +Step 6: Include the following namespace in your **MainPage.aspx.cs** file. {% tabs %} @@ -66,7 +66,7 @@ using Syncfusion.DocIO.DLS; {% endtabs %} -Step 7: Include the below code snippets in the click event of the button in **MainPage.aspx.cs**, to **open an existing Word document in ASP.NET**. +Step 7: Include the below code snippets in the click event of the button in **MainPage.aspx.cs**, to **open an existing Word document in ASP.NET**. Place the **Input.docx** file in the project's root or `App_Data` folder before running. {% tabs %} @@ -101,6 +101,8 @@ Step 9: Add below code example to **save the Word document in ASP.NET**. {% highlight c# tabtitle="C#" %} //Save the Word document and download as attachment. document.Save("Sample.docx", FormatType.Docx, HttpContext.Current.Response, HttpContentDisposition.Attachment); +//Closes the Word document. +document.Close(); {% endhighlight %} {% endtabs %} @@ -109,6 +111,6 @@ You can download a complete working sample from [GitHub](https://github.com/Sync By executing the program, you will get the **Word document** as follows. -![ASP.Net Web Open and save output Word document](ASP-NET_images/OpenAndSaveOutput.png) +![ASP.NET Web Forms open and save output Word document](ASP-NET_images/OpenAndSaveOutput.png) Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Elastic-Beanstalk.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Elastic-Beanstalk.md index 6d80ea3a37..c68056030c 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Elastic-Beanstalk.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Elastic-Beanstalk.md @@ -41,7 +41,7 @@ Step 5: Add a new button in the **Index.cshtml** as shown below. {% highlight c# tabtitle="C#" %} @{ - Html.BeginForm("CreateWordDocument", "Home", FormMethod.Get); + Html.BeginForm("OpenAndSaveDocument", "Home", FormMethod.Get); {
diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Lambda.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Lambda.md index 32a4d91460..891950d0a5 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Lambda.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-Lambda.md @@ -40,7 +40,7 @@ using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} -step 7: Add the following code snippet in **Function.cs** to **open a Word document in AWS Lambda**. +Step 7: Add the following code snippet in **Function.cs** to **open a Word document in AWS Lambda**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -91,12 +91,12 @@ Step 11: Create a new AWS profile in the Upload Lambda Function Window. After cr ![Upload Lambda Function](AWS_Images/Lambda_Images/Upload-Lampda-WordtoPDF.png) Step 12: In the Advanced Function Details window, specify the **Role Name** as based on AWS Managed policy. After selecting the role, click the **Upload** button to deploy your application. -![Advance Function Details](AWS_Images/Lambda_Images/Advanced-AWS-WordtoPDF.png) +![Advanced Function Details](AWS_Images/Lambda_Images/Advanced-AWS-WordtoPDF.png) Step 13: After deploying the application, you can see the published Lambda function in **AWS console**. ![After deploying the application](AWS_Images/Lambda_Images/Function-WordtoPDF.png) -Step 14: Edit Memory size and Timeout as maximum in General configuration of the AWS Lambda function. +Step 14: Increase the **Memory size** and **Timeout** values in the General configuration of the AWS Lambda function, as needed for your workload. ![AWS Lambda Function](AWS_Images/Lambda_Images/General-configuration-WordtoPDF.png) ## Steps to post the request to AWS Lambda @@ -104,7 +104,7 @@ Step 14: Edit Memory size and Timeout as maximum in General configuration of the Step 1: Create a new console project. ![Create a console project](AWS_Images/Lambda_Images/Console-APP-WordtoPDF.png) -step 2: Install the following **Nuget packages** in your application from [Nuget.org](https://www.nuget.org/). +Step 2: Install the following **NuGet packages** in your application from [NuGet.org](https://www.nuget.org/). * [AWSSDK.Core](https://www.nuget.org/packages/AWSSDK.Core/) * [AWSSDK.Lambda](https://www.nuget.org/packages/AWSSDK.Lambda/) @@ -122,6 +122,8 @@ using Amazon; using Amazon.Lambda; using Amazon.Lambda.Model; using Newtonsoft.Json; +using System.IO; +using System.Diagnostics; {% endhighlight %} {% endtabs %} @@ -132,7 +134,7 @@ Step 4: Add the following code snippet in **Program.cs** to invoke the published {% highlight c# tabtitle="C#" %} //Create a new AmazonLambdaClient -AmazonLambdaClient client = new AmazonLambdaClient("awsaccessKeyID", "awsSecreteAccessKey", RegionEndpoint.USEast2); +AmazonLambdaClient client = new AmazonLambdaClient("awsAccessKeyID", "awsSecretAccessKey", RegionEndpoint.USEast2); //Create new InvokeRequest with published function name. InvokeRequest invoke = new InvokeRequest { @@ -145,12 +147,12 @@ InvokeResponse response = client.Invoke(invoke); //Read the response stream var stream = new StreamReader(response.Payload); JsonReader reader = new JsonTextReader(stream); -var serilizer = new JsonSerializer(); -var responseText = serilizer.Deserialize(reader); +var serializer = new JsonSerializer(); +var responseText = serializer.Deserialize(reader); //Convert Base64String into Word document byte[] bytes = Convert.FromBase64String(responseText.ToString()); -FileStream fileStream = new FileStream("Sample.docx", FileMode.Create); -BinaryWriter writer = new BinaryWriter(fileStream); +using FileStream fileStream = new FileStream("Sample.docx", FileMode.Create); +using BinaryWriter writer = new BinaryWriter(fileStream); writer.Write(bytes, 0, bytes.Length); writer.Close(); System.Diagnostics.Process.Start("Sample.docx"); diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-S3-Cloud-Storage.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-S3-Cloud-Storage.md index b6cc75870d..e123786b2f 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-S3-Cloud-Storage.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS-S3-Cloud-Storage.md @@ -1,6 +1,6 @@ --- title: Open and save Word document in AWS S3 Cloud Storage | Syncfusion -description: Open and save Word document in AWS S3 Cloud Storage using Syncfusion® .NET Core Word (DocIO) library without Microsoft Word or interop dependencies. +description: Open and save Word document in AWS S3 Cloud Storage using Syncfusion® Word library without Microsoft Word or interop dependencies. platform: document-processing control: DocIO documentation: UG @@ -11,6 +11,8 @@ documentation: UG ## Prerequisites * **[AWS S3 Cloud Storage](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html)** is required. +* An active **Amazon Web Services (AWS) account** with access to an S3 bucket. Store your access key ID and secret access key securely (for example, via [environment variables](https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/creds-idc.html) or the AWS profiles file); avoid hard-coding them in source code. +* The Word template file (for example, `WordTemplate.docx`) must already be uploaded to your S3 bucket before running the **Open** sample. ## Open Word document from AWS S3 @@ -52,6 +54,7 @@ Step 5: Include the following namespaces in **HomeController.cs**. {% tabs %} {% highlight c# tabtitle="C#" %} using Amazon.S3; +using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} @@ -499,10 +502,9 @@ public async Task UploadDocumentToS3(MemoryStream stream) } catch (Exception e) { - Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message); + Console.WriteLine("Unknown error encountered on server. Message:'{0}' when writing an object", e.Message); } } - return stream; } {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS.md index c3becea4fe..c4c89be671 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-AWS.md @@ -16,7 +16,7 @@ N> If this is your first time working with Amazon Web Services (AWS), please ref * An active **Amazon Web Services (AWS) account** is required. If you don’t have one, please [create an account](https://aws.amazon.com/) before starting. -* Download and install the **AWS Toolkit** for Visual Studio, you can download the AWS toolkit from this [link](https://aws.amazon.com/visualstudio/). The Toolkit can be installed from Tools/Extension and updates options in Visual Studio. +* Download and install the **AWS Toolkit** for Visual Studio, you can download the AWS toolkit from this [link](https://aws.amazon.com/visualstudio/). The Toolkit can be installed from the **Tools > Extensions and Updates** options in Visual Studio. ## Amazon Web Services (AWS) @@ -26,6 +26,7 @@ N> If this is your first time working with Amazon Web Services (AWS), please ref
+ + + +
Amazon Web Services (AWS)
NuGet package name
{{'[AWS Lambda](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-aws-lambda)' | markdownify}}
@@ -33,6 +34,13 @@ NuGet package name
-{{'[AWS Elastic Beanstalk](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-aws-elastic-beanstalk)' | markdownify}}
+{{'[AWS Elastic Beanstalk](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-aws-elastic-beanstalk)' | markdownify}}
{{'[Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)' | markdownify}}
+
+{{'[AWS S3 Cloud Storage](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-aws-s3-cloud-storage)' | markdownify}}
+{{'[Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)' | markdownify}}
+
diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Linux.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Linux.md index 9c75060468..35363531ac 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Linux.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Linux.md @@ -8,9 +8,9 @@ documentation: UG # Open and save Word document in Azure App Service on Linux -Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save Word document in Azure App Service on Linux**. +Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Azure App Service on Linux**. -## Steps to open and save Word document in Azure App Service on Linux +## Steps to open and save a Word document in Azure App Service on Linux Step 1: Create a new ASP.NET Core Web App (Model-View-Controller). ![Create a ASP.NET Core Web App project](Azure-Images/App-Service-Linux/Create-Project-WordtoPDF.png) @@ -63,13 +63,13 @@ Step 7: Add a new action method **OpenAndSaveDocument** in HomeController.cs and {% highlight c# tabtitle="C#" %} string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "Data/Input.docx"); -using (FileStream docStream1 = new FileStream(filePath, FileMode.Open, FileAccess.Read)); -using (WordDocument document = new WordDocument(docStream, FormatType.Docx)); +using FileStream docStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); +using WordDocument document = new WordDocument(docStream, FormatType.Docx); {% endhighlight %} {% endtabs %} -Step 8: Add below code example to add a paragraph in the Word document. +Step 8: Add the below code example to add a paragraph in the Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -87,7 +87,7 @@ textRange.CharacterFormat.FontSize = 12f; {% endhighlight %} {% endtabs %} -Step 9: Add below code example to **save the Word document**. +Step 9: Add the below code example to **save the Word document**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -97,7 +97,7 @@ MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); stream.Position = 0; //Download Word document in the browser. -return File(stream, "application/msword", "Sample.docx"); +return File(stream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Sample.docx"); {% endhighlight %} {% endtabs %} @@ -131,13 +131,13 @@ Step 8: Click **Close** button. Step 9: Click the **Publish** button. ![Click the Publish button](Azure-Images/App-Service-Linux/Before-Publish-Open-and-Save-Word-Document.png) -Step 10: Now, Publish has been succeeded. +Step 10: Publish has succeeded. ![Publish has been succeeded](Azure-Images/App-Service-Linux/After-Publish-Open-and-Save-Word-Document.png) Step 11: Now, the published webpage will open in the browser. ![Browser will open after publish](Azure-Images/App-Service-Windows/Browser-Open-and-Save-Word-Document.png) -Step 12: Click **Open and Save Document** button.You will get the output **Word document** as follows. +Step 12: Click the **Open and Save Document** button. You will get the output **Word document** as follows. ![Open and Save Word document in Azure App Service on Linux](ASP-NET-Core_images/OpenAndSaveOutput.png) diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Windows.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Windows.md index da2a985956..eca308b369 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Windows.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-App-Service-Windows.md @@ -8,9 +8,9 @@ documentation: UG # Open and save Word document in Azure App Service on Windows -Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save Word document in Azure App Service on Windows**. +Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Azure App Service on Windows**. -## Steps to open and save Word document in Azure App Service on Windows +## Steps to open and save a Word document in Azure App Service on Windows Step 1: Create a new ASP.NET Core Web App (Model-View-Controller). ![Create a ASP.NET Core Web App project](Azure-Images/App-Service-Linux/Create-Project-WordtoPDF.png) @@ -63,13 +63,13 @@ Step 7: Add a new action method **OpenAndSaveDocument** in HomeController.cs and {% highlight c# tabtitle="C#" %} string filePath = Path.Combine(_hostingEnvironment.WebRootPath, "Data/Input.docx"); -using (FileStream docStream1 = new FileStream(filePath, FileMode.Open, FileAccess.Read)); -using (WordDocument document = new WordDocument(docStream, FormatType.Docx)); +using FileStream docStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); +using WordDocument document = new WordDocument(docStream, FormatType.Docx); {% endhighlight %} {% endtabs %} -Step 8: Add below code example to add a paragraph in the Word document. +Step 8: Add the below code example to add a paragraph in the Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -97,7 +97,7 @@ MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); stream.Position = 0; //Download Word document in the browser. -return File(stream, "application/msword", "Sample.docx"); +return File(stream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "Sample.docx"); {% endhighlight %} {% endtabs %} @@ -131,13 +131,13 @@ Step 8: Click **Close** button. Step 9: Click the **Publish** button. ![Click the Publish button](Azure-Images/App-Service-Windows/Before-Publish-Open-and-Save-Word-Document.png) -Step 10: Now, Publish has been succeeded. +Step 10: Publish has succeeded. ![Publish has been succeeded](Azure-Images/App-Service-Windows/After-Publish-Open-and-Save-Word-Document.png) Step 11: Now, the published webpage will open in the browser. ![Browser will open after publish](Azure-Images/App-Service-Windows/Browser-Open-and-Save-Word-Document.png) -Step 12: Click **Open and Save Document** button.You will get the output **Word document** as follows. +Step 12: Click the **Open and Save Document** button. You will get the output **Word document** as follows. ![Open and Save Word document in Azure App Service on Windows](ASP-NET-Core_images/OpenAndSaveOutput.png) diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Blob-Cloud-Storage.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Blob-Cloud-Storage.md index 5f3cce0821..5f9be71370 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Blob-Cloud-Storage.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Blob-Cloud-Storage.md @@ -1,6 +1,6 @@ --- title: Open and save Word document in Azure Blob Cloud Storage | Syncfusion -description: Open and save Word document in Azure Blob Cloud Storage using Syncfusion® .NET Core Word (DocIO) library without Microsoft Word or interop dependencies. +description: Open and save Word document in Azure Blob Cloud Storage using Syncfusion® Word library without Microsoft Word or interop dependencies. platform: document-processing control: DocIO documentation: UG @@ -10,9 +10,9 @@ documentation: UG ## Prerequisites -* **[Microsoft Azure subscription](https://portal.azure.com/#home)** is required. +* An active **[Microsoft Azure subscription](https://portal.azure.com/#home)** is required. -* **[Azure Cloud Storage](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&tabs=azure-portal)** is required. +* An **[Azure Storage account](https://learn.microsoft.com/en-us/azure/storage/common/storage-account-create?toc=%2Fazure%2Fstorage%2Fblobs%2Ftoc.json&tabs=azure-portal)** is required. ## Open Word document from Azure Blob @@ -55,6 +55,7 @@ Step 5: Include the following namespaces in **HomeController.cs**. {% highlight c# tabtitle="C#" %} using Azure.Storage.Blobs.Models; using Azure.Storage.Blobs; +using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} @@ -85,7 +86,7 @@ public async Task EditDocument() paragraph.BreakCharacterFormat.FontSize = 12f; //Add new text to the paragraph - IWTextRange textRange = paragraph.AppendText("In 2000, AdventureWorks Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the AdventureWorks Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as IWTextRange; + IWTextRange textRange = paragraph.AppendText("In 2000, Adventure Works Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the Adventure Works Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as IWTextRange; textRange.CharacterFormat.FontSize = 12f; //Saving the Word document to a MemoryStream @@ -93,7 +94,7 @@ public async Task EditDocument() wordDocument.Save(outputStream, Syncfusion.DocIO.FormatType.Docx); //Download the Word file in the browser - FileStreamResult fileStreamResult = new FileStreamResult(outputStream, "application/msword"); + FileStreamResult fileStreamResult = new FileStreamResult(outputStream, "application/vnd.openxmlformats-officedocument.wordprocessingml.document"); fileStreamResult.FileDownloadName = "EditWord.docx"; return fileStreamResult; } @@ -469,10 +470,10 @@ public async Task UploadDocumentToAzure(MemoryStream stream) //Name of the Azure Blob Storage container string containerName = "Your_container_name"; - //Name of the Word file you want to load + //Name of the Word file you want to save string blobName = "CreateWord.docx"; - //Download the Word document from Azure Blob Storage + //Upload the Word document to Azure Blob Storage BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString); BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName); BlobClient blobClient = containerClient.GetBlobClient(blobName); @@ -482,9 +483,8 @@ public async Task UploadDocumentToAzure(MemoryStream stream) } catch (Exception e) { - Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message); + Console.WriteLine("Error encountered when writing an object: {0}", e.Message); } - return stream; } {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-Flex-Consumption.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-Flex-Consumption.md index 014a1436da..b5e58f472b 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-Flex-Consumption.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-Flex-Consumption.md @@ -8,7 +8,7 @@ documentation: UG # Open and save Word document in Azure Functions (Flex Consumption) -Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit, and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **Open and save Word document in Azure Functions deployed on Flex (Consumption) plan**. +Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit, and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Azure Functions deployed on the Flex (Consumption) plan**. ## Steps to Open and save Word document in Azure Functions (Flex Consumption) @@ -18,7 +18,7 @@ Step 1: Create a new Azure Functions project. Step 2: Create a project name and select the location. ![Create a project name](Azure-Images/Functions-Flex-Consumption/Configuration-Open-and-Save-Word-Document.png) -Step 3: Select function worker as **.NET 8.0 (Long Term Support)** (isolated worker) and target Flex/Consumption hosting suitable for isolated worker. +Step 3: Select the function worker as **.NET 8.0 (Long Term Support)** and the isolated worker model. Target the **Flex Consumption** hosting plan (suitable for isolated worker). ![Select function worker](Azure-Images/Functions-Flex-Consumption/Additional_Information_Word_Document.png) Step 4: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). @@ -38,7 +38,7 @@ using Syncfusion.DocIO.DLS; {% endtabs %} -Step 6: Add the following code snippet in **Run** method of **Function1** class to perform **Open and save Word document** in Azure Functions and return the resultant **Word document** to client end. +Step 6: Add the following code snippet in the **Run** method of the **Function1** class to **open and save a Word document** in Azure Functions and return the resultant **Word document** to the client end. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -105,24 +105,24 @@ Step 10: Select the **Create new** button. Step 11: Click **Create** button. ![Select the plan type](Azure-Images/Functions-Flex-Consumption/Hosting_Word_Document.png) -Step 12: After creating app service then click **Finish** button. +Step 12: After creating the app service, click the **Finish** button. ![Creating app service](Azure-Images/Functions-Flex-Consumption/Finish_Word_Document.png) Step 13: Click the **Publish** button. ![Click Publish Button](Azure-Images/Functions-Flex-Consumption/Before_Publish_Word_Document.png) -Step 14: Publish has been succeed. +Step 14: Publish has succeeded. ![Publish succeeded](Azure-Images/Functions-Flex-Consumption/After_Publish_Word_Document.png) -Step 15: Now, go to Azure portal and select the App Services. After running the service, click **Get function URL by copying it**. Then, paste it in the below client sample (which will request the Azure Functions, to perform **Open and save a Word document** using the template Word document). You will get the output Word document as follows. +Step 15: Now, go to the Azure portal and select the App Services. After running the service, click **Get function URL** by copying it. Then, paste it in the below client sample (which will request the Azure Functions, to perform **open and save a Word document** using the template Word document). You will get the output Word document as follows. -![Open and Save in Azure Functions v4](ASP-NET-Core_images/OpenAndSaveOutput.png) +![Open and Save in Azure Functions Flex Consumption](ASP-NET-Core_images/OpenAndSaveOutput.png) ## Steps to post the request to Azure Functions Step 1: Create a console application to request the Azure Functions API. -Step 2: Add the following code snippet into Main method to post the request to Azure Functions with template Word document and get the resultant Word document. +Step 2: Add the following code snippet into the **Main** method to post the request to Azure Functions with the template Word document and get the resultant Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -147,7 +147,7 @@ static async Task Main() var resBytes = await res.Content.ReadAsByteArrayAsync(); // Extract the media type from the response headers string mediaType = res.Content.Headers.ContentType?.MediaType ?? string.Empty; - // Decide the output file path the response is an image or txt + // Decide the output file path: the response is a Word document or an error text string outputPath = mediaType.Contains("word", StringComparison.OrdinalIgnoreCase) || mediaType.Contains("officedocument", StringComparison.OrdinalIgnoreCase) || mediaType.Equals("application/vnd.openxmlformats-officedocument.wordprocessingml.document", StringComparison.OrdinalIgnoreCase) diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v1.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v1.md index b679313ba8..4cc3a237a2 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v1.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v1.md @@ -8,7 +8,7 @@ documentation: UG # Open and save Word document in Azure Functions v1 -Syncfusion® DocIO is a [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save Word document in Azure Functions v1**. +Syncfusion® DocIO is a [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Azure Functions v1**. ## Steps to open and save Word document in Azure Functions v1 @@ -37,7 +37,7 @@ using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} -Step 6: Add the following code snippet in **Run** method of **Function1** class to perform ***open an existing Word document**. +Step 6: Add the following code snippet in the **Run** method of the **Function1** class to **open an existing Word document**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -45,12 +45,12 @@ Step 6: Add the following code snippet in **Run** method of **Function1** class //Gets the input Word document as stream from request Stream stream = req.Content.ReadAsStreamAsync().Result; //Loads an existing Word document -using WordDocument document = new WordDocument(stream); +using WordDocument document = new WordDocument(stream, Syncfusion.DocIO.FormatType.Docx); {% endhighlight %} {% endtabs %} -Step 7: Add below code example to add a paragraph in the Word document. +Step 7: Add the below code example to add a paragraph in the Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -67,7 +67,7 @@ text.CharacterFormat.FontSize = 12f; {% endhighlight %} {% endtabs %} -Step 8: Add below code example to **save the Word document**. +Step 8: Add the below code example to **save the Word document**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -87,7 +87,7 @@ response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue( FileName = "Sample.docx" }; //Set the content type as Word document mime type. -response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/docx"); +response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); //Return the response with output Word document stream. return response; @@ -106,16 +106,16 @@ Step 11: Select the **Create new** button. Step 12: Click **Create** button. ![Select the plan type](Azure-Images/Functions-v1/Subscription-Open-and-Save-Word-Document.png) -Step 13: After creating app service then click **Finish** button. +Step 13: After creating the app service, click the **Finish** button. ![Creating app service](Azure-Images/Functions-v1/App-service-Created-Open-and-Save-Word-Document.png) Step 14: Click the **Publish** button. ![Click Publish Button](Azure-Images/Functions-v1/Before-Publish-Open-and-Save-Word-Document.png) -Step 15: Publish has been succeed. +Step 15: Publish has succeeded. ![Publish succeeded](Azure-Images/Functions-v1/After-Publish-Open-and-Save-Word-Document.png) -Step 16: Now, go to Azure portal and select the App Services. After running the service, click **Get function URL by copying it**. Then, paste it in the below client sample (which will request the Azure Functions, to perform **open and save Word document**. You will get the output Word document as follows. +Step 16: Now, go to the Azure portal and select the App Services. After running the service, click **Get function URL** by copying it. Then, paste it in the below client sample (which will request the Azure Functions, to perform **open and save Word document**). You will get the output Word document as follows. ![Open and Save in Azure Functions v1](ASP-NET-Core_images/OpenAndSaveOutput.png) @@ -123,7 +123,7 @@ Step 16: Now, go to Azure portal and select the App Services. After running the Step 1: Create a console application to request the Azure Functions API. -Step 2: Add the following code snippet into **Main** method to post the request to Azure Functions with template Word document and get the resultant Word document. +Step 2: Add the following code snippet into the **Main** method to post the request to Azure Functions with the template Word document and get the resultant Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -149,7 +149,7 @@ try //Write the Word document stream into request stream. stream.Write(inputStream.ToArray(), 0, inputStream.ToArray().Length); - //Gets the responce from the Azure Functions. + //Gets the response from the Azure Functions. HttpWebResponse res = (HttpWebResponse)req.GetResponse(); //Saves the Word document stream. diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v4.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v4.md index fe73de5d6d..691f0ce43e 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v4.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure-Functions-v4.md @@ -8,7 +8,7 @@ documentation: UG # Open and save Word document in Azure Functions v4 -Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save Word document in Azure Functions v4**. +Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Azure Functions v4**. ## Steps to open and save Word document in Azure Functions v4 @@ -18,7 +18,7 @@ Step 1: Create a new Azure Functions project. Step 2: Create a project name and select the location. ![Create a project name](Azure-Images/Functions-v1/Configuration-Open-and-Save-Word-Document.png) -Step 3: Select function worker as **.NET 8.0(Long Term Support)**. +Step 3: Select function worker as **.NET 8.0 (Long Term Support)**. ![Select function worker](Azure-Images/Functions-v4/Additional-Information-WordtoPDF.png) Step 4: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). @@ -37,7 +37,7 @@ using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} -Step 6: Add the following code snippet in **Run** method of **Function1** class to perform ***open an existing Word document**. +Step 6: Add the following code snippet in the **Run** method of the **Function1** class to **open an existing Word document**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -45,12 +45,12 @@ Step 6: Add the following code snippet in **Run** method of **Function1** class //Gets the input Word document as stream from request Stream stream = req.Content.ReadAsStreamAsync().Result; //Loads an existing Word document -using WordDocument document = new WordDocument(stream,FormatType.Docx); +using WordDocument document = new WordDocument(stream, FormatType.Docx); {% endhighlight %} {% endtabs %} -Step 7: Add below code example to add a paragraph in the Word document. +Step 7: Add the below code example to add a paragraph in the Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -67,12 +67,12 @@ text.CharacterFormat.FontSize = 12f; {% endhighlight %} {% endtabs %} -Step 8: Add below code example to **save the Word document**. +Step 8: Add the below code example to **save the Word document**. {% tabs %} {% highlight c# tabtitle="C#" %} - MemoryStream memoryStream = new MemoryStream(); +MemoryStream memoryStream = new MemoryStream(); //Saves the Word document file. document.Save(memoryStream, FormatType.Docx); //Reset the memory stream position. @@ -87,7 +87,7 @@ response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue( FileName = "Sample.docx" }; //Set the content type as Word document mime type. -response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/docx"); +response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); //Return the response with output Word document stream. return response; @@ -106,16 +106,16 @@ Step 11: Select the **Create new** button. Step 12: Click **Create** button. ![Select the plan type](Azure-Images/Functions-v1/Subscription-Open-and-Save-Word-Document.png) -Step 13: After creating app service then click **Finish** button. +Step 13: After creating the app service, click the **Finish** button. ![Creating app service](Azure-Images/Functions-v1/App-service-Created-Open-and-Save-Word-Document.png) Step 14: Click the **Publish** button. ![Click Publish Button](Azure-Images/Functions-v1/Before-Publish-Open-and-Save-Word-Document.png) -Step 15: Publish has been succeed. +Step 15: Publish has succeeded. ![Publish succeeded](Azure-Images/Functions-v1/After-Publish-Open-and-Save-Word-Document.png) -Step 16: Now, go to Azure portal and select the App Services. After running the service, click **Get function URL by copying it**. Then, paste it in the below client sample (which will request the Azure Functions, to perform **open and save Word document**. You will get the output Word document as follows. +Step 16: Now, go to the Azure portal and select the App Services. After running the service, click **Get function URL** by copying it. Then, paste it in the below client sample (which will request the Azure Functions, to perform **open and save Word document**). You will get the output Word document as follows. ![Open and Save in Azure Functions v4](ASP-NET-Core_images/OpenAndSaveOutput.png) @@ -123,7 +123,7 @@ Step 16: Now, go to Azure portal and select the App Services. After running the Step 1: Create a console application to request the Azure Functions API. -Step 2: Add the following code snippet into **Main** method to post the request to Azure Functions with template Word document and get the resultant Word document. +Step 2: Add the following code snippet into the **Main** method to post the request to Azure Functions with the template Word document and get the resultant Word document. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -149,7 +149,7 @@ try //Write the Word document stream into request stream. stream.Write(inputStream.ToArray(), 0, inputStream.ToArray().Length); - //Gets the responce from the Azure Functions. + //Gets the response from the Azure Functions. HttpWebResponse res = (HttpWebResponse)req.GetResponse(); //Saves the Word document stream. diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure.md index 334e1d6e44..c42373ee32 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Azure.md @@ -10,10 +10,12 @@ documentation: UG Syncfusion® Essential® DocIO is a [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit, and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, **open and save a Word document in Azure services** within a few lines of code. -N> If this is your first time working with Azure, please refer to the dedicated Azure development resources. This section explains how to open and save a Word document in C# using the .NET Word (DocIO) library in Azure. +N> If this is your first time working with Azure, please refer to the dedicated [Azure development resources](https://learn.microsoft.com/en-us/dotnet/azure/). This section explains how to open and save a Word document in C# using the .NET Word (DocIO) library in Azure. ## Prerequisites -* An active **Microsoft Azure subscription** is required. If you don’t have one, please create a free account before starting. +* An active **Microsoft Azure subscription** is required. If you don't have one, please create a [free account](https://azure.microsoft.com/free/) before starting. + +N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from the trial setup or from the NuGet feed, you also have to add the "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering the Syncfusion® license key in your application to use our components. ## Azure Services @@ -37,6 +39,10 @@ NuGet package name
{{'[Syncfusion.DocIO.AspNet](https://www.nuget.org/packages/Syncfusion.DocIO.AspNet)' | markdownify}}
+ +
-{{'[Azure Functions v4](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-azure-functions-v4)' | markdownify}}
+{{'[Azure Functions v4 (In-process)](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-azure-functions-v4)' | markdownify}}
{{'[Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)' | markdownify}}
+{{'[Azure Functions (Flex Consumption)](https://help.syncfusion.com/document-processing/word/word-library/net/open-and-save-word-document-in-azure-functions-flex-consumption)' | markdownify}}
+{{'[Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)' | markdownify}}
diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Blazor.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Blazor.md index ac8f084677..378162a3cb 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Blazor.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Blazor.md @@ -8,7 +8,7 @@ documentation: UG # Open and Save Word Document in Blazor -Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, and edit **Word** documents programmatically without **Microsoft Word** or interop dependencies. Using this library, a **open and save a Word document in Blazor**. +Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, and edit **Word** documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in Blazor**. ## Blazor Web App Server Application @@ -154,6 +154,9 @@ Create a new class file named `FileUtils` in the project and add the following c {% highlight c# tabtitle="C#" %} +using Microsoft.JSInterop; +using System.Threading.Tasks; + public static class FileUtils { public static ValueTask SaveAs(this IJSRuntime js, string filename, byte[] data) @@ -168,7 +171,7 @@ public static class FileUtils Step 11: Add JavaScript function to `App.razor`. -Add the following JavaScript function in the `App.razor` file located in the `Pages` folder. +Add the following JavaScript function in the `App.razor` file located in the `Components` folder. {% tabs %} @@ -211,7 +214,7 @@ Add the following code snippet to the Navigation menu's Razor file in the `Layou @@ -294,7 +297,7 @@ Add the following code to create a new button that triggers document processing: {% highlight CSHTML %}

Syncfusion DocIO Library (DocIO)

-

The Syncfusion Blazor DocIO library (DocIO) used to create, read, edit, and convert DocIO files in applications without Microsoft Office dependencies.

+

The Syncfusion Blazor DocIO library (DocIO) is used to create, read, edit, and convert Word files in applications without Microsoft Office dependencies.

{% endhighlight %} @@ -364,6 +367,9 @@ Create a new class file named `FileUtils` in the project and add the following c {% highlight c# tabtitle="C#" %} +using Microsoft.JSInterop; +using System.Threading.Tasks; + public static class FileUtils { public static ValueTask SaveAs(this IJSRuntime js, string filename, byte[] data) @@ -420,7 +426,7 @@ Add the following code snippet to the Navigation menu's Razor file in the `Layou {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Console-application.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Console-application.md index 4a24fbf171..5437c8aeaa 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Console-application.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Console-application.md @@ -12,7 +12,12 @@ Syncfusion® DocIO is a [.NET Word library](https://www.syncfusion ## Open and save Word document using .NET Core and Latest -The below steps illustrates open and save **Word document** in console application using **.NET Core**. +The below steps illustrate how to open and save a **Word document** in a console application using **.NET Core**. + +**Prerequisites:** + +* Visual Studio 2022. +* Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later. Step 1: Create a new **.NET Core console application** project. ![Create a Console application in Visual Studio](Console-Images/NET/Console-Template-Net-Core.png) @@ -77,7 +82,7 @@ using (FileStream outputStream = new FileStream("Result.docx", FileMode.Create, {% endhighlight %} {% endtabs %} -You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/.NET-Standard). +You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/.NET). By executing the program, you will get the **Word document** as follows. @@ -85,12 +90,17 @@ By executing the program, you will get the **Word document** as follows. ## Open and save Word document in .NET Framework -The below steps illustrates open and save **Word document** in console application using **.NET Framework**. +The below steps illustrate how to open and save a **Word document** in a console application using **.NET Framework**. + +**Prerequisites:** + +* Visual Studio 2022. +* .NET Framework 4.6.2 or later. -Step 1: Create a new **.NET FrameWork console application** project. +Step 1: Create a new **.NET Framework console application** project. ![Create a Console application in Visual Studio](Console-Images/NET-FrameWork/Console-Template-Net-FrameWork.png) -Step 2: Install [Syncfusion.DocIO.WinForms](https://www.nuget.org/packages/Syncfusion.DocIO.WinForms/) NuGet package as a reference to your Windows Forms application from the [NuGet.org](https://www.nuget.org/). +Step 2: Install [Syncfusion.DocIO.WinForms](https://www.nuget.org/packages/Syncfusion.DocIO.WinForms/) NuGet package as a reference to your .NET Framework application from the [NuGet.org](https://www.nuget.org/). ![Install Syncfusion.DocIO.WinForms NuGet package](Console-Images/NET-FrameWork/Nuget-Package-NET-FrameWork.png) @@ -108,7 +118,7 @@ using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} -Step 4: Add the following code snippet in **Program.cs** file to **open an existing Word document in .NET FrameWork console application**. +Step 4: Add the following code snippet in **Program.cs** file to **open an existing Word document in .NET Framework console application**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -136,7 +146,7 @@ text.CharacterFormat.FontSize = 12f; {% endhighlight %} {% endtabs %} -Step 6: Add below code example to **save the Word document in .NET FrameWork console application**. +Step 6: Add below code example to **save the Word document in .NET Framework console application**. {% tabs %} {% highlight c# tabtitle="C#" %} @@ -151,4 +161,4 @@ You can download a complete working sample from [GitHub](https://github.com/Sync By executing the program, you will get the **Word document** as follows. -![Output Word document in .NET FrameWork console application](Blazor_Images/Blazor_Output.png) \ No newline at end of file +![Output Word document in .NET Framework console application](Blazor_Images/Blazor_Output.png) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-DropBox-Cloud-Storage.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-DropBox-Cloud-Storage.md index 0b1cb23f29..ee71f80f32 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-DropBox-Cloud-Storage.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-DropBox-Cloud-Storage.md @@ -34,8 +34,8 @@ Step 3: Install the following **Nuget packages** in your application from [NuGet Step 4: Add a new button in the **Index.cshtml** as shown below. -{% tabs %} -{% highlight CSHTML %} +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} @{Html.BeginForm("EditDocument", "Home", FormMethod.Get); {
@@ -176,8 +176,8 @@ Step 3: Install the following **Nuget packages** in your application from [NuGet Step 4: Add a new button in the **Index.cshtml** as shown below. -{% tabs %} -{% highlight CSHTML %} +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} @{Html.BeginForm("UploadDocument", "Home", FormMethod.Get); {
@@ -193,8 +193,8 @@ Step 5: Include the following namespaces in **HomeController.cs**. {% tabs %} {% highlight c# tabtitle="C#" %} -using Dropbox.Api.Files; using Dropbox.Api; +using Dropbox.Api.Files; using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} @@ -436,6 +436,7 @@ public async Task UploadDocument() //Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); + document.Close(); //Upload the document to Dropbox await UploadDocumentToDropBox(stream); @@ -474,7 +475,6 @@ public async Task UploadDocumentToDropBox(MemoryStream stream) } Console.WriteLine("Upload completed successfully"); } - catch (Exception e) { Console.WriteLine("Unknown encountered on server. Message:'{0}' when writing an object", e.Message); diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-App-Engine.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-App-Engine.md index f6127b4000..09a1b6cf77 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-App-Engine.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-App-Engine.md @@ -39,10 +39,10 @@ Step 1: Open Visual Studio and select the ASP.NET Core Web app (Model-View-Contr ![Create ASP.NET Core Web application in Visual Studio](ASP-NET-Core_images/CreateProjectforConversion.png) Step 2: Configure your new project according to your requirements. -![Create ASP.NET Core Web application in Visual Studio](GCP_Images/Configuration-Open-and-Save-Word-Document.png) +![Configure the new project](GCP_Images/Configuration-Open-and-Save-Word-Document.png) Step 3: Click the **Create** button. -![Create ASP.NET Core Web application in Visual Studio](GCP_Images/Additional-Information-WordtoPDF.png) +![Additional project configuration](GCP_Images/Additional-Information-WordtoPDF.png) Step 4: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). ![Install Syncfusion.DocIO.Net.Core NuGet package](ASP-NET-Core_images/Install_Nuget.png) @@ -102,7 +102,8 @@ Step 9: Add below code example to add a paragraph in the Word document. IWSection section = document.Sections[0]; //Add new paragraph to the section. IWParagraph paragraph = section.AddParagraph(); -paragraph.ParagraphFormat.FirstLineIndent = 36;paragraph.BreakCharacterFormat.FontSize = 12f; +paragraph.ParagraphFormat.FirstLineIndent = 36; +paragraph.BreakCharacterFormat.FontSize = 12f; //Add new text to the paragraph. IWTextRange textRange = paragraph.AppendText("In 2000, AdventureWorks Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the AdventureWorks Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as IWTextRange; textRange.CharacterFormat.FontSize = 12f; @@ -147,7 +148,7 @@ ls ![View the files and directories](GCP_Images/Navigate-Open-and-Save-Word-Document.png) -Step 4: Run the following **command** to navigate which sample you want run. +Step 4: Run the following **command** to navigate to the sample you want to run. {% tabs %} {% highlight c# tabtitle="CLI" %} @@ -157,9 +158,9 @@ cd Open-and-save-Word-document {% endhighlight %} {% endtabs %} -![Navigate which sample you want run](GCP_Images/View-the-File-Open-and-Save-Word-Document.png) +![Navigate to the sample you want to run](GCP_Images/View-the-File-Open-and-Save-Word-Document.png) -Step 5: To ensure that the sample is working correctly, please run the application using the following command. +Step 5: To ensure that the sample is working correctly, run the application using the following command. {% tabs %} {% highlight c# tabtitle="CLI" %} @@ -177,7 +178,7 @@ Step 6: Verify that the application is running properly by accessing the **Web V Step 7: Now you can see the sample output on the preview page. ![Sample output in browser](GCP_Images/Ensure-sample-Open-and-Save-Word-Document.png) -Step 8: Close the preview page and return to the terminal then press **Ctrl+C** for which will typically stop the process. +Step 8: Close the preview page and return to the terminal, then press **Ctrl+C** to stop the process. ![Press Ctrl+C in Cloud Shell Terminal](GCP_Images/Stop-Process-Open-and-Save-Word-Document.png) ## Publish the application @@ -205,7 +206,7 @@ cd bin/Release/net8.0/publish/ ![Navigate to publish folder](GCP_Images/Navigate-Publish-Folder-Open-and-Save-Word-Document.png) -## Configure app.yaml and docker file +## Configure app.yaml and Dockerfile Step 1: Add the app.yaml file to the publish folder with the following contents. @@ -222,7 +223,7 @@ EOT ![Add required files to publish folder](GCP_Images/Yaml-File-Open-and-Save-Word-Document.png) -Step 2: Add the Docker file to the publish folder with the following contents. +Step 2: Add the Dockerfile to the publish folder with the following contents. {% tabs %} {% highlight c# tabtitle="CLI" %} @@ -242,7 +243,7 @@ EOT ![Add required files to publish folder](GCP_Images/Docker-File-Open-and-Save-Word-Document.png) -Step 3: You can ensure **Docker** and **app.yaml** files are added in **Workspace**. +Step 3: Ensure the **Dockerfile** and **app.yaml** files are added in the **Workspace**. ![Add required files to publish folder](GCP_Images/Check-Docker-File-in-Workspace-Open-and-Save-Word-Document.png) ## Deploy to App Engine @@ -257,10 +258,10 @@ gcloud app deploy --version v0 {% endhighlight %} {% endtabs %} -![Add required files to publish folder](GCP_Images/Deploy-Open-and-Save-Word-Document.png) +![Deploy the application to App Engine](GCP_Images/Deploy-Open-and-Save-Word-Document.png) Step 2: Open the **URL** to access the application, which has been successfully deployed. -![Add required files to publish folder](GCP_Images/Browser-Open-and-Save-Word-Document.png) +![Access the deployed application in browser](GCP_Images/Browser-Open-and-Save-Word-Document.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/GCP/Google_App_Engine). diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Platform.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Platform.md index 493bd40861..2c8cefe3c5 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Platform.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Platform.md @@ -10,7 +10,7 @@ documentation: UG Syncfusion® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-sdk/net-word-library) used to create, read, edit, and convert Word documents programmatically without **Microsoft Word** or interop dependencies. Using this library, **open and save a Word document in Google Cloud Platform (GCP)** within a few lines of code. -N> If this is your first time working with Google Cloud Platform (GCP), please refer to the dedicated GCP resources. This section explains how to open and save a Word document in C# using the .NET Core Word (DocIO) library in GCP. +N> If this is your first time working with Google Cloud Platform (GCP), please refer to the [GCP documentation](https://cloud.google.com/docs). This section explains how to open and save a Word document in C# using the .NET Core Word (DocIO) library in GCP. ## Prerequisites diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Storage.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Storage.md index 39e890fd9d..a3c5dd8d05 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Storage.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Cloud-Storage.md @@ -10,7 +10,7 @@ documentation: UG ## Prerequisites -* **[Google cloud storage](https://cloud.google.com/storage/docs/creating-buckets)** is required. +* **[Google Cloud Storage](https://cloud.google.com/storage/docs/creating-buckets)** is required. * **[Service account](https://cloud.google.com/iam/docs/service-accounts-create)** is required. @@ -38,8 +38,8 @@ Step 3: Install the following **Nuget packages** in your application from [NuGet Step 4: Add a new button in the **Index.cshtml** as shown below. -{% tabs %} -{% highlight CSHTML %} +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} @{Html.BeginForm("EditDocument", "Home", FormMethod.Get); {
@@ -57,6 +57,7 @@ Step 5: Include the following namespaces in **HomeController.cs**. {% highlight c# tabtitle="C#" %} using Google.Apis.Auth.OAuth2; using Google.Cloud.Storage.V1; +using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} {% endtabs %} @@ -137,7 +138,7 @@ public async Task GetDocumentFromGoogle() catch (Exception ex) { Console.WriteLine($"Error retrieving document from Google Cloud Storage: {ex.Message}"); - throw; // or handle the exception as needed + throw; } } {% endhighlight %} @@ -171,8 +172,8 @@ Step 3: Install the following **Nuget packages** in your application from [NuGet Step 4: Add a new button in the **Index.cshtml** as shown below. -{% tabs %} -{% highlight CSHTML %} +{% tabs %} +{% highlight cshtml tabtitle="CSHTML" %} @{Html.BeginForm("UploadDocument", "Home", FormMethod.Get); {
@@ -431,6 +432,7 @@ public async Task UploadDocument() //Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); + document.Close(); //Upload the document to Google await UploadDocumentToGoogle(stream); diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Drive-Storage.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Drive-Storage.md index ac5d1877c9..f9cc743913 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Drive-Storage.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Google-Drive-Storage.md @@ -81,10 +81,10 @@ var stream = new MemoryStream(); request.Download(stream); // Step 5: Save the Word document locally. -using (FileStream fileStream = new FileStream("Output.docx", FileMode.Create, FileAccess.Write)) -{ + using (FileStream fileStream = new FileStream("Output.docx", FileMode.Create, FileAccess.Write)) + { stream.WriteTo(fileStream); -} + } //Dispose the stream. stream.Dispose(); @@ -97,7 +97,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Save Word document to Google Drive -To save a Word document to Google Drive, you can follow the steps below +To save a Word document to Google Drive, you can follow the steps below. Step 1: Set up **Google Drive API**. @@ -106,7 +106,7 @@ You must set up a project in the Google Developers Console and enable the Google Step 2: Create a new **.NET Core console application** project. ![Create a Console application in Visual Studio](Cloud-Storage/Google-Drive/Console-Template-Net-Core.png) -Step 3: Install the following **Nuget packages** in your application from [NuGet.org](https://www.nuget.org/). +Step 3: Install the following **NuGet packages** in your application from [NuGet.org](https://www.nuget.org/). * [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) * [Google.Apis.Drive.v3](https://www.nuget.org/packages/Google.Apis.Drive.v3) diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Linux.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Linux.md index 0995c4292d..efe97a5aee 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Linux.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Linux.md @@ -12,6 +12,10 @@ Syncfusion® DocIO is a [.NET Core Word library](https://www.syncf ## Steps to open and save Word document programmatically in .NET Core application on Linux +**Prerequisites:** + +* Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later. + Step 1: Execute the following command in Linux terminal to create a new .NET Core Console application. {% tabs %} @@ -26,7 +30,7 @@ dotnet new console ![Create .NET Core console application on Linux](Linux-images/CreateNewProject1.png) -Step 2: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/) by execute the following command. +Step 2: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/) by executing the following command. ![Install Syncfusion.DocIO.Net.Core NuGet packages](Linux-images/InstallNuGetPackages1.png) @@ -34,12 +38,14 @@ Step 2: Install the [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/S {% highlight KCONFIG %} -dotnet add package Syncfusion.DocIO.Net.Core -v 17.4.0.39 -s https://www.nuget.org/ +dotnet add package Syncfusion.DocIO.Net.Core {% endhighlight %} {% endtabs %} +N> To install a specific version, use the `-v` flag (for example, `dotnet add package Syncfusion.DocIO.Net.Core -v 17.4.0.39`). + N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. Step 3: Add the following Namespaces in Program.cs file. @@ -53,7 +59,7 @@ using Syncfusion.DocIO.DLS; {% endtabs %} -Step 4: Add the following code snippet in Program.cs file to **open an existing Word document in .NET Core application on Linux**. +Step 4: Place an existing Word document named `Input.docx` in the project folder (alongside `Program.cs`), since the sample reads `Input.docx` from the application's working directory. Then, add the following code snippet in Program.cs file to **open an existing Word document in .NET Core application on Linux**. {% tabs %} @@ -125,7 +131,7 @@ dotnet run {% endtabs %} -![Run the Applcation](Linux-images/Run.png) +![Run the Application](Linux-images/Run.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/Linux/Open-and-save-Word-document). diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-MAUI.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-MAUI.md index f091b7f72f..9277a4ac71 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-MAUI.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-MAUI.md @@ -11,11 +11,11 @@ documentation: UG Syncfusion® DocIO is a [.NET MAUI Word library](https://www.syncfusion.com/document-processing/word-framework/maui/word-library) used to **create, read, and edit Word documents** programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **open and save a Word document in .NET MAUI**. **Prerequisites:** -To create .NET Multi-platform App UI (.NET MAUI) apps, you need the latest versions of Visual Studio 2022 and .NET 6. For more details, refer [here](https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-7.0&tabs=vswin). +To create .NET Multi-platform App UI (.NET MAUI) apps, you need the latest version of Visual Studio 2022 with the .NET MAUI workload and .NET 8 SDK or later. For more details, refer [here](https://learn.microsoft.com/en-us/dotnet/maui/get-started/installation?view=net-maui-10.0&viewFallbackFrom=net-maui-8.0&tabs=visual-studio). ## Steps to open and save Word document programmatically in .NET MAUI -Step 1: Create a new C# .NET MAUI app. Select **.NET MAUI App (Preview)** from the template and click the **Next** button. +Step 1: Create a new C# .NET MAUI app. Select **.NET MAUI App** from the template and click the **Next** button. ![Create the MAUI app in Visual Studio](MAUI_Images/Create_Project.png) @@ -23,7 +23,7 @@ Step 2: Enter the project name and click **Create**. ![Create a project name for your new project](MAUI_Images/Configure.png) -Step 3: Install the [Syncfusion.DocIO.NET](https://www.nuget.org/packages/Syncfusion.DocIO.Net) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). +Step 3: Install the [Syncfusion.DocIO.Net](https://www.nuget.org/packages/Syncfusion.DocIO.Net) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/). ![Install Syncfusion.DocIO.NET NuGet package](MAUI_Images/Install_Nuget.png) @@ -62,6 +62,7 @@ Step 5: Include the following namespaces in the **MainPage.xaml.cs** file. {% highlight c# tabtitle="C#" %} using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; +using System.Reflection; {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Mac.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Mac.md index 941fb387f1..f64c769c9d 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Mac.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Mac.md @@ -12,6 +12,10 @@ Syncfusion® DocIO is a [.NET Core Word library](https://www.syncf ## Steps to open and save Word document programmatically in .NET Core application on Mac OS +**Prerequisites:** + +* Install [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/) or the [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later. + Step 1: Create a new .NET Core console application project. ![Create .NET Core console application in Visual Studio](Mac-images/CreateProject.png) @@ -38,7 +42,7 @@ using Syncfusion.DocIO.DLS; {% endtabs %} -Step 5: Add the following code snippet in Program.cs file to **open an existing Word document in .NET Core application on Mac OS**. +Step 5: Place an existing Word document named `Input.docx` in the project folder (alongside `Program.cs`), since the sample reads `Input.docx` from the application's working directory. Then, add the following code snippet in Program.cs file to **open an existing Word document in .NET Core application on Mac OS**. {% tabs %} @@ -83,10 +87,14 @@ outputStream.Dispose(); {% endtabs %} +Step 8: Build and run the project. + +Click **Run** ▸ **Start Without Debugging** in Visual Studio for Mac, or execute `dotnet run` in the terminal, to build and run the application. + You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/MAC). By executing the program, you will get the **Word document** as follows. The output will be saved in bin folder. -![.Net Core open and save output Word document](Mac-images/OpenAndSaveOutput.png) +![.NET Core open and save output Word document](Mac-images/OpenAndSaveOutput.png) Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-UWP.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-UWP.md index 1284d71403..c77dd936c3 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-UWP.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-UWP.md @@ -27,6 +27,9 @@ Step 3: Include the following namespaces in the MainPage.xaml.cs file. {% tabs %} {% highlight c# tabtitle="C#" %} +using System; +using System.IO; +using System.Reflection; using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WPF.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WPF.md index 78aa77636c..eee32659fe 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WPF.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WPF.md @@ -49,7 +49,7 @@ Step 4: Add a new button in **MainWindow.xaml** to create Word file as follows. - + {% endhighlight %} @@ -62,7 +62,8 @@ Step 5: Add the following code in **btnOpenAndSave_Click** to **open an existing {% highlight c# tabtitle="C#" %} //Open an existing Word document. -WordDocument document = new WordDocument("Input.docx"); +using (WordDocument document = new WordDocument("Input.docx")) +{ {% endhighlight %} {% endtabs %} @@ -91,6 +92,7 @@ Step 7: Add below code example to **save the Word document in WPF**. {% highlight c# tabtitle="C#" %} //Save the Word document document.Save("Sample.docx"); +} {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WinUI.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WinUI.md index 2d9d52df49..7b60ee99b4 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WinUI.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-WinUI.md @@ -61,6 +61,9 @@ Step 6: Include the following namespaces in the **MainWindow.xaml.cs** file. {% tabs %} {% highlight c# tabtitle="C#" %} +using System; +using System.IO; +using System.Reflection; using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} @@ -72,7 +75,7 @@ Step 7: Add a new action method **OpenAndSaveDocument** in MainWindow.xaml.cs an {% tabs %} {% highlight c# tabtitle="C#" %} -private async void OnButtonClicked(object sender, RoutedEventArgs e) +private async void OpenAndSaveDocument(object sender, RoutedEventArgs e) { //Load an existing Word document. Assembly assembly = typeof(App).GetTypeInfo().Assembly; @@ -126,7 +129,7 @@ Click [here](https://www.syncfusion.com/document-processing/word-framework/winui ## WinUI UWP app -Step 1: Create a new C# WinUI UWP app. Select Blank App (WinUI 3 in UWP)from the template and **click** the Next button. +Step 1: Create a new C# WinUI UWP app. Select Blank App (WinUI 3 in UWP) from the template and **click** the Next button. ![Create the WinUI UWP app in Visual Studio](WinUI_Images/Create_UWP_Project.png) @@ -176,10 +179,11 @@ Step 6: Include the following namespaces in the **MainPage.xaml.cs** file. {% tabs %} {% highlight c# tabtitle="C#" %} - +using System; +using System.IO; +using System.Reflection; using Syncfusion.DocIO.DLS; using Syncfusion.DocIO; - {% endhighlight %} {% endtabs %} @@ -189,7 +193,7 @@ Step 7: Add a new action method **OpenAndSaveDocument** in MainPage.xaml.cs and {% tabs %} {% highlight c# tabtitle="C#" %} -private async void OnButtonClicked(object sender, RoutedEventArgs e) +private async void OpenAndSaveDocument(object sender, RoutedEventArgs e) { //Load an existing Word document. Assembly assembly = typeof(App).GetTypeInfo().Assembly; diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Windows-Forms.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Windows-Forms.md index 67b2c6f642..5d539ef79a 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Windows-Forms.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Windows-Forms.md @@ -71,14 +71,14 @@ private void InitializeComponent() {% endtabs %} -Step 5: Add the following code in **btnOpenAndSave_Click** to **open an existing Word document in Windows-Forms**. +Step 5: Add the following code in **btnOpenAndSave_Click** to **open an existing Word document in Windows Forms**. {% tabs %} {% highlight c# tabtitle="C#" %} //Open an existing Word document. -WordDocument document = new WordDocument("Input.docx"); - +using (WordDocument document = new WordDocument("Input.docx")) +{ {% endhighlight %} {% endtabs %} @@ -95,7 +95,7 @@ IWParagraph paragraph = section.AddParagraph(); paragraph.ParagraphFormat.FirstLineIndent = 36; paragraph.BreakCharacterFormat.FontSize = 12f; //Add new text to the paragraph -WTextRange textRange = paragraph.AppendText("In 2000, AdventureWorks Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the AdventureWorks Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group.") as WTextRange; +IWTextRange textRange = paragraph.AppendText("In 2000, AdventureWorks Cycles bought a small manufacturing plant, Importadores Neptuno, located in Mexico. Importadores Neptuno manufactures several critical subcomponents for the AdventureWorks Cycles product line. These subcomponents are shipped to the Bothell location for final product assembly. In 2001, Importadores Neptuno, became the sole manufacturer and distributor of the touring bicycle product group."); textRange.CharacterFormat.FontSize = 12f; {% endhighlight %} @@ -108,6 +108,7 @@ Step 7: Add below code example to **save the Word document in Windows Forms**. {% highlight c# tabtitle="C#" %} //Save the Word document. document.Save("Sample.docx"); +} {% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Xamarin.md b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Xamarin.md index 442e00ea33..2c31cc36d0 100644 --- a/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Xamarin.md +++ b/Document-Processing/Word/Word-Library/NET/Open-and-save-Word-document-in-Xamarin.md @@ -22,13 +22,15 @@ N> If .NET Standard is not available in the code sharing strategy, the Portable ![Create Xamarin CodeSharing Option](Xamarin_images/Template_WordtoPDF.png) +N> Xamarin is deprecated. For new cross-platform projects, use .NET MAUI instead. See the migration guide [here](https://learn.microsoft.com/en-us/dotnet/maui/migration/). + Step 3: Install [Syncfusion.Xamarin.DocIO](https://www.nuget.org/packages/Syncfusion.Xamarin.DocIO) NuGet package as a reference to the .NET Standard project in your application from [NuGet.org](https://www.nuget.org/). ![Install Syncfusion.Xamarin.DocIO NuGet package](Xamarin_images/Install_Nuget.png) N> Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your application to use our components. -Step 4: Add new Forms XAML page in **portable project**. If there is no XAML page defined in the App class. Otherwise proceed to the next step. +Step 4: Add a new Forms XAML page in the **portable project**, if there is no XAML page already defined and set as the start page in the App class. If a start page is already configured, proceed to the next step.
  • To add the new XAML page, right click on the project and select Add > New Item and add a Forms XAML Page from the list. Name it as MainXamlPage. @@ -74,6 +76,9 @@ Step 6: Include the following namespace in the MainXamlPage.xaml.cs file. {% tabs %} {% highlight c# tabtitle="C#" %} +using System; +using System.IO; +using System.Reflection; using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; {% endhighlight %} @@ -125,7 +130,7 @@ Step 9: Add below code example to **save the Word document in Xamarin**. MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Save the stream as a file in the device and invoke it for viewing. -Xamarin.Forms.DependencyService.Get().SaveAndView("Sample.docx", "application/msword", stream); +Xamarin.Forms.DependencyService.Get().SaveAndView("Sample.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", stream); {% endhighlight %} {% endtabs %} @@ -153,7 +158,7 @@ Download the helper files from this [link](https://www.syncfusion.com/downloads/
ISave.cs Represent the base interface for save operation + Represents the base interface for save operation
SaveWindows81.cs Save implementation for WinRT device. + Save implementation for WinRT device (Windows 8.1).
Compile and execute the application. Now this application **opens and saves a Word document**. +N> Windows Phone and Windows 8.1 (WinRT) platforms are no longer supported by Microsoft. The corresponding helper files are provided only for legacy projects and are not recommended for new development. + You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Read-and-Save-document/Open-and-save-Word-document/Xamarin). By executing the program, you will get the **Word document** as follows. diff --git a/Document-Processing/Word/Word-Library/NET/Overview.md b/Document-Processing/Word/Word-Library/NET/Overview.md index 52a1fc1f4c..ed45f712bb 100644 --- a/Document-Processing/Word/Word-Library/NET/Overview.md +++ b/Document-Processing/Word/Word-Library/NET/Overview.md @@ -8,30 +8,30 @@ documentation: UG --- # Overview of Word library (DocIO) -Essential® DocIO is a native [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) that is used by developers to create, read, write, and convert Microsoft Word documents by using C#, VB.NET, and managed C++ code from any of the following .NET platforms - [Windows Forms](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-windows-forms), [WPF](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-wpf), [ASP.NET](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net), [ASP.NET MVC](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net-mvc), [ASP.NET Core](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net-core), [Blazor](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-blazor), [WPF](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-wpf), [Xamarin](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-xamarin), [WinUI](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-winui) and [.NET MAUI applications](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-maui). +Essential® DocIO is a native [.NET Word library](https://www.syncfusion.com/document-sdk/net-word-library) used by developers to create, read, write, and convert Microsoft Word documents using C#, VB.NET, and managed C++ code from any of the following .NET platforms: [Windows Forms](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-windows-forms), [WPF](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-wpf), [ASP.NET](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net), [ASP.NET MVC](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net-mvc), [ASP.NET Core](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-asp-net-core), [Blazor](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-blazor), [WPF](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-wpf), [Xamarin](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-xamarin), [WinUI](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-winui), and [.NET MAUI applications](https://help.syncfusion.com/document-processing/word/word-library/net/create-word-document-in-maui). -It is a non-UI component that provides a full-fledged document instance model similar to the Microsoft Office COM libraries to iterate with the document elements explicitly and perform necessary manipulation. It is built from scratch in C# and does not require Microsoft Word to be installed in the machine. It supports Word 97-2003 and later version documents. +It is a non-UI component that provides a full-fledged document instance model similar to the Microsoft Office COM libraries, allowing you to iterate over the document elements explicitly and perform necessary manipulations. It is built from scratch in C# and does not require Microsoft Word to be installed on the machine. It supports Word 97-2003 and later version documents. The minimum framework requirement is .NET Framework 4.0, .NET Core 2.0, or .NET 5.0 and later. T> If you encounter issues while using the .NET Word library in ASP.NET Core, refer to the [troubleshooting guide](https://support.syncfusion.com/kb/article/16012/troubleshoot-guide-for-aspnet-core-word-docio-library-issues#things-to-check-while-facing-an-issue-in-word-library) for recommended checks and solutions. **Key Features** -* Support to [create Word document](https://help.syncfusion.com/document-processing/word/word-library/net/getting-started) from scratch. -* Support to open, modify and save existing Word documents. +* Support to [create Word documents](https://help.syncfusion.com/document-processing/word/word-library/net/getting-started) from scratch. +* Support to open, modify, and save existing Word documents. * Advanced [Mail merge](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-mail-merge) support with different data sources. -* Ability to create or edit Word 97-2003 and later version documents, and convert them to commonly used file formats such as [RTF](https://help.syncfusion.com/document-processing/word/conversions/rtf-conversions), [WordML](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-processing-xml-xml), [TXT](https://help.syncfusion.com/document-processing/word/conversions/text-conversions), [HTML](https://help.syncfusion.com/document-processing/word/conversions/html-conversions) and vice versa. +* Ability to create or edit Word 97-2003 and later version documents, and convert them to commonly used file formats such as [RTF](https://help.syncfusion.com/document-processing/word/conversions/rtf-conversions), [WordML](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-processing-xml-xml), [TXT](https://help.syncfusion.com/document-processing/word/conversions/text-conversions), and [HTML](https://help.syncfusion.com/document-processing/word/conversions/html-conversions), and vice versa. * Ability to export a Word document as an [Image](https://help.syncfusion.com/document-processing/word/conversions/word-to-image/net/word-to-image), [PDF](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf) file, and [EPUB](https://help.syncfusion.com/document-processing/word/conversions/word-to-epub-conversion) in high quality. * Ability to [merge](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/merging-word-documents) and [split](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/split-word-documents) Word documents. * Support to [compare](https://help.syncfusion.com/document-processing/word/word-library/net/word-document/compare-word-documents) two DOCX format documents. -* Ability to create and manipulate [charts](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-charts), [Shapes](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-shapes), and [Group shape](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-shapes#grouping-shapes) in DOCX and WordML format documents. +* Ability to create and manipulate [charts](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-charts), [Shapes](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-shapes), and [Group Shape](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-shapes#grouping-shapes) in DOCX and WordML format documents. * Ability to read and write [Built-In and Custom Document Properties](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-word-document#working-with-word-document-properties). * Ability to [find and replace](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-find-and-replace) text with its original formatting. * Ability to insert [Bookmarks](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-bookmarks) and navigate corresponding bookmarks to insert, replace, and delete content. * Support to insert and edit the [form fields](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-form-fields). * Support to protect the document to [restrict access](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-security#protecting-word-document-from-editing) to the elements present within the document. * Ability to [encrypt and decrypt](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-security) Word documents. -* Support to insert and extract OLE objects. -* Support to run the DocIO applications in multi-thread and its thread safe. +* Ability to insert and extract [OLE objects](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-ole-objects). +* Support to run DocIO applications in multi-threaded environments; the library is thread-safe. **Compatible Microsoft Word Versions** @@ -41,6 +41,8 @@ T> If you encounter issues while using the .NET Word library in ASP.NET Core, re * Microsoft Word 2013 * Microsoft Word 2016 * Microsoft Word 2019 +* Microsoft Word 2021 +* Microsoft Word 2024 * Microsoft 365 ## See Also @@ -49,3 +51,4 @@ T> If you encounter issues while using the .NET Word library in ASP.NET Core, re * [Assemblies required](https://help.syncfusion.com/document-processing/word/word-library/net/assemblies-required) * [NuGet packages required](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required) +N> Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/Performance-metrics.md b/Document-Processing/Word/Word-Library/NET/Performance-metrics.md index df5211203e..36c43d4a13 100644 --- a/Document-Processing/Word/Word-Library/NET/Performance-metrics.md +++ b/Document-Processing/Word/Word-Library/NET/Performance-metrics.md @@ -1,5 +1,5 @@ --- -title: Word library Performance benchmark results | Syncfusion +title: Word Library performance benchmark results | Syncfusion description: Know about the performance benchmark results of the .NET Word library with different document sizes platform: document-processing control: DocIO @@ -22,7 +22,7 @@ The following system configurations were used for benchmarking: ## Benchmark Results -The table below shows the performance results of various Word document operations, evaluated using predefined input conditions in the previously described environment. +The table below shows the performance results of various Word document operations. Each operation was executed using the input document described in the **Input Details** column, and the reported time is the elapsed time for a single run in the environment described above. diff --git a/Document-Processing/Word/Word-Library/NET/Support-File-Formats.md b/Document-Processing/Word/Word-Library/NET/Support-File-Formats.md index 2433535661..5c3f780140 100644 --- a/Document-Processing/Word/Word-Library/NET/Support-File-Formats.md +++ b/Document-Processing/Word/Word-Library/NET/Support-File-Formats.md @@ -1,16 +1,16 @@ --- title: Supported file formats in .NET Word (DocIO) Library | Syncfusion -description: Learn more about the supported file formats in .NET Word (DocIO) Library to create, edit, and convert Word document. +description: Learn more about the supported file formats in .NET Word (DocIO) Library to create, edit, and convert Word documents. platform: document-processing control: DocIO documentation: UG --- -# Supported File Formats in .NET Word Library +# Supported File Formats in .NET Word (DocIO) Library Syncfusion® [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) (DocIO) supports all major native file formats of Microsoft Word, such as [DOC](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-binary-97-2003-format), [DOCX](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-document-docx), [RTF](https://help.syncfusion.com/document-processing/word/conversions/rtf-conversions), [DOT](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-97-2003-template-dot), [DOTX](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-template-dotx), [DOCM](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#macros-docm-dotm), and more. It also supports conversion for major native file formats to [HTML](https://help.syncfusion.com/document-processing/word/conversions/html-conversions), [Markdown](https://help.syncfusion.com/document-processing/word/conversions/word-to-markdown-conversion), [PDF](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf) and [image](https://help.syncfusion.com/document-processing/word/conversions/word-to-image/net/word-to-image). -The following table describes the supported file formats and their conversions in DocIO. +The following table describes the supported file formats and their conversions in DocIO.
@@ -25,7 +25,7 @@ The following table describes the supported file formats and their conversions i {{'[DOCX](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-document-docx)'| markdownify }}
-{{'[Word Processing XML (2007)](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-processing-xml-xml)'| markdownify }} +{{'[Word Processing XML](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-processing-xml-xml)'| markdownify }} {{'[DOT](https://help.syncfusion.com/document-processing/word/conversions/word-file-formats-conversions#word-97-2003-template-dot)'| markdownify }} @@ -267,9 +267,9 @@ The following table describes the supported file formats and their conversions i
-N> 1. Importing ODT format is not supported, you can save the existing document as ODT using DocIO. -N> 2. Exporting the Word Processing 2003 XML document is not supported. Whereas you can import the Word Processing 2003 XML documents and export it to other supported file formats. +N> 1. Importing the ODT format is not supported; however, you can save an existing document as ODT using DocIO. +N> 2. Exporting to the Word Processing 2003 XML format is not supported. However, you can import Word Processing 2003 XML documents and export them to other supported file formats. ## See Also -* [How to Identify and Manage File formats Unsupported by .NET Core Word?](https://support.syncfusion.com/kb/article/19611/how-to-identify-and-manage-file-formats-unsupported-by-net-core-word) +* [How to Identify and Manage File Formats Unsupported by .NET Word (DocIO)?](https://support.syncfusion.com/kb/article/19611/how-to-identify-and-manage-file-formats-unsupported-by-net-core-word) diff --git a/Document-Processing/Word/Word-Library/NET/Supported-LaTeX.md b/Document-Processing/Word/Word-Library/NET/Supported-LaTeX.md index f7e166db5b..045f57c56d 100644 --- a/Document-Processing/Word/Word-Library/NET/Supported-LaTeX.md +++ b/Document-Processing/Word/Word-Library/NET/Supported-LaTeX.md @@ -6,8 +6,13 @@ control: DocIO documentation: UG --- -# Supported symbols using LaTeX in Word Library -The .NET Word (DocIO) library allows to insert below supported symbols in equation using **LaTeX**. +# Supported symbols in LaTeX + +The .NET Word (DocIO) library allows you to insert the following supported symbols in an equation using **LaTeX**. + +N> To learn how to create equations from these symbols, see [Working with LaTeX](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-latex). +N> The `AppendMath` API used to add LaTeX is available starting with **v20.1.0.47** of Syncfusion DocIO. +N> Equations are supported only in documents saved in the Open XML format (.docx); they cannot be used in the Word 97-2003 (.doc) format. ## Arrows @@ -30,11 +35,11 @@ The following image demonstrates the LaTeX supported in .NET Word Library to cre ## Geometry -The following image demonstrates the LaTeX equivalent to geometry. +The following image demonstrates the LaTeX supported in .NET Word Library to create geometry symbols. ![Create Geometry Symbols in LaTeX](WorkingwithMathematicalEquation_images/Geometry.png) -## Greek Letter +## Greek Letters ### Lower Case @@ -76,7 +81,7 @@ The following image demonstrates the LaTeX supported in .NET Word Library to cre ### Common Relational Operators -The following image demonstrates the LaTeX supported in .NET Word Library to common relational operators. +The following image demonstrates the LaTeX supported in .NET Word Library to create common relational operators. ![Create Common Relational Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/CommonRelationalOperator_1.png) ![Create Common Relational Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/CommonRelationalOperator_2.png) @@ -84,24 +89,24 @@ The following image demonstrates the LaTeX supported in .NET Word Library to com ### Basic N-ary Operators -The following image demonstrates the LaTeX supported in .NET Word Library to basic N-ary operators. +The following image demonstrates the LaTeX supported in .NET Word Library to create basic N-ary operators. ![Create Basic N-ary Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/BinaryN-aryOperator_1.png) ![Create Basic N-ary Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/BinaryN-aryOperator_2.png) ### Advanced Binary Operators -The following image demonstrates the LaTeX supported in .NET Word Library to advanced binary operators. +The following image demonstrates the LaTeX supported in .NET Word Library to create advanced binary operators. -![Create Advanced Binary Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_1.png) -![Create Advanced Binary Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_2.png) -![Create Advanced Binary Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_3.png) +![Create Advanced Binary Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_1.png) +![Create Advanced Binary Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_2.png) +![Create Advanced Binary Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedBinaryOperator_3.png) ### Advanced Relational Operators -The following image demonstrates the LaTeX supported in .NET Word Library to advanced relational operators. +The following image demonstrates the LaTeX supported in .NET Word Library to create advanced relational operators. -![Create Advanced Relational Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_1.png) -![Create Advanced Relational Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_2.png) -![Create Advanced Relational Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_3.png) +![Create Advanced Relational Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_1.png) +![Create Advanced Relational Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_2.png) +![Create Advanced Relational Operators Symbols in LaTeX](WorkingwithMathematicalEquation_images/AdvancedRelationalOperator_3.png) diff --git a/Document-Processing/Word/Word-Library/NET/Supported-and-Unsupported-Features.md b/Document-Processing/Word/Word-Library/NET/Supported-and-Unsupported-Features.md index f3396e149a..6d2a81e6ee 100644 --- a/Document-Processing/Word/Word-Library/NET/Supported-and-Unsupported-Features.md +++ b/Document-Processing/Word/Word-Library/NET/Supported-and-Unsupported-Features.md @@ -5,9 +5,11 @@ platform: document-processing control: DocIO documentation: UG --- -# Supported and Unsupported Features in Word library +# Supported and Unsupported Features in Word Library -This section describes the support and unsupported elements in the DocIO. +This section describes the supported and unsupported elements in the DocIO library. + +> **Note:** Support for Silverlight and WinRT platforms is deprecated. The limitations noted for these platforms apply only to legacy applications. ## Word document features @@ -62,8 +64,8 @@ Yes

Encryption and Decryption

No

Yes

-Yes—limited [except Word 2013]

-Yes—limited [except Word 2013]

+Yes – limited [except Word 2013]

+Yes – limited [except Word 2013]

N/A

N/A

@@ -151,7 +153,7 @@ No

-### Section features +### Section Features @@ -257,7 +259,7 @@ Yes

-### Paragraph elements features +### Paragraph Elements Features @@ -316,7 +318,7 @@ No

WordArt

@@ -462,7 +464,7 @@ No

Yes

-Pictures (*.bmp, *.jpg, *.png, *.emf, *.tif and *.gif)

+Pictures (*.bmp, *.jpg, *.png, *.emf, *.tif, and *.gif)

Yes

Yes

Yes

@@ -400,8 +402,8 @@ No

No

No

-Yes
VML - No
-Yes
VML - No
+Yes– DrawingML
No– VML
+Yes– DrawingML
No– VML
No

No

-### Paragraph features +### Paragraph Features @@ -604,7 +606,7 @@ Yes

-### Style features +### Style Features @@ -701,7 +703,7 @@ No

-### Table features +### Table Features @@ -941,7 +943,7 @@ Yes

-### Text features +### Text Features @@ -1169,7 +1171,7 @@ Yes

@@ -1179,7 +1181,7 @@ Yes

@@ -1187,7 +1189,7 @@ Yes

@@ -1221,7 +1223,7 @@ Yes

Yes
Known Limitation:
- Not supported on Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. + Not supported on deprecated Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. Requires UpdateDocumentFields() and PDF assemblies in .NET Core/MAUI.
Yes
Known Limitation:
- Not supported on Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. + Not supported on deprecated Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. Requires UpdateDocumentFields() and PDF assemblies in .NET Core/MAUI.
Yes
Known Limitation:
- Not supported on Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. + Not supported on deprecated Silverlight/WinRT platforms. PDF layout limitations may cause incorrect page counts. Requires UpdateDocumentFields() and PDF assemblies in .NET Core/MAUI.
- + diff --git a/Document-Processing/Word/Word-Library/NET/Working-With-Content-Controls.md b/Document-Processing/Word/Word-Library/NET/Working-With-Content-Controls.md index 1cd81916c5..dd9edec841 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-With-Content-Controls.md +++ b/Document-Processing/Word/Word-Library/NET/Working-With-Content-Controls.md @@ -546,7 +546,7 @@ txt.CharacterFormat.FontSize = 11f; //Appends a new inline content control to enter the value InlineContentControl txtField = cellPara.AppendInlineContentControl(ContentControlType.Text) as InlineContentControl; txtField.ContentControlProperties.Title = "Text"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -559,7 +559,7 @@ txtField = cellPara.AppendInlineContentControl(ContentControlType.Date) as Inlin txtField.ContentControlProperties.Title = "Date"; //Sets the date display format txtField.ContentControlProperties.DateDisplayFormat = "M/d/yyyy"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -572,7 +572,7 @@ txtField = cellPara.AppendInlineContentControl(ContentControlType.Text) as Inlin txtField.ContentControlProperties.Title = "Text"; //Sets multiline property to true to get the multiple line input of Address txtField.ContentControlProperties.Multiline = true; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -583,7 +583,7 @@ txt.CharacterFormat.FontSize = 11f; //Appends a new inline content control to enter the value txtField = cellPara.AppendInlineContentControl(ContentControlType.Text) as InlineContentControl; txtField.ContentControlProperties.Title = "Text"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -594,7 +594,7 @@ txt.CharacterFormat.FontSize = 11f; //Appends a new inline content control to enter the value txtField = cellPara.AppendInlineContentControl(ContentControlType.Text) as InlineContentControl; txtField.ContentControlProperties.Title = "Text"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -653,7 +653,7 @@ item.DisplayText = "Universal"; item.Value = "3"; dropdown.ContentControlProperties.ContentControlListItems.Add(item); dropdown.ContentControlProperties.Title = "Drop-Down"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control dropdown.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; dropdown.BreakCharacterFormat.FontName = "Arial"; dropdown.BreakCharacterFormat.FontSize = 11f; @@ -663,7 +663,7 @@ txt.CharacterFormat.FontName = "Arial"; txt.CharacterFormat.FontSize = 11f; //Appends a new inline content control to enter the value txtField = cellPara.AppendInlineContentControl(ContentControlType.Text) as InlineContentControl; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control txtField.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; txtField.BreakCharacterFormat.FontName = "Arial"; txtField.BreakCharacterFormat.FontSize = 11f; @@ -696,7 +696,7 @@ item = new ContentControlListItem(); item.DisplayText = "Excellent"; item.Value = "3"; dropdown.ContentControlProperties.ContentControlListItems.Add(item); -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control dropdown.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; dropdown.BreakCharacterFormat.FontName = "Arial"; dropdown.BreakCharacterFormat.FontSize = 11f; @@ -726,7 +726,7 @@ item.DisplayText = "Excellent"; item.Value = "3"; dropdown.ContentControlProperties.ContentControlListItems.Add(item); dropdown.ContentControlProperties.Title = "Drop-Down"; -//Sets formatting options for text present insider a content control +//Sets formatting options for text present inside a content control dropdown.BreakCharacterFormat.TextColor = Syncfusion.Drawing.Color.MidnightBlue; dropdown.BreakCharacterFormat.FontName = "Arial"; dropdown.BreakCharacterFormat.FontSize = 11f; @@ -1251,7 +1251,7 @@ dropdown.BreakCharacterFormat.TextColor = System.Drawing.Color.MidnightBlue dropdown.BreakCharacterFormat.FontName = "Arial" dropdown.BreakCharacterFormat.FontSize = 11.0F 'Appends a text to paragraph of cell -txt = cellPara.AppendText("" + vbLf + vbLf + vbTab& + " VB:" + vbTab + vbTab + vbTab& + vbTab) +txt = cellPara.AppendText("" + vbLf + vbLf + vbTab + " VB:" + vbTab + vbTab + vbTab + vbTab) txt.CharacterFormat.FontName = "Arial" txt.CharacterFormat.FontSize = 9.0F 'Appends a new inline content control to enter the value @@ -1592,7 +1592,7 @@ IWParagraph paragraph = section.AddParagraph(); //Adds new XmlPart to the document CustomXMLPart xmlPart = new CustomXMLPart(document); //Loads the xml code -xmlPart.LoadXML(@"Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows."); +xmlPart.LoadXML(@"Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows."); //Adds text paragraph.AppendText("Book author name : "); //Adds new content control to the paragraph @@ -1626,7 +1626,7 @@ IWParagraph paragraph = section.AddParagraph(); //Adds new XmlPart to the document CustomXMLPart xmlPart = new CustomXMLPart(document); //Loads the xml code -xmlPart.LoadXML(@"Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows."); +xmlPart.LoadXML(@"Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows."); //Adds the text paragraph.AppendText("Book author name : "); //Adds new content control to the paragraph @@ -1658,7 +1658,7 @@ Dim paragraph As IWParagraph = section.AddParagraph 'Adds new XmlPart to the document Dim xmlPart As CustomXMLPart = New CustomXMLPart(document) 'Loads the xml code -xmlPart.LoadXML("Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows.") +xmlPart.LoadXML("Matt HankNew Migration Paths of the Red Breasted RobinNew non-fiction29.9512/1/2007 New You see them in the spring outside your windows.") 'Adds text paragraph.AppendText("Book author name : ") 'Adds new content control to the paragraph @@ -1666,11 +1666,11 @@ Dim control As InlineContentControl = CType(paragraph.AppendInlineContentControl 'Creates the XML mapping on a content control for specified XPath control.ContentControlProperties.XmlMapping.SetMapping("/books/book/author", "", xmlPart) 'Selects the single node -CustomXMLNode node = xmlPart.SelectSingleNode("/books/book/title"); +Dim node As CustomXMLNode = xmlPart.SelectSingleNode("/books/book/title") 'Adds another paragraph paragraph = section.AddParagraph 'Adds text -paragraph.AppendText("Book title: "); +paragraph.AppendText("Book title: ") 'Appends content control to second paragraph control = CType(paragraph.AppendInlineContentControl(ContentControlType.Text), InlineContentControl) 'Creates the XML data mapping on a content control for specified node @@ -1874,7 +1874,7 @@ document.EnsureMinimal(); WParagraph paragraph = document.LastParagraph; //Adds text to the paragraph paragraph.AppendText("A new text is added to the paragraph. "); -//Appends picture content control to the paragraph +//Appends checkbox content control to the paragraph InlineContentControl checkBox = paragraph.AppendInlineContentControl(ContentControlType.CheckBox) as InlineContentControl; checkBox.ContentControlProperties.IsChecked = true; //Creates memory stream @@ -1911,8 +1911,8 @@ Dim paragraph As WParagraph = document.LastParagraph 'Adds text to the paragraph paragraph.AppendText("A new text is added to the paragraph. ") 'Appends checkbox content control to the paragraph -Dim checkBox As InlineContentControl = CType(paragraph.AppendInlineContentControl(ContentControlType. CheckBox), InlineContentControl) -checkBox.ContentControlProperties.IsChecked = True +Dim checkBox As InlineContentControl = CType(paragraph.AppendInlineContentControl(ContentControlType.CheckBox), InlineContentControl) +checkBox.ContentControlProperties.IsChecked = True 'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() @@ -2533,7 +2533,7 @@ Private Shared Sub IterateTextBody(ByVal textBody As WTextBody) Case EntityType.Table 'Table is a collection of rows and cells 'Iterates through table's DOM - SurroundingClass.IterateTable(TryCast(bodyItemEntity, WTable)) + IterateTable(TryCast(bodyItemEntity, WTable)) Case EntityType.BlockContentControl Dim blockContentControl As BlockContentControl = TryCast(bodyItemEntity, BlockContentControl) 'Iterates to the body items of Block Content Control. @@ -2570,17 +2570,18 @@ Private Shared Sub IterateParagraph(ByVal paraItems As ParagraphItemCollection) IterateTextBody(shape.TextBody) Case EntityType.InlineContentControl Dim inlineContentControl As InlineContentControl = TryCast(entity, InlineContentControl) - If inlineContentControl.ContentControlProperties.Title = "ReplaceText" Then + If inlineContentControl.ContentControlProperties.Title = "ReplaceText" Then ReplaceTextWithInlineContentControl("Hello World", inlineContentControl) + End If End Select Next End Sub Private Shared Sub ReplaceTextWithInlineContentControl(ByVal text As String, ByVal inlineContentControl As InlineContentControl) Dim characterFormat As WCharacterFormat = Nothing - For Each item As ParagraphItem In inlineContentControl.ParagraphItems - If TypeOf item Is WTextRange Then - characterFormat = TryCast(item, WTextRange).CharacterFormat + For Each item As ParagraphItem In inlineContentControl.ParagraphItems + If TypeOf item Is WTextRange Then + characterFormat = TryCast(item, WTextRange).CharacterFormat Exit For End If Next @@ -2595,7 +2596,7 @@ End Sub {% endtabs %} -N> In the above-mentioned code samples, for Xamarin platforms the document is saved as stream only. To save the stream to file kindly refer code sample [here](https://help.syncfusion.com/document-processing/word/word-library/net/xamarin#save-the-document#). +N> In the above-mentioned code samples, for Xamarin platforms the document is saved as stream only. To save the stream to file kindly refer code sample [here](https://help.syncfusion.com/document-processing/word/word-library/net/xamarin#save-the-document). ## Online Demo diff --git a/Document-Processing/Word/Word-Library/NET/Working-With-OLE-Objects.md b/Document-Processing/Word/Word-Library/NET/Working-With-OLE-Objects.md index f0a89b5d25..01552d3233 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-With-OLE-Objects.md +++ b/Document-Processing/Word/Word-Library/NET/Working-With-OLE-Objects.md @@ -7,7 +7,7 @@ documentation: UG --- # Working with OLE Objects in Word Library -OLE (Object Linking and Embedding) objects allow embedding and linking to documents and other objects. It allows the content of one program to be used in a Word document. The Objects can be inserted in the following two ways: +OLE (Object Linking and Embedding) objects allow embedding and linking to documents and other objects. It allows the content of one program to be used in a Word document. The objects can be inserted in the following two ways: * Linked: The content is linked to the source file * Embedded: The content is copied to the Word document and is not linked to the source file @@ -90,7 +90,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Extract OLE Objects from Word document -The following code example explains how to extract OLE objects from the document and save as separate file. +The following code example explains how to extract OLE objects from the document and save them as separate files. {% tabs %} @@ -267,7 +267,7 @@ private static void ExtractOLEObject(WordDocument document) {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Opens an existing document -Using document As WordDocument = New WordDocument(inputFileName) +Using document As WordDocument = New WordDocument("Template.docx") 'Extract the OLE object from the word document ExtractOLEObject(document) End Using @@ -461,14 +461,14 @@ Private Shared Sub RemoveOLEObject(ByVal document As WordDocument) If entity.EntityType Is EntityType.OleObject Then paragraph.ChildEntities.Remove(entity) isFieldStart = True - i -= 1 + i = i - 1 ElseIf isFieldStart AndAlso entity.EntityType Is EntityType.FieldMark AndAlso TryCast(entity, WFieldMark).Type Is FieldMarkType.FieldEnd Then paragraph.ChildEntities.Remove(entity) isFieldStart = False - i -= 1 + i = i - 1 ElseIf isFieldStart Then paragraph.ChildEntities.Remove(entity) - i -= 1 + i = i - 1 End If Next Next diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Charts.md b/Document-Processing/Word/Word-Library/NET/Working-with-Charts.md index d64e7aaef0..06cd408800 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Charts.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Charts.md @@ -7,7 +7,7 @@ documentation: UG --- # Working with Charts in Word document -A Chart is a graphical representation of data where the data is represented as symbols such as bars, lines etc. Charts can represent numerical data, functions or some kinds of qualitative structures. DocIO supports the following chart types: +A Chart is a graphical representation of data where the data is represented as symbols such as bars, lines, etc. Charts can represent numerical data, functions, or some kinds of qualitative structures. DocIO supports the following chart types: * Bar chart * Line chart @@ -19,6 +19,8 @@ A Chart is a graphical representation of data where the data is represented as s * Stock chart * Radar chart +For the complete list of supported chart types, refer to the [Supported Chart Types](#supported-chart-types) section. + N> DocIO supports chart only in DOCX and WordML format documents. ## Creating a simple Chart from scratch @@ -68,7 +70,7 @@ using (WordDocument document = new WordDocument()) chart.ChartData.SetValue(10, 2, 29.171); chart.ChartData.SetValue(11, 1, "Elizabeth Lincoln"); chart.ChartData.SetValue(11, 2, 25.696); - //Creates a new chart series with the name “Sales” + //Creates a new chart series with the name "Sales" IOfficeChartSerie pieSeries = chart.Series.Add("Sales"); pieSeries.Values = chart.ChartData[2, 2, 11, 2]; //Sets data label @@ -81,122 +83,122 @@ using (WordDocument document = new WordDocument()) //Sets category labels chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1]; //Saves the Word document to MemoryStream - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); - document.Close(); + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates a new Word document -WordDocument document = new WordDocument(); -//Adds section to the document -IWSection sec = document.AddSection(); -//Adds paragraph to the section -IWParagraph paragraph = sec.AddParagraph(); -//Creates and Appends chart to the paragraph -WChart chart = paragraph.AppendChart(446, 270); -//Sets chart type -chart.ChartType = OfficeChartType.Pie; -//Sets chart title -chart.ChartTitle = "Best Selling Products"; -chart.ChartTitleArea.FontName = "Calibri"; -chart.ChartTitleArea.Size = 14; -//Sets data for chart -chart.ChartData.SetValue(1, 1, ""); -chart.ChartData.SetValue(1, 2, "Sales"); -chart.ChartData.SetValue(2, 1, "Phyllis Lapin"); -chart.ChartData.SetValue(2, 2, 141.396); -chart.ChartData.SetValue(3, 1, "Stanley Hudson"); -chart.ChartData.SetValue(3, 2, 80.368); -chart.ChartData.SetValue(4, 1, "Bernard Shah"); -chart.ChartData.SetValue(4, 2, 71.155); -chart.ChartData.SetValue(5, 1, "Patricia Lincoln"); -chart.ChartData.SetValue(5, 2, 47.234); -chart.ChartData.SetValue(6, 1, "Camembert Pierrot"); -chart.ChartData.SetValue(6, 2, 46.825); -chart.ChartData.SetValue(7, 1, "Thomas Hardy"); -chart.ChartData.SetValue(7, 2, 42.593); -chart.ChartData.SetValue(8, 1, "Hanna Moos"); -chart.ChartData.SetValue(8, 2, 41.819); -chart.ChartData.SetValue(9, 1, "Alice Mutton"); -chart.ChartData.SetValue(9, 2, 32.698); -chart.ChartData.SetValue(10, 1, "Christina Berglund"); -chart.ChartData.SetValue(10, 2, 29.171); -chart.ChartData.SetValue(11, 1, "Elizabeth Lincoln"); -chart.ChartData.SetValue(11, 2, 25.696); -//Creates a new chart series with the name “Sales” -IOfficeChartSerie pieSeries = chart.Series.Add("Sales"); -pieSeries.Values = chart.ChartData[2, 2, 11, 2]; -//Sets data label -pieSeries.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; -pieSeries.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; -//Sets background color -chart.ChartArea.Fill.ForeColor = Color.FromArgb(242, 242, 242); -chart.PlotArea.Fill.ForeColor = Color.FromArgb(242, 242, 242); -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; -//Sets category labels -chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1]; -//Saves the document -document.Save("Sample.docx", FormatType.Docx); -//Closes the document -document.Close(); +using (WordDocument document = new WordDocument()) +{ + //Adds section to the document + IWSection sec = document.AddSection(); + //Adds paragraph to the section + IWParagraph paragraph = sec.AddParagraph(); + //Creates and Appends chart to the paragraph + WChart chart = paragraph.AppendChart(446, 270); + //Sets chart type + chart.ChartType = OfficeChartType.Pie; + //Sets chart title + chart.ChartTitle = "Best Selling Products"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + //Sets data for chart + chart.ChartData.SetValue(1, 1, ""); + chart.ChartData.SetValue(1, 2, "Sales"); + chart.ChartData.SetValue(2, 1, "Phyllis Lapin"); + chart.ChartData.SetValue(2, 2, 141.396); + chart.ChartData.SetValue(3, 1, "Stanley Hudson"); + chart.ChartData.SetValue(3, 2, 80.368); + chart.ChartData.SetValue(4, 1, "Bernard Shah"); + chart.ChartData.SetValue(4, 2, 71.155); + chart.ChartData.SetValue(5, 1, "Patricia Lincoln"); + chart.ChartData.SetValue(5, 2, 47.234); + chart.ChartData.SetValue(6, 1, "Camembert Pierrot"); + chart.ChartData.SetValue(6, 2, 46.825); + chart.ChartData.SetValue(7, 1, "Thomas Hardy"); + chart.ChartData.SetValue(7, 2, 42.593); + chart.ChartData.SetValue(8, 1, "Hanna Moos"); + chart.ChartData.SetValue(8, 2, 41.819); + chart.ChartData.SetValue(9, 1, "Alice Mutton"); + chart.ChartData.SetValue(9, 2, 32.698); + chart.ChartData.SetValue(10, 1, "Christina Berglund"); + chart.ChartData.SetValue(10, 2, 29.171); + chart.ChartData.SetValue(11, 1, "Elizabeth Lincoln"); + chart.ChartData.SetValue(11, 2, 25.696); + //Creates a new chart series with the name "Sales" + IOfficeChartSerie pieSeries = chart.Series.Add("Sales"); + pieSeries.Values = chart.ChartData[2, 2, 11, 2]; + //Sets data label + pieSeries.DataPoints.DefaultDataPoint.DataLabels.IsValue = true; + pieSeries.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside; + //Sets background color + chart.ChartArea.Fill.ForeColor = Color.FromArgb(242, 242, 242); + chart.PlotArea.Fill.ForeColor = Color.FromArgb(242, 242, 242); + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets category labels + chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 11, 1]; + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates a new Word document -Dim document As New WordDocument() -'Adds section to the document -Dim sec As IWSection = document.AddSection() -'Adds paragraph to the section -Dim paragraph As IWParagraph = sec.AddParagraph() -'Creates and Appends chart to the paragraph -Dim chart As WChart = paragraph.AppendChart(446, 270) -'Sets chart type -chart.ChartType = OfficeChartType.Pie -'Sets chart title -chart.ChartTitle = "Best Selling Products" -chart.ChartTitleArea.FontName = "Calibri" -chart.ChartTitleArea.Size = 14 -'Sets data for chart -chart.ChartData.SetValue(1, 1, "") -chart.ChartData.SetValue(1, 2, "Sales") -chart.ChartData.SetValue(2, 1, "Phyllis Lapin") -chart.ChartData.SetValue(2, 2, 141.396) -chart.ChartData.SetValue(3, 1, "Stanley Hudson") -chart.ChartData.SetValue(3, 2, 80.368) -chart.ChartData.SetValue(4, 1, "Bernard Shah") -chart.ChartData.SetValue(4, 2, 71.155) -chart.ChartData.SetValue(5, 1, "Patricia Lincoln") -chart.ChartData.SetValue(5, 2, 47.234) -chart.ChartData.SetValue(6, 1, "Camembert Pierrot") -chart.ChartData.SetValue(6, 2, 46.825) -chart.ChartData.SetValue(7, 1, "Thomas Hardy") -chart.ChartData.SetValue(7, 2, 42.593) -chart.ChartData.SetValue(8, 1, "Hanna Moos") -chart.ChartData.SetValue(8, 2, 41.819) -chart.ChartData.SetValue(9, 1, "Alice Mutton") -chart.ChartData.SetValue(9, 2, 32.698) -chart.ChartData.SetValue(10, 1, "Christina Berglund") -chart.ChartData.SetValue(10, 2, 29.171) -chart.ChartData.SetValue(11, 1, "Elizabeth Lincoln") -chart.ChartData.SetValue(11, 2, 25.696) -'Creates a new chart series with the name “Sales” -Dim pieSeries As IOfficeChartSerie = chart.Series.Add("Sales") -pieSeries.Values = chart.ChartData(2, 2, 11, 2) -'Sets data label -pieSeries.DataPoints.DefaultDataPoint.DataLabels.IsValue = True -pieSeries.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside -'Sets background color -chart.ChartArea.Fill.ForeColor = Color.FromArgb(242, 242, 242) -chart.PlotArea.Fill.ForeColor = Color.FromArgb(242, 242, 242) -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None -'Sets category labels -chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 11, 1) -'Saves the document -document.Save("Sample.docx", FormatType.Docx) -'Closes the document -document.Close() +Using document As New WordDocument() + 'Adds section to the document + Dim sec As IWSection = document.AddSection() + 'Adds paragraph to the section + Dim paragraph As IWParagraph = sec.AddParagraph() + 'Creates and Appends chart to the paragraph + Dim chart As WChart = paragraph.AppendChart(446, 270) + 'Sets chart type + chart.ChartType = OfficeChartType.Pie + 'Sets chart title + chart.ChartTitle = "Best Selling Products" + chart.ChartTitleArea.FontName = "Calibri" + chart.ChartTitleArea.Size = 14 + 'Sets data for chart + chart.ChartData.SetValue(1, 1, "") + chart.ChartData.SetValue(1, 2, "Sales") + chart.ChartData.SetValue(2, 1, "Phyllis Lapin") + chart.ChartData.SetValue(2, 2, 141.396) + chart.ChartData.SetValue(3, 1, "Stanley Hudson") + chart.ChartData.SetValue(3, 2, 80.368) + chart.ChartData.SetValue(4, 1, "Bernard Shah") + chart.ChartData.SetValue(4, 2, 71.155) + chart.ChartData.SetValue(5, 1, "Patricia Lincoln") + chart.ChartData.SetValue(5, 2, 47.234) + chart.ChartData.SetValue(6, 1, "Camembert Pierrot") + chart.ChartData.SetValue(6, 2, 46.825) + chart.ChartData.SetValue(7, 1, "Thomas Hardy") + chart.ChartData.SetValue(7, 2, 42.593) + chart.ChartData.SetValue(8, 1, "Hanna Moos") + chart.ChartData.SetValue(8, 2, 41.819) + chart.ChartData.SetValue(9, 1, "Alice Mutton") + chart.ChartData.SetValue(9, 2, 32.698) + chart.ChartData.SetValue(10, 1, "Christina Berglund") + chart.ChartData.SetValue(10, 2, 29.171) + chart.ChartData.SetValue(11, 1, "Elizabeth Lincoln") + chart.ChartData.SetValue(11, 2, 25.696) + 'Creates a new chart series with the name "Sales" + Dim pieSeries As IOfficeChartSerie = chart.Series.Add("Sales") + pieSeries.Values = chart.ChartData(2, 2, 11, 2) + 'Sets data label + pieSeries.DataPoints.DefaultDataPoint.DataLabels.IsValue = True + pieSeries.DataPoints.DefaultDataPoint.DataLabels.Position = OfficeDataLabelPosition.Outside + 'Sets background color + chart.ChartArea.Fill.ForeColor = Color.FromArgb(242, 242, 242) + chart.PlotArea.Fill.ForeColor = Color.FromArgb(242, 242, 242) + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None + 'Sets category labels + chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData(2, 1, 11, 1) + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -205,9 +207,9 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Creating a Chart from Excel file -The chart data can be set through the object array or can be loaded from the excel stream. The specific range of the data from the excel file can be used to set chart data. +The chart data can be set through the object array or can be loaded from an Excel stream. The specific range of the data from the Excel file can be used to set chart data. -The following code example illustrates the chart data loaded from the excel file. +The following code example illustrates the chart data loaded from the Excel file. {% tabs %} @@ -220,87 +222,92 @@ using (WordDocument document = new WordDocument()) //Adds paragraph to the section IWParagraph paragraph = sec.AddParagraph(); //Loads the excel file as stream - Stream excelStream = File.OpenRead("Excel_Template.xlsx"); - //Creates and Appends chart to the paragraph with excel stream as parameter - WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); - //Sets chart type and title - chart.ChartType = OfficeChartType.Column_Clustered; - chart.ChartTitle = "Purchase Details"; - chart.ChartTitleArea.FontName = "Calibri"; - chart.ChartTitleArea.Size = 14; - chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; - //Sets name to chart series - chart.Series[0].Name = "Sum of Purchases"; - chart.Series[1].Name = "Sum of Future Expenses"; - chart.PrimaryCategoryAxis.Title = "Products"; - chart.PrimaryValueAxis.Title = "In Dollars"; - //Sets position of legend - chart.Legend.Position = OfficeLegendPosition.Bottom; + using (Stream excelStream = File.OpenRead("Excel_Template.xlsx")) + { + //Creates and Appends chart to the paragraph with excel stream as parameter + WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); + //Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered; + chart.ChartTitle = "Purchase Details"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets name to chart series + chart.Series[0].Name = "Sum of Purchases"; + chart.Series[1].Name = "Sum of Future Expenses"; + chart.PrimaryCategoryAxis.Title = "Products"; + chart.PrimaryValueAxis.Title = "In Dollars"; + //Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom; + } //Saves the Word document to MemoryStream - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); - document.Close(); + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates a new Word document -WordDocument document = new WordDocument(); -//Adds section to the document -IWSection sec = document.AddSection(); -//Adds paragraph to the section -IWParagraph paragraph = sec.AddParagraph(); -//Loads the excel file as stream -Stream excelStream = File.OpenRead("Excel_Template.xlsx"); -//Creates and Appends chart to the paragraph with excel stream as parameter -WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); -//Sets chart type and title -chart.ChartType = OfficeChartType.Column_Clustered; -chart.ChartTitle = "Purchase Details"; -chart.ChartTitleArea.FontName = "Calibri"; -chart.ChartTitleArea.Size = 14; -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; -//Sets name to chart series -chart.Series[0].Name = "Sum of Purchases"; -chart.Series[1].Name = "Sum of Future Expenses"; -chart.PrimaryCategoryAxis.Title = "Products"; -chart.PrimaryValueAxis.Title = "In Dollars"; -//Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom; -//Saves the document -document.Save("Sample.docx", FormatType.Docx); -//Closes the document -document.Close(); +using (WordDocument document = new WordDocument()) +{ + //Adds section to the document + IWSection sec = document.AddSection(); + //Adds paragraph to the section + IWParagraph paragraph = sec.AddParagraph(); + //Loads the excel file as stream + using (Stream excelStream = File.OpenRead("Excel_Template.xlsx")) + { + //Creates and Appends chart to the paragraph with excel stream as parameter + WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); + //Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered; + chart.ChartTitle = "Purchase Details"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets name to chart series + chart.Series[0].Name = "Sum of Purchases"; + chart.Series[1].Name = "Sum of Future Expenses"; + chart.PrimaryCategoryAxis.Title = "Products"; + chart.PrimaryValueAxis.Title = "In Dollars"; + //Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom; + } + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates a new Word document -Dim document As New WordDocument() -'Adds section to the document -Dim sec As IWSection = document.AddSection() -'Adds paragraph to the section -Dim paragraph As IWParagraph = sec.AddParagraph() -'Loads the excel file as stream -Dim excelStream As Stream = File.OpenRead("Excel_Template.xlsx") -'Creates and Appends chart to the paragraph with excel stream as parameter -Dim chart As WChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300) -'Sets chart type and title -chart.ChartType = OfficeChartType.Column_Clustered -chart.ChartTitle = "Purchase Details" -chart.ChartTitleArea.FontName = "Calibri" -chart.ChartTitleArea.Size = 14 -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None -'Sets name to chart series -chart.Series(0).Name = "Sum of Purchases" -chart.Series(1).Name = "Sum of Future Expenses" -chart.PrimaryCategoryAxis.Title = "Products" -chart.PrimaryValueAxis.Title = "In Dollars" -'Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom -'Saves the document -document.Save("Sample.docx", FormatType.Docx) -'Closes the document -document.Close() +Using document As New WordDocument() + 'Adds section to the document + Dim sec As IWSection = document.AddSection() + 'Adds paragraph to the section + Dim paragraph As IWParagraph = sec.AddParagraph() + 'Loads the excel file as stream + Using excelStream As Stream = File.OpenRead("Excel_Template.xlsx") + 'Creates and Appends chart to the paragraph with excel stream as parameter + Dim chart As WChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300) + 'Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered + chart.ChartTitle = "Purchase Details" + chart.ChartTitleArea.FontName = "Calibri" + chart.ChartTitleArea.Size = 14 + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None + 'Sets name to chart series + chart.Series(0).Name = "Sum of Purchases" + chart.Series(1).Name = "Sum of Future Expenses" + chart.PrimaryCategoryAxis.Title = "Products" + chart.PrimaryValueAxis.Title = "In Dollars" + 'Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom + End Using + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -360,109 +367,109 @@ using (WordDocument document = new WordDocument()) //Sets position of legend chart.Legend.Position = OfficeLegendPosition.Bottom; //Saves the Word document to MemoryStream - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); - document.Close(); + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates a new Word document -WordDocument document = new WordDocument(); -//Adds section to the document -IWSection sec = document.AddSection(); -//Adds paragraph to the section -IWParagraph paragraph = sec.AddParagraph(); -//Inputs data for chart -object[][] data = new object[6][]; -for (int i = 0; i < 6; i++) - data[i] = new object[3]; -data[0][0] = ""; -data[1][0] = "Camembert Pierrot"; -data[2][0] = "Alice Mutton"; -data[3][0] = "Roasted Tigers"; -data[4][0] = "Orange Shake"; -data[5][0] = "Dried Apples"; -data[0][1] = "Sum of Purchases"; -data[1][1] = 286; -data[2][1] = 680; -data[3][1] = 288; -data[4][1] = 200; -data[5][1] = 731; -data[0][2] = "Sum of Future Expenses"; -data[1][2] = 1300; -data[2][2] = 700; -data[3][2] = 1280; -data[4][2] = 1200; -data[5][2] = 2660; -//Creates and Appends chart to the paragraph -WChart chart = paragraph.AppendChart(data, 470, 300); -//Sets chart type and title -chart.ChartTitle = "Purchase Details"; -chart.ChartTitleArea.FontName = "Calibri"; -chart.ChartTitleArea.Size = 14; -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; -//Sets series type -chart.Series[0].SerieType = OfficeChartType.Line_Markers; -chart.Series[1].SerieType = OfficeChartType.Bar_Clustered; -chart.PrimaryCategoryAxis.Title = "Products"; -chart.PrimaryValueAxis.Title = "In Dollars"; -//Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom; -//Saves the document -document.Save("Sample.docx", FormatType.Docx); -//Closes the document -document.Close(); +using (WordDocument document = new WordDocument()) +{ + //Adds section to the document + IWSection sec = document.AddSection(); + //Adds paragraph to the section + IWParagraph paragraph = sec.AddParagraph(); + //Inputs data for chart + object[][] data = new object[6][]; + for (int i = 0; i < 6; i++) + data[i] = new object[3]; + data[0][0] = ""; + data[1][0] = "Camembert Pierrot"; + data[2][0] = "Alice Mutton"; + data[3][0] = "Roasted Tigers"; + data[4][0] = "Orange Shake"; + data[5][0] = "Dried Apples"; + data[0][1] = "Sum of Purchases"; + data[1][1] = 286; + data[2][1] = 680; + data[3][1] = 288; + data[4][1] = 200; + data[5][1] = 731; + data[0][2] = "Sum of Future Expenses"; + data[1][2] = 1300; + data[2][2] = 700; + data[3][2] = 1280; + data[4][2] = 1200; + data[5][2] = 2660; + //Creates and Appends chart to the paragraph + WChart chart = paragraph.AppendChart(data, 470, 300); + //Sets chart type and title + chart.ChartTitle = "Purchase Details"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets series type + chart.Series[0].SerieType = OfficeChartType.Line_Markers; + chart.Series[1].SerieType = OfficeChartType.Bar_Clustered; + chart.PrimaryCategoryAxis.Title = "Products"; + chart.PrimaryValueAxis.Title = "In Dollars"; + //Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom; + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates a new Word document -Dim document As New WordDocument() -'Adds section to the document -Dim sec As IWSection = document.AddSection() -'Adds paragraph to the section -Dim paragraph As IWParagraph = sec.AddParagraph() -'Inputs data for chart -Dim data As Object()() = New Object(5)() {} -For i As Integer = 0 To 5 - data(i) = New Object(2) {} -Next -data(0)(0) = "" -data(1)(0) = "Camembert Pierrot" -data(2)(0) = "Alice Mutton" -data(3)(0) = "Roasted Tigers" -data(4)(0) = "Orange Shake" -data(5)(0) = "Dried Apples" -data(0)(1) = "Sum of Purchases" -data(1)(1) = 286 -data(2)(1) = 680 -data(3)(1) = 288 -data(4)(1) = 200 -data(5)(1) = 731 -data(0)(2) = "Sum of Future Expenses" -data(1)(2) = 1300 -data(2)(2) = 700 -data(3)(2) = 1280 -data(4)(2) = 1200 -data(5)(2) = 2660 -'Creates and Appends chart to the paragraph -Dim chart As WChart = paragraph.AppendChart(data, 470, 300) -'Sets chart type and title -chart.ChartTitle = "Purchase Details" -chart.ChartTitleArea.FontName = "Calibri" -chart.ChartTitleArea.Size = 14 -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None -'Sets series type -chart.Series(0).SerieType = OfficeChartType.Line_Markers -chart.Series(1).SerieType = OfficeChartType.Bar_Clustered -chart.PrimaryCategoryAxis.Title = "Products" -chart.PrimaryValueAxis.Title = "In Dollars" -'Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom -'Saves the document -document.Save("Sample.docx", FormatType.Docx) -'Closes the document -document.Close() +Using document As New WordDocument() + 'Adds section to the document + Dim sec As IWSection = document.AddSection() + 'Adds paragraph to the section + Dim paragraph As IWParagraph = sec.AddParagraph() + 'Inputs data for chart + Dim data As Object()() = New Object(5)() {} + For i As Integer = 0 To 5 + data(i) = New Object(2) {} + Next + data(0)(0) = "" + data(1)(0) = "Camembert Pierrot" + data(2)(0) = "Alice Mutton" + data(3)(0) = "Roasted Tigers" + data(4)(0) = "Orange Shake" + data(5)(0) = "Dried Apples" + data(0)(1) = "Sum of Purchases" + data(1)(1) = 286 + data(2)(1) = 680 + data(3)(1) = 288 + data(4)(1) = 200 + data(5)(1) = 731 + data(0)(2) = "Sum of Future Expenses" + data(1)(2) = 1300 + data(2)(2) = 700 + data(3)(2) = 1280 + data(4)(2) = 1200 + data(5)(2) = 2660 + 'Creates and Appends chart to the paragraph + Dim chart As WChart = paragraph.AppendChart(data, 470, 300) + 'Sets chart type and title + chart.ChartTitle = "Purchase Details" + chart.ChartTitleArea.FontName = "Calibri" + chart.ChartTitleArea.Size = 14 + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None + 'Sets series type + chart.Series(0).SerieType = OfficeChartType.Line_Markers + chart.Series(1).SerieType = OfficeChartType.Bar_Clustered + chart.PrimaryCategoryAxis.Title = "Products" + chart.PrimaryValueAxis.Title = "In Dollars" + 'Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -500,8 +507,10 @@ using (WordDocument document = new WordDocument()) //Set the legend. chart.HasLegend = true; //Save a Word document. - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } } // Get the data to create a pie chart. @@ -509,23 +518,25 @@ private static DataTable GetDataTable() { string path = Path.GetFullPath(@"../../Data/DataBase.mdb"); //Create a new instance of OleDbConnection. - OleDbConnection connection = new OleDbConnection(); - //Set the string to open a Database. - connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password=\"\";User ID=Admin;Data Source=" + path; - //Open the Database connection. - connection.Open(); - //Get all the data from the Database. - OleDbCommand query = new OleDbCommand("select * from Products", connection); - //Create a new instance of OleDbDataAdapter. - OleDbDataAdapter adapter = new OleDbDataAdapter(query); - //Create a new instance of DataSet. - DataSet dataSet = new DataSet(); - //Add rows in the Dataset. - adapter.Fill(dataSet); - //Create a DataTable from the Dataset. - DataTable table = dataSet.Tables[0]; - table.TableName = "Products"; - return table; + using (OleDbConnection connection = new OleDbConnection()) + { + //Set the string to open a Database. + connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password=\"\";User ID=Admin;Data Source=" + path; + //Open the Database connection. + connection.Open(); + //Get all the data from the Database. + OleDbCommand query = new OleDbCommand("select * from Products", connection); + //Create a new instance of OleDbDataAdapter. + OleDbDataAdapter adapter = new OleDbDataAdapter(query); + //Create a new instance of DataSet. + DataSet dataSet = new DataSet(); + //Add rows in the Dataset. + adapter.Fill(dataSet); + //Create a DataTable from the Dataset. + DataTable table = dataSet.Tables[0]; + table.TableName = "Products"; + return table; + } } // Set the value for the chart. @@ -586,49 +597,51 @@ private static DataTable GetDataTable() { string path = Path.GetFullPath(@"../../Data/DataBase.mdb"); //Create a new instance of OleDbConnection. - OleDbConnection connection = new OleDbConnection(); - //Set the string to open a Database. - connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password=\"\";User ID=Admin;Data Source=" + path; - //Open the Database connection. - connection.Open(); - //Get all the data from the Database. - OleDbCommand query = new OleDbCommand("select * from Products", connection); - //Create a new instance of OleDbDataAdapter. - OleDbDataAdapter adapter = new OleDbDataAdapter(query); - //Create a new instance of DataSet. - DataSet dataSet = new DataSet(); - //Add rows in the Dataset. - adapter.Fill(dataSet); - //Create a DataTable from the Dataset. - DataTable table = dataSet.Tables[0]; - table.TableName = "Products"; - return table; + using (OleDbConnection connection = new OleDbConnection()) + { + //Set the string to open a Database. + connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password=\"\";User ID=Admin;Data Source=" + path; + //Open the Database connection. + connection.Open(); + //Get all the data from the Database. + OleDbCommand query = new OleDbCommand("select * from Products", connection); + //Create a new instance of OleDbDataAdapter. + OleDbDataAdapter adapter = new OleDbDataAdapter(query); + //Create a new instance of DataSet. + DataSet dataSet = new DataSet(); + //Add rows in the Dataset. + adapter.Fill(dataSet); + //Create a DataTable from the Dataset. + DataTable table = dataSet.Tables[0]; + table.TableName = "Products"; + return table; + } } // Set the value for the chart. - private static void AddChartData(WChart chart, DataTable dataTable) - { - //Set the value for the chart data. - chart.ChartData.SetValue(1, 1, "Names"); - chart.ChartData.SetValue(1, 2, "Product"); - - int rowIndex = 2; - int colIndex = 1; - //Get the value from the DataTable and set the value for the chart data - foreach (DataRow row in dataTable.Rows) - { - foreach (object val in row.ItemArray) - { - string value = val.ToString(); - chart.ChartData.SetValue(rowIndex, colIndex, value); - colIndex++; - if (colIndex == 3) - break; - } - colIndex = 1; - rowIndex++; - } - } +private static void AddChartData(WChart chart, DataTable dataTable) +{ + //Set the value for the chart data. + chart.ChartData.SetValue(1, 1, "Names"); + chart.ChartData.SetValue(1, 2, "Product"); + + int rowIndex = 2; + int colIndex = 1; + //Get the value from the DataTable and set the value for the chart data + foreach (DataRow row in dataTable.Rows) + { + foreach (object val in row.ItemArray) + { + string value = val.ToString(); + chart.ChartData.SetValue(rowIndex, colIndex, value); + colIndex++; + if (colIndex == 3) + break; + } + colIndex = 1; + rowIndex++; + } +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -663,23 +676,24 @@ Private Function GetDataTable() As DataTable Dim path As String = System.IO.Path.GetFullPath("..\..\Data\DataBase.mdb") ' Create a new instance of OleDbConnection. - Dim connection As New OleDbConnection() - ' Set the string to open a Database. - connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & path - ' Open the Database connection. - connection.Open() - ' Get all the data from the Database. - Dim query As New OleDbCommand("select * from Products", connection) - ' Create a new instance of OleDbDataAdapter. - Dim adapter As New OleDbDataAdapter(query) - ' Create a new instance of DataSet. - Dim dataSet As New DataSet() - ' Add rows in the Dataset. - adapter.Fill(dataSet) - ' Create a DataTable from the Dataset. - Dim table As DataTable = dataSet.Tables(0) - table.TableName = "Products" - Return table + Using connection As New OleDbConnection() + ' Set the string to open a Database. + connection.ConnectionString = "Provider=Microsoft.JET.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & path + ' Open the Database connection. + connection.Open() + ' Get all the data from the Database. + Dim query As New OleDbCommand("select * from Products", connection) + ' Create a new instance of OleDbDataAdapter. + Dim adapter As New OleDbDataAdapter(query) + ' Create a new instance of DataSet. + Dim dataSet As New DataSet() + ' Add rows in the Dataset. + adapter.Fill(dataSet) + ' Create a DataTable from the Dataset. + Dim table As DataTable = dataSet.Tables(0) + table.TableName = "Products" + Return table + End Using End Function ' Set the value for the chart. @@ -712,7 +726,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Refreshing the Chart -The chart may not have the data in the referred excel file instead it may represent some other data. For those charts to have the excel data, it should be refreshed. +The chart may not have the data in the referred Excel file; instead, it may represent some other data. For those charts to display the Excel data, the chart should be refreshed. The following code example illustrates how to refresh the chart. @@ -730,41 +744,44 @@ using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx) // Refreshes the chart data. Set true to evaluate Excel formulas before refreshing, // or false to refresh only the data without evaluating formulas. chart.Refresh(false); - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); + //Saves the Word document to MemoryStream + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } //Closes the Word document - document.Close(); } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads the template document -WordDocument document = new WordDocument("Template.docx"); -//Gets the last paragraph -WParagraph paragraph = document.LastParagraph; -//Gets the chart entity from the paragraph items -WChart chart = paragraph.ChildEntities[1] as WChart; -// Refreshes the chart data. Set true to evaluate Excel formulas before refreshing, -// or false to refresh only the data without evaluating formulas. -chart.Refresh(false); -//Saves and closes the document -document.Save("Sample.docx", FormatType.Docx); -document.Close(); +using (WordDocument document = new WordDocument("Template.docx")) +{ + //Gets the last paragraph + WParagraph paragraph = document.LastParagraph; + //Gets the chart entity from the paragraph items + WChart chart = paragraph.ChildEntities[1] as WChart; + // Refreshes the chart data. Set true to evaluate Excel formulas before refreshing, + // or false to refresh only the data without evaluating formulas. + chart.Refresh(false); + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads the template document -Dim document As New WordDocument("Template.docx") -'Gets the last paragraph -Dim paragraph As WParagraph = document.LastParagraph -'Gets the chart entity from the paragraph items -Dim chart As WChart = TryCast(paragraph.ChildEntities(1), WChart) -'Refreshes the chart data. Set true to evaluate Excel formulas before refreshing, -'or false to refresh only the data without evaluating formulas. -chart.Refresh(false) -'Saves and closes the document -document.Save("Sample.docx", FormatType.Docx) -document.Close() +Using document As New WordDocument("Template.docx") + 'Gets the last paragraph + Dim paragraph As WParagraph = document.LastParagraph + 'Gets the chart entity from the paragraph items + Dim chart As WChart = TryCast(paragraph.ChildEntities(1), WChart) + 'Refreshes the chart data. Set True to evaluate Excel formulas before refreshing, + 'or False to refresh only the data without evaluating formulas. + chart.Refresh(False) + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -792,47 +809,50 @@ using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx) chart.ChartData.SetValue(4, 2, 70); //Refreshes chart data to set the modified values chart.Refresh(); - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); + //Saves the Word document to MemoryStream + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } //Closes the Word document - document.Close(); } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads the template document -WordDocument document = new WordDocument("Template.docx"); -//Gets the last paragraph -WParagraph paragraph = document.LastParagraph; -//Gets the chart entity from the paragraph items -WChart chart = paragraph.ChildEntities[0] as WChart; -//Modifies the data values of chart -chart.ChartData.SetValue(2, 2, 120); -chart.ChartData.SetValue(3, 2, 60); -chart.ChartData.SetValue(4, 2, 70); -//Refreshes chart data to set the modified values -chart.Refresh(); -//Saves and closes the document -document.Save("Sample.docx", FormatType.Docx); -document.Close(); +using (WordDocument document = new WordDocument("Template.docx")) +{ + //Gets the last paragraph + WParagraph paragraph = document.LastParagraph; + //Gets the chart entity from the paragraph items + WChart chart = paragraph.ChildEntities[0] as WChart; + //Modifies the data values of chart + chart.ChartData.SetValue(2, 2, 120); + chart.ChartData.SetValue(3, 2, 60); + chart.ChartData.SetValue(4, 2, 70); + //Refreshes chart data to set the modified values + chart.Refresh(); + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads the template document -Dim document As New WordDocument("Template.docx") -'Gets the last paragraph -Dim paragraph As WParagraph = document.LastParagraph -'Gets the chart entity from the paragraph items -Dim chart As WChart = TryCast(paragraph.ChildEntities(0), WChart) -'Modifies the data values of chart -chart.ChartData.SetValue(2, 2, 120) -chart.ChartData.SetValue(3, 2, 60) -chart.ChartData.SetValue(4, 2, 70) -'Refreshes chart data to set the modified values -chart.Refresh() -'Saves and closes the document -document.Save("Sample.docx", FormatType.Docx) -document.Close() +Using document As New WordDocument("Template.docx") + 'Gets the last paragraph + Dim paragraph As WParagraph = document.LastParagraph + 'Gets the chart entity from the paragraph items + Dim chart As WChart = TryCast(paragraph.ChildEntities(0), WChart) + 'Modifies the data values of chart + chart.ChartData.SetValue(2, 2, 120) + chart.ChartData.SetValue(3, 2, 60) + chart.ChartData.SetValue(4, 2, 70) + 'Refreshes chart data to set the modified values + chart.Refresh() + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -841,7 +861,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Customizing the Chart & its elements -A Chart is composed of various elements such as plot area, chart area, title area, legend, data labels, axis etc. The following screenshot illustrates the various elements of chart. +A Chart is composed of various elements such as plot area, chart area, title area, legend, data labels, axis, etc. The following screenshot illustrates the various elements of a chart. ![Illustrates the various elements of chart](workingwithchartsimages/Chart-Basic-Elements.jpeg) @@ -863,7 +883,7 @@ Customize the **chart area** by changing its border, colors, transparency, and m Customize the **chart plot area** by changing its border, colors, transparency, position and adding image using the **Word (DocIO) library**. For further information, click [here](https://help.syncfusion.com/document-processing/word/word-library/net/charts/chart-plot-area). ### Chart Series - Customize the **chart series** by changing the series name, type, color, border, and more using the **Word (DocIO) library**. For further information, click [here](https://help.syncfusion.com/document-processing/word/word-library/net/charts/chart-series). +Customize the **chart series** by changing the series name, type, color, border, and more using the **Word (DocIO) library**. For further information, click [here](https://help.syncfusion.com/document-processing/word/word-library/net/charts/chart-series). ### Chart Legend Customize the **chart legend** by changing the position, border, and modifying the legend entry using the **Word (DocIO) library**. For further information, click [here](https://help.syncfusion.com/document-processing/word/word-library/net/charts/chart-legend). @@ -878,6 +898,8 @@ Customize the **chart axes** by changing the title, border, font, rotation angle To add a data table to a chart, enable the [HasDataTable](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WChart.html#Syncfusion_DocIO_DLS_WChart_HasDataTable) property of the [WChart](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WChart.html) class. By default, it is false, hiding the data table. Setting this property to true displays the data table beneath the chart. +N> Ensure the [DataRange](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WChart.html#Syncfusion_DocIO_DLS_WChart_DataRange) property of the `WChart` is set before enabling `HasDataTable`; otherwise the data table renders without values. + The following code example illustrates how to add data table for chart. {% tabs %} @@ -913,80 +935,80 @@ using (WordDocument document = new WordDocument()) officeChartDataTable.HasHorzBorder = true; officeChartDataTable.HasVertBorder = true; //Saves the Word document to MemoryStream - MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.Docx); - document.Close(); + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} // Create a new Word document. -WordDocument document = new WordDocument(); -// Add a section to the document. -IWSection section = document.AddSection(); -// Add a paragraph to the section. -IWParagraph paragraph = section.AddParagraph(); -// Create and append the chart to the paragraph. -WChart chart = paragraph.AppendChart(446, 270); -// Set chart type. -chart.ChartType = OfficeChartType.Column_Clustered; -// Set chart data. -chart.ChartData.SetValue(2, 1, "Apples"); -chart.ChartData.SetValue(3, 1, "Grapes"); -chart.ChartData.SetValue(4, 1, "Banana"); -chart.ChartData.SetValue(1, 2, "Joey"); -chart.ChartData.SetValue(2, 2, 5); -chart.ChartData.SetValue(3, 2, 4); -chart.ChartData.SetValue(4, 2, 4); -// Define the data range for the chart. -chart.DataRange = chart.ChartData[1, 1, 4, 2]; -// Add data table to the chart. -chart.HasDataTable = true; -IOfficeChartDataTable officeChartDataTable = chart.DataTable; -// Customize the data table appearance. -officeChartDataTable.ShowSeriesKeys = true; -officeChartDataTable.HasBorders = true; -officeChartDataTable.HasHorzBorder = true; -officeChartDataTable.HasVertBorder = true; -//Saves the document -document.Save("Sample.docx", FormatType.Docx); -//Closes the document -document.Close(); +using (WordDocument document = new WordDocument()) +{ + // Add a section to the document. + IWSection section = document.AddSection(); + // Add a paragraph to the section. + IWParagraph paragraph = section.AddParagraph(); + // Create and append the chart to the paragraph. + WChart chart = paragraph.AppendChart(446, 270); + // Set chart type. + chart.ChartType = OfficeChartType.Column_Clustered; + // Set chart data. + chart.ChartData.SetValue(2, 1, "Apples"); + chart.ChartData.SetValue(3, 1, "Grapes"); + chart.ChartData.SetValue(4, 1, "Banana"); + chart.ChartData.SetValue(1, 2, "Joey"); + chart.ChartData.SetValue(2, 2, 5); + chart.ChartData.SetValue(3, 2, 4); + chart.ChartData.SetValue(4, 2, 4); + // Define the data range for the chart. + chart.DataRange = chart.ChartData[1, 1, 4, 2]; + // Add data table to the chart. + chart.HasDataTable = true; + IOfficeChartDataTable officeChartDataTable = chart.DataTable; + // Customize the data table appearance. + officeChartDataTable.ShowSeriesKeys = true; + officeChartDataTable.HasBorders = true; + officeChartDataTable.HasHorzBorder = true; + officeChartDataTable.HasVertBorder = true; + //Saves the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} ' Create a new Word document. -Dim document As New WordDocument() -' Add a section to the document. -Dim section As IWSection = document.AddSection() -' Add a paragraph to the section. -Dim paragraph As IWParagraph = section.AddParagraph() -' Create and append the chart to the paragraph. -Dim chart As WChart = paragraph.AppendChart(446, 270) -' Set chart type. -chart.ChartType = OfficeChartType.Column_Clustered -' Set chart data. -chart.ChartData.SetValue(2, 1, "Apples") -chart.ChartData.SetValue(3, 1, "Grapes") -chart.ChartData.SetValue(4, 1, "Banana") -chart.ChartData.SetValue(1, 2, "Joey") -chart.ChartData.SetValue(2, 2, 5) -chart.ChartData.SetValue(3, 2, 4) -chart.ChartData.SetValue(4, 2, 4) -' Define the data range for the chart. -chart.DataRange = chart.ChartData(1, 1, 4, 2) -' Add data table to the chart. -chart.HasDataTable = True -Dim officeChartDataTable As IOfficeChartDataTable = chart.DataTable -' Customize the data table appearance. -officeChartDataTable.ShowSeriesKeys = True -officeChartDataTable.HasBorders = True -officeChartDataTable.HasHorzBorder = True -officeChartDataTable.HasVertBorder = True -' Save the document. -document.Save("Sample.docx", FormatType.Docx) -' Close the document. -document.Close() +Using document As New WordDocument() + ' Add a section to the document. + Dim section As IWSection = document.AddSection() + ' Add a paragraph to the section. + Dim paragraph As IWParagraph = section.AddParagraph() + ' Create and append the chart to the paragraph. + Dim chart As WChart = paragraph.AppendChart(446, 270) + ' Set chart type. + chart.ChartType = OfficeChartType.Column_Clustered + ' Set chart data. + chart.ChartData.SetValue(2, 1, "Apples") + chart.ChartData.SetValue(3, 1, "Grapes") + chart.ChartData.SetValue(4, 1, "Banana") + chart.ChartData.SetValue(1, 2, "Joey") + chart.ChartData.SetValue(2, 2, 5) + chart.ChartData.SetValue(3, 2, 4) + chart.ChartData.SetValue(4, 2, 4) + ' Define the data range for the chart. + chart.DataRange = chart.ChartData(1, 1, 4, 2) + ' Add data table to the chart. + chart.HasDataTable = True + Dim officeChartDataTable As IOfficeChartDataTable = chart.DataTable + ' Customize the data table appearance. + officeChartDataTable.ShowSeriesKeys = True + officeChartDataTable.HasBorders = True + officeChartDataTable.HasHorzBorder = True + officeChartDataTable.HasVertBorder = True + ' Save the document. + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -995,186 +1017,195 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Applying 3D Formats -Essential® DocIO allows to modify the side wall, back wall, floor of the 3D chart. The following code snippet illustrates how to apply properties for side wall, floor and back wall of a 3D chart. +Essential® DocIO allows you to modify the side wall, back wall, and floor of a 3D chart. The following code snippet illustrates how to apply properties for the side wall, floor, and back wall of a 3D chart. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} //Creates a new Word document -WordDocument document = new WordDocument(); -//Adds section to the document -IWSection sec = document.AddSection(); -//Adds paragraph to the section -IWParagraph paragraph = sec.AddParagraph(); -//Loads the excel file as stream -Stream excelStream = File.OpenRead("Excel_Template.xlsx"); -//Creates and Appends chart to the paragraph with excel stream as parameter -WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); -//Sets chart type and title -chart.ChartType = OfficeChartType.Column_Clustered_3D; -chart.ChartTitle = "Purchase Details"; -chart.ChartTitleArea.FontName = "Calibri"; -chart.ChartTitleArea.Size = 14; -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; -//Sets name to chart series -chart.Series[0].Name = "Sum of Purchases"; -chart.Series[1].Name = "Sum of Future Expenses"; -chart.PrimaryCategoryAxis.Title = "Products"; -chart.PrimaryValueAxis.Title = "In Dollars"; -//Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom; -//Sets rotation and elevation values -chart.Rotation = 20; -chart.Elevation = 15; -//Sets side wall properties -chart.SideWall.Fill.FillType = OfficeFillType.SolidColor; +using (WordDocument document = new WordDocument()) +{ + //Adds section to the document + IWSection sec = document.AddSection(); + //Adds paragraph to the section + IWParagraph paragraph = sec.AddParagraph(); + //Loads the excel file as stream + using (Stream excelStream = File.OpenRead("Excel_Template.xlsx")) + { + //Creates and Appends chart to the paragraph with excel stream as parameter + WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); + //Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered_3D; + chart.ChartTitle = "Purchase Details"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets name to chart series + chart.Series[0].Name = "Sum of Purchases"; + chart.Series[1].Name = "Sum of Future Expenses"; + chart.PrimaryCategoryAxis.Title = "Products"; + chart.PrimaryValueAxis.Title = "In Dollars"; + //Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom; + //Sets rotation and elevation values + chart.Rotation = 20; + chart.Elevation = 15; + //Sets side wall properties + chart.SideWall.Fill.FillType = OfficeFillType.SolidColor; chart.SideWall.Fill.ForeColor = Color.White; chart.SideWall.Fill.BackColor = Color.White; -chart.SideWall.Border.LineColor = Syncfusion.Drawing.Color.Beige; -//Sets floor fill option. -chart.Floor.Fill.FillType = OfficeFillType.Pattern; -//Sets the floor pattern Type. -chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot; -//Sets the floor fore and Back ground color. -chart.Floor.Fill.ForeColor = Syncfusion.Drawing.Color.Blue; -chart.Floor.Fill.BackColor = Syncfusion.Drawing.Color.White; -//Sets the floor thickness. -chart.Floor.Thickness = 3; -//Sets the back wall fill option. -chart.BackWall.Fill.FillType = OfficeFillType.Gradient; -//Sets the Texture Type. -chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor; -chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down; + chart.SideWall.Border.LineColor = Syncfusion.Drawing.Color.Beige; + //Sets floor fill option. + chart.Floor.Fill.FillType = OfficeFillType.Pattern; + //Sets the floor pattern Type. + chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot; + //Sets the floor fore and Back ground color. + chart.Floor.Fill.ForeColor = Syncfusion.Drawing.Color.Blue; + chart.Floor.Fill.BackColor = Syncfusion.Drawing.Color.White; + //Sets the floor thickness. + chart.Floor.Thickness = 3; + //Sets the back wall fill option. + chart.BackWall.Fill.FillType = OfficeFillType.Gradient; + //Sets the gradient color type. + chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor; + chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down; chart.BackWall.Fill.ForeColor = Color.WhiteSmoke; chart.BackWall.Fill.BackColor = Color.LightBlue; -//Sets the Border Line color. -chart.BackWall.Border.LineColor = Syncfusion.Drawing.Color.Wheat; -//Sets the Picture Type. -chart.BackWall.PictureUnit = OfficeChartPictureType.stretch; -//Sets the back wall thickness. -chart.BackWall.Thickness = 10; -//Saves and closes the document -MemoryStream stream = new MemoryStream(); -document.Save(stream, FormatType.Docx); -document.Close(); + //Sets the Border Line color. + chart.BackWall.Border.LineColor = Syncfusion.Drawing.Color.Wheat; + //Sets the Picture Type. + chart.BackWall.PictureUnit = OfficeChartPictureType.stretch; + //Sets the back wall thickness. + chart.BackWall.Thickness = 10; + } + //Saves and closes the document + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates a new Word document -WordDocument document = new WordDocument(); -//Adds section to the document -IWSection sec = document.AddSection(); -//Adds paragraph to the section -IWParagraph paragraph = sec.AddParagraph(); -//Loads the excel file as stream -Stream excelStream = File.OpenRead("Excel_Template.xlsx"); -//Creates and Appends chart to the paragraph with excel stream as parameter -WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); -//Sets chart type and title -chart.ChartType = OfficeChartType.Column_Clustered_3D; -chart.ChartTitle = "Purchase Details"; -chart.ChartTitleArea.FontName = "Calibri"; -chart.ChartTitleArea.Size = 14; -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; -//Sets name to chart series -chart.Series[0].Name = "Sum of Purchases"; -chart.Series[1].Name = "Sum of Future Expenses"; -chart.PrimaryCategoryAxis.Title = "Products"; -chart.PrimaryValueAxis.Title = "In Dollars"; -//Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom; -//Sets rotation and elevation values -chart.Rotation = 20; -chart.Elevation = 15; -//Sets side wall properties -chart.SideWall.Fill.FillType = OfficeFillType.SolidColor; -chart.SideWall.Fill.ForeColor = Color.White; -chart.SideWall.Fill.BackColor = Color.White; -chart.SideWall.Border.LineColor = System.Drawing.Color.Beige; -//Sets floor fill option. -chart.Floor.Fill.FillType = OfficeFillType.Pattern; -//Sets the floor pattern Type. -chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot; -//Sets the floor fore and Back ground color. -chart.Floor.Fill.ForeColor = System.Drawing.Color.Blue; -chart.Floor.Fill.BackColor = System.Drawing.Color.White; -//Sets the floor thickness. -chart.Floor.Thickness = 3; -//Sets the back wall fill option. -chart.BackWall.Fill.FillType = OfficeFillType.Gradient; -//Sets the Texture Type. -chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor; -chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down; -chart.BackWall.Fill.ForeColor = Color.WhiteSmoke; -chart.BackWall.Fill.BackColor = Color.LightBlue; -//Sets the Border Line color. -chart.BackWall.Border.LineColor = System.Drawing.Color.Wheat; -//Sets the Picture Type. -chart.BackWall.PictureUnit = OfficeChartPictureType.stretch; -//Sets the back wall thickness. -chart.BackWall.Thickness = 10; -//Saves and closes the document -document.Save("Sample.docx", FormatType.Docx); -document.Close(); +using (WordDocument document = new WordDocument()) +{ + //Adds section to the document + IWSection sec = document.AddSection(); + //Adds paragraph to the section + IWParagraph paragraph = sec.AddParagraph(); + //Loads the excel file as stream + using (Stream excelStream = File.OpenRead("Excel_Template.xlsx")) + { + //Creates and Appends chart to the paragraph with excel stream as parameter + WChart chart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300); + //Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered_3D; + chart.ChartTitle = "Purchase Details"; + chart.ChartTitleArea.FontName = "Calibri"; + chart.ChartTitleArea.Size = 14; + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None; + //Sets name to chart series + chart.Series[0].Name = "Sum of Purchases"; + chart.Series[1].Name = "Sum of Future Expenses"; + chart.PrimaryCategoryAxis.Title = "Products"; + chart.PrimaryValueAxis.Title = "In Dollars"; + //Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom; + //Sets rotation and elevation values + chart.Rotation = 20; + chart.Elevation = 15; + //Sets side wall properties + chart.SideWall.Fill.FillType = OfficeFillType.SolidColor; + chart.SideWall.Fill.ForeColor = Color.White; + chart.SideWall.Fill.BackColor = Color.White; + chart.SideWall.Border.LineColor = System.Drawing.Color.Beige; + //Sets floor fill option. + chart.Floor.Fill.FillType = OfficeFillType.Pattern; + //Sets the floor pattern Type. + chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot; + //Sets the floor fore and Back ground color. + chart.Floor.Fill.ForeColor = System.Drawing.Color.Blue; + chart.Floor.Fill.BackColor = System.Drawing.Color.White; + //Sets the floor thickness. + chart.Floor.Thickness = 3; + //Sets the back wall fill option. + chart.BackWall.Fill.FillType = OfficeFillType.Gradient; + //Sets the gradient color type. + chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor; + chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down; + chart.BackWall.Fill.ForeColor = Color.WhiteSmoke; + chart.BackWall.Fill.BackColor = Color.LightBlue; + //Sets the Border Line color. + chart.BackWall.Border.LineColor = System.Drawing.Color.Wheat; + //Sets the Picture Type. + chart.BackWall.PictureUnit = OfficeChartPictureType.stretch; + //Sets the back wall thickness. + chart.BackWall.Thickness = 10; + } + //Saves and closes the document + document.Save("Sample.docx", FormatType.Docx); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Creates a new Word document -Dim document As New WordDocument() -'Adds section to the document -Dim sec As IWSection = document.AddSection() -'Adds paragraph to the section -Dim paragraph As IWParagraph = sec.AddParagraph() -'Loads the excel file as stream -Dim excelStream As Stream = File.OpenRead("Excel_Template.xlsx") -'Creates and Appends chart to the paragraph with excel stream as parameter -Dim chart As WChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300) -'Sets chart type and title -chart.ChartType = OfficeChartType.Column_Clustered_3D -chart.ChartTitle = "Purchase Details" -chart.ChartTitleArea.FontName = "Calibri" -chart.ChartTitleArea.Size = 14 -chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None -'Sets name to chart series -chart.Series(0).Name = "Sum of Purchases" -chart.Series(1).Name = "Sum of Future Expenses" -chart.PrimaryCategoryAxis.Title = "Products" -chart.PrimaryValueAxis.Title = "In Dollars" -'Sets position of legend -chart.Legend.Position = OfficeLegendPosition.Bottom -'Sets rotation and elevation values -chart.Rotation = 20 -chart.Elevation = 15 -'Sets side wall properties -chart.SideWall.Fill.FillType = OfficeFillType.SolidColor -chart.SideWall.Fill.ForeColor = Color.White -chart.SideWall.Fill.BackColor = Color.White -chart.SideWall.Border.LineColor = System.Drawing.Color.Beige -'Sets floor fill option. -chart.Floor.Fill.FillType = OfficeFillType.Pattern -'Sets the floor pattern Type. -chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot -'Sets the floor fore and Back ground color. -chart.Floor.Fill.ForeColor = System.Drawing.Color.Blue -chart.Floor.Fill.BackColor = System.Drawing.Color.White -'Sets the floor thickness. -chart.Floor.Thickness = 3 -'Sets the back wall fill option. -chart.BackWall.Fill.FillType = OfficeFillType.Gradient -'Sets the Texture Type. -chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor -chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down -chart.BackWall.Fill.ForeColor = Color.WhiteSmoke -chart.BackWall.Fill.BackColor = Color.LightBlue -'Sets the Border Line color. -chart.BackWall.Border.LineColor = System.Drawing.Color.Wheat -'Sets the Picture Type. -chart.BackWall.PictureUnit = OfficeChartPictureType.stretch -'Sets the back wall thickness. -chart.BackWall.Thickness = 10 -'Saves and closes the document -document.Save("Sample.docx", FormatType.Docx) -document.Close() +Using document As New WordDocument() + 'Adds section to the document + Dim sec As IWSection = document.AddSection() + 'Adds paragraph to the section + Dim paragraph As IWParagraph = sec.AddParagraph() + 'Loads the excel file as stream + Using excelStream As Stream = File.OpenRead("Excel_Template.xlsx") + 'Creates and Appends chart to the paragraph with excel stream as parameter + Dim chart As WChart = paragraph.AppendChart(excelStream, 1, "B2:C6", 470, 300) + 'Sets chart type and title + chart.ChartType = OfficeChartType.Column_Clustered_3D + chart.ChartTitle = "Purchase Details" + chart.ChartTitleArea.FontName = "Calibri" + chart.ChartTitleArea.Size = 14 + chart.ChartArea.Border.LinePattern = OfficeChartLinePattern.None + 'Sets name to chart series + chart.Series(0).Name = "Sum of Purchases" + chart.Series(1).Name = "Sum of Future Expenses" + chart.PrimaryCategoryAxis.Title = "Products" + chart.PrimaryValueAxis.Title = "In Dollars" + 'Sets position of legend + chart.Legend.Position = OfficeLegendPosition.Bottom + 'Sets rotation and elevation values + chart.Rotation = 20 + chart.Elevation = 15 + 'Sets side wall properties + chart.SideWall.Fill.FillType = OfficeFillType.SolidColor + chart.SideWall.Fill.ForeColor = Color.White + chart.SideWall.Fill.BackColor = Color.White + chart.SideWall.Border.LineColor = System.Drawing.Color.Beige + 'Sets floor fill option. + chart.Floor.Fill.FillType = OfficeFillType.Pattern + 'Sets the floor pattern Type. + chart.Floor.Fill.Pattern = OfficeGradientPattern.Pat_Divot + 'Sets the floor fore and Back ground color. + chart.Floor.Fill.ForeColor = System.Drawing.Color.Blue + chart.Floor.Fill.BackColor = System.Drawing.Color.White + 'Sets the floor thickness. + chart.Floor.Thickness = 3 + 'Sets the back wall fill option. + chart.BackWall.Fill.FillType = OfficeFillType.Gradient + 'Sets the gradient color type. + chart.BackWall.Fill.GradientColorType = OfficeGradientColor.TwoColor + chart.BackWall.Fill.GradientStyle = OfficeGradientStyle.Diagonl_Down + chart.BackWall.Fill.ForeColor = Color.WhiteSmoke + chart.BackWall.Fill.BackColor = Color.LightBlue + 'Sets the Border Line color. + chart.BackWall.Border.LineColor = System.Drawing.Color.Wheat + 'Sets the Picture Type. + chart.BackWall.PictureUnit = OfficeChartPictureType.stretch + 'Sets the back wall thickness. + chart.BackWall.Thickness = 10 + End Using + 'Saves and closes the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -1190,59 +1221,62 @@ The following code example illustrates how to remove the chart from the document {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Charts/Remove-chart-from-Word-document/.NET/Remove-chart-from-Word-document/Program.cs" %} //Loads the template document FileStream fileStreamPath = new FileStream("Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); -WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx); -//Gets the last paragraph -WParagraph paragraph = document.LastParagraph; -//Gets the chart entity and remove it from paragraph -foreach (ParagraphItem item in paragraph.ChildEntities) +using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx)) { - if (item is WChart) + //Gets the last paragraph + WParagraph paragraph = document.LastParagraph; + //Gets the chart entity and remove it from paragraph + foreach (ParagraphItem item in paragraph.ChildEntities) + { + if (item is WChart) + { + paragraph.ChildEntities.Remove(item); + break; + } + } + //Saves the Word document to MemoryStream + using (MemoryStream stream = new MemoryStream()) { - paragraph.ChildEntities.Remove(item); - break; + document.Save(stream, FormatType.Docx); } } -//Saves the Word document to MemoryStream -MemoryStream stream = new MemoryStream(); -document.Save(stream, FormatType.Docx); -//Closes the document -document.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads the template document -WordDocument document = new WordDocument("Template.docx"); -//Gets the last paragraph -WParagraph paragraph = document.LastParagraph; -//Gets the chart entity and remove it from paragraph -foreach (ParagraphItem item in paragraph.ChildEntities) +using (WordDocument document = new WordDocument("Template.docx")) { - if (item is WChart) + //Gets the last paragraph + WParagraph paragraph = document.LastParagraph; + //Gets the chart entity and remove it from paragraph + foreach (ParagraphItem item in paragraph.ChildEntities) { - paragraph.ChildEntities.Remove(item); - break; + if (item is WChart) + { + paragraph.ChildEntities.Remove(item); + break; + } } + //Saves the document + document.Save("Sample.docx", FormatType.Docx); } -//Saves and closes the document -document.Save("Sample.docx", FormatType.Docx); -document.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads the template document -Dim document As New WordDocument("Template.docx") -'Gets the last paragraph -Dim paragraph As WParagraph = document.LastParagraph -'Gets the chart entity and removes it from paragraph -For Each item As ParagraphItem In paragraph.ChildEntities -If TypeOf item Is WChart Then -paragraph.ChildEntities.Remove(item) -Exit For -End If -Next -'Saves and closes the document -document.Save("Sample.docx", FormatType.Docx) -document.Close() +Using document As New WordDocument("Template.docx") + 'Gets the last paragraph + Dim paragraph As WParagraph = document.LastParagraph + 'Gets the chart entity and removes it from paragraph + For Each item As ParagraphItem In paragraph.ChildEntities + If TypeOf item Is WChart Then + paragraph.ChildEntities.Remove(item) + Exit For + End If + Next + 'Saves the document + document.Save("Sample.docx", FormatType.Docx) +End Using {% endhighlight %} {% endtabs %} @@ -1339,57 +1373,58 @@ using (FileStream docStream = new FileStream("TemplateWithChart.docx", FileMode. {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads an existing Word document. -WordDocument wordDocument = new WordDocument("TemplateWithChart.docx", FormatType.Docx); -//Initializes the ChartToImageConverter for converting charts during Word to image conversion. -wordDocument.ChartToImageConverter = new ChartToImageConverter(); -//Sets the scaling mode for charts. (Normal mode reduces the file size) -wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal; -//Gets the first paragraph from section. -WParagraph paragraph = wordDocument.LastSection.Paragraphs[0]; -//Gets the chart element in the paragarph item. -WChart chart = paragraph.ChildEntities[0] as WChart; -//Creating the memory stream for chart image. -MemoryStream stream = new MemoryStream(); -//Converts chart to image. -wordDocument.ChartToImageConverter.SaveAsImage(chart.OfficeChart, stream); -Image image = Image.FromStream(stream); -//Dispose the stream. -stream.Close(); -//Saving image stream to file. -image.Save("ChartToImage.jpeg", ImageFormat.Jpeg); -//Closes the document. -wordDocument.Close(); +using (WordDocument wordDocument = new WordDocument("TemplateWithChart.docx", FormatType.Docx)) +{ + //Initializes the ChartToImageConverter for converting charts during Word to image conversion. + wordDocument.ChartToImageConverter = new ChartToImageConverter(); + //Sets the scaling mode for charts. (Normal mode reduces the file size) + wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal; + //Gets the first paragraph from section. + WParagraph paragraph = wordDocument.LastSection.Paragraphs[0]; + //Gets the chart element in the paragraph item. + WChart chart = paragraph.ChildEntities[0] as WChart; + //Creating the memory stream for chart image. + using (MemoryStream stream = new MemoryStream()) + { + //Converts chart to image. + wordDocument.ChartToImageConverter.SaveAsImage(chart.OfficeChart, stream); + using (Image image = Image.FromStream(stream)) + { + //Saving image stream to file. + image.Save("ChartToImage.jpeg", ImageFormat.Jpeg); + } + } +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Loads an existing Word document. -Dim wordDocument As New WordDocument("TemplateWithChart.docx", FormatType.Docx) -'Initializes the ChartToImageConverter for converting charts during Word to image conversion. -wordDocument.ChartToImageConverter = New ChartToImageConverter() -'Sets the scaling mode for charts. (Normal mode reduces the file size) -wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal -'Gets the first paragraph from section. -Dim paragraph As WParagraph = wordDocument.LastSection.Paragraphs(0) -'Gets the chart element in the paragarph item. -Dim chart As WChart = TryCast(paragraph.ChildEntities(0),WChart) -'Creating the memory stream for chart image. -Dim stream As New MemoryStream() -'Converts chart to image. -wordDocument.ChartToImageConverter.SaveAsImage(chart.OfficeChart, stream) -Dim image As Image = Image.FromStream(stream) -'Dispose the stream. -stream.Close() -'Saving image stream to file. -image.Save("ChartToImage.jpeg", ImageFormat.Jpeg) -'Closes the document. -wordDocument.Close() +Using wordDocument As New WordDocument("TemplateWithChart.docx", FormatType.Docx) + 'Initializes the ChartToImageConverter for converting charts during Word to image conversion. + wordDocument.ChartToImageConverter = New ChartToImageConverter() + 'Sets the scaling mode for charts. (Normal mode reduces the file size) + wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal + 'Gets the first paragraph from section. + Dim paragraph As WParagraph = wordDocument.LastSection.Paragraphs(0) + 'Gets the chart element in the paragraph item. + Dim chart As WChart = TryCast(paragraph.ChildEntities(0), WChart) + 'Creating the memory stream for chart image. + Using stream As New MemoryStream() + 'Converts chart to image. + wordDocument.ChartToImageConverter.SaveAsImage(chart.OfficeChart, stream) + Using image As Image = Image.FromStream(stream) + 'Saving image stream to file. + image.Save("ChartToImage.jpeg", ImageFormat.Jpeg) + End Using + End Using +End Using {% endhighlight %} {% endtabs %} You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Charts/Convert-chart-to-image). -N> 1. To convert chart in Word document as image, it is need to refer chart conversion related [assemblies](https://help.syncfusion.com/document-processing/word/word-library/net/assemblies-required#converting-charts) or [NuGet packages](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required#converting-charts). +N> 1. To convert chart in Word document as image, you need to refer chart conversion related [assemblies](https://help.syncfusion.com/document-processing/word/word-library/net/assemblies-required#converting-charts) or [NuGet packages](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required#converting-charts). N> 2. The ChartToImageConverter is supported from .NET Framework 4.0 onwards. ## Supported Chart Types diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Comments.md b/Document-Processing/Word/Word-Library/NET/Working-with-Comments.md index 8cf434b1d8..c4e06e6b1d 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Comments.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Comments.md @@ -7,9 +7,9 @@ documentation: UG --- # Working with Comments -A comment is a note or annotation that an author or reviewer can add to a document. DocIO represents comment with [WComment](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WComment.html) instance. +A comment is a note or annotation that an author or reviewer can add to a document. DocIO represents a comment with a [WComment](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WComment.html) instance. -N> The comment start and end ranges and dates can be preserved only on processing an existing document that already contains these information for each comment. +N> The comment start and end ranges and dates can be preserved only on processing an existing document that already contains this information for each comment. ## Adding a Comment @@ -33,9 +33,9 @@ paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the WComment comment = paragraph.AppendComment("comment test"); //Specifies the author of the comment comment.Format.User = "Peter"; -//Specifies the initial of the author +//Specifies the initials of the author comment.Format.UserInitials = "St"; -//Set the date and time for comment +//Sets the date and time for the comment comment.Format.DateTime = DateTime.Now; //Saves the Word document to MemoryStream. MemoryStream stream = new MemoryStream(); @@ -56,9 +56,9 @@ paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the WComment comment = paragraph.AppendComment("comment test"); //Specifies the author of the comment comment.Format.User = "Peter"; -//Specifies the initial of the author +//Specifies the initials of the author comment.Format.UserInitials = "St"; -//Set the date and time for comment +//Sets the date and time for the comment comment.Format.DateTime = DateTime.Now; //Saves and closes the Word document document.Save("Comment.docx", FormatType.Docx); @@ -77,8 +77,10 @@ paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the Dim comment As WComment = paragraph.AppendComment("comment test") 'Specifies the author of the comment comment.Format.User = "Peter" -'Specifies the initial of the author +'Specifies the initials of the author comment.Format.UserInitials = "St" +'Sets the date and time for the comment +comment.Format.DateTime = DateTime.Now 'Saves and closes the Word document document.Save("Comment.docx", FormatType.Docx) document.Close() @@ -155,11 +157,11 @@ using (FileStream fileStream = new FileStream("Input.docx", FileMode.Open, FileA //Open the existing Word document. using (WordDocument document = new WordDocument(fileStream, FormatType.Docx)) { - //Find all occurrence of a particular text ending with comma in the document using regex. + //Find all occurrences of a particular text ending with a comma in the document using regex. TextSelection[] textSelection = document.FindAll(new Regex("\\w+,")); if (textSelection != null) { - //Iterates through each occurrence and comment it. + //Iterates through each occurrence and adds a comment to it. for (int i = 0; i < textSelection.Count(); i++) { //Get the found text as a single text range. @@ -168,17 +170,17 @@ using (FileStream fileStream = new FileStream("Input.docx", FileMode.Open, FileA WParagraph paragraph = textRange.OwnerParagraph; //Get the index of the found text. int textIndex = paragraph.ChildEntities.IndexOf(textRange); - //Add comment to a paragraph. + //Add a comment to a paragraph. WComment comment = paragraph.AppendComment("comment test_" + i); //Specify the author of the comment. comment.Format.User = "Peter"; - //Specify the initial of the author. + //Specify the initials of the author. comment.Format.UserInitials = "St"; //Set the date and time for the comment. comment.Format.DateTime = DateTime.Now; - //Insert the comment next to the textrange. + //Insert the comment next to the text range. paragraph.ChildEntities.Insert(textIndex + 1, comment); - //Add the paragraph items to the commented items. + //Add the paragraph item to the commented items. comment.AddCommentedItem(textRange); } } @@ -197,11 +199,11 @@ using (FileStream fileStream = new FileStream("Input.docx", FileMode.Open, FileA //Open the existing Word document. using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) { - //Find all occurrence of a particular text ending with comma in the document using regex. + //Find all occurrences of a particular text ending with a comma in the document using regex. TextSelection[] textSelection = document.FindAll(new Regex("\\w+,")); if (textSelection != null) { - //Iterates through each occurrence and comment it. + //Iterates through each occurrence and adds a comment to it. for (int i = 0; i < textSelection.Count(); i++) { //Get the found text as a single text range. @@ -210,21 +212,21 @@ using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) WParagraph paragraph = textRange.OwnerParagraph; //Get the index of the found text. int textIndex = paragraph.ChildEntities.IndexOf(textRange); - //Add comment to a paragraph. + //Add a comment to a paragraph. WComment comment = paragraph.AppendComment("comment test_" + i); //Specify the author of the comment. comment.Format.User = "Peter"; - //Specify the initial of the author. + //Specify the initials of the author. comment.Format.UserInitials = "St"; //Set the date and time for the comment. comment.Format.DateTime = DateTime.Now; - //Insert the comment next to the textrange. + //Insert the comment next to the text range. paragraph.ChildEntities.Insert(textIndex + 1, comment); - //Add the paragraph items to the commented items. + //Add the paragraph item to the commented items. comment.AddCommentedItem(textRange); - //Save the Word document. - document.Save("Result.docx"); } + //Save the Word document. + document.Save("Result.docx"); } } @@ -232,31 +234,31 @@ using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} Using document As New WordDocument("Input.docx", FormatType.Docx) - ' Find all occurrences of a particular text ending with a comma in the document using regex. + 'Find all occurrences of a particular text ending with a comma in the document using regex. Dim textSelection As TextSelection() = document.FindAll(New Regex("\w+,")) If textSelection IsNot Nothing Then - ' Iterate through each occurrence and add a comment. + 'Iterates through each occurrence and adds a comment to it. For i As Integer = 0 To textSelection.Count() - 1 - ' Get the found text as a single text range. + 'Get the found text as a single text range. Dim textRange As WTextRange = textSelection(i).GetAsOneRange() - ' Get the owner paragraph of the found text. + 'Get the owner paragraph of the found text. Dim paragraph As WParagraph = textRange.OwnerParagraph - ' Get the index of the found text. + 'Get the index of the found text. Dim textIndex As Integer = paragraph.ChildEntities.IndexOf(textRange) - ' Add a comment to a paragraph. + 'Add a comment to a paragraph. Dim comment As WComment = paragraph.AppendComment("comment test_" & i) - ' Specify the author of the comment. + 'Specify the author of the comment. comment.Format.User = "Peter" - ' Specify the initials of the author. + 'Specify the initials of the author. comment.Format.UserInitials = "St" - ' Set the date and time for the comment. + 'Set the date and time for the comment. comment.Format.DateTime = DateTime.Now - ' Insert the comment next to the text range. + 'Insert the comment next to the text range. paragraph.ChildEntities.Insert(textIndex + 1, comment) - ' Add the paragraph items to the commented items. + 'Add the paragraph item to the commented items. comment.AddCommentedItem(textRange) Next - ' Save the Word document. + 'Save the Word document. document.Save("Result.docx") End If End Using @@ -270,7 +272,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync You can either remove all the comments or a particular comment from the Word document. -The following code illustrates how to remove all the comments in Word document. +The following code illustrates how to remove all the comments in the Word document. {% tabs %} @@ -306,16 +308,16 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Comments/Remove-all-comments-in-Word-document). -The following code illustrates how to remove a particular comment from Word document. +The following code illustrates how to remove a particular comment from a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Comments/Remove-particular-comment-from-Word/.NET/Remove-particular-comment-from-Word/Program.cs" %} FileStream fileStreamPath = new FileStream("Comment.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx); -//Removes second comments from a document. +//Removes the second comment from the document. document.Comments.RemoveAt(1); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Closes the document @@ -324,7 +326,7 @@ document.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} WordDocument document = new WordDocument("Comment.docx"); -//Removes second comments from a document. +//Removes the second comment from the document. document.Comments.RemoveAt(1); //Saves and closes the Word document document.Save("Result.docx", FormatType.Docx); @@ -333,7 +335,7 @@ document.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} Dim document As New WordDocument("Comment.docx") -'Removes second comments from a document. +'Removes the second comment from the document. document.Comments.RemoveAt(1) 'Saves and closes the Word document document.Save("Result.docx", FormatType.Docx) @@ -346,7 +348,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Accessing parent comment -You can access the parent comment of a particular comment (reply) in a Word document using [Ancestor](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WComment.html#Syncfusion_DocIO_DLS_WComment_Ancestor) API. The ancestor for parent comment returns `null` as default. +You can access the parent comment of a particular comment (reply) in a Word document using [Ancestor](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WComment.html#Syncfusion_DocIO_DLS_WComment_Ancestor) API. The ancestor of a parent comment returns `null` by default. The following code examples show how to access the parent comment of a particular comment in a Word document. @@ -355,35 +357,34 @@ The following code examples show how to access the parent comment of a particula {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Comments/Access-parent-comment/.NET/Access-parent-comment/Program.cs" %} FileStream fileStreamPath = new FileStream("Comment.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx); -// Get the Ancestor comment. -document.Comments[1].Ancestor; -//Save the Word document to MemoryStream. +//Get the ancestor comment. +WComment ancestorComment = document.Comments[1].Ancestor; +//Save the Word document to MemoryStream. MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); //Close the document. document.Close(); stream.Position = 0; -//Download the Word document in the browser +//Download the Word document in the browser. return File(stream, "application/msword", "Result.docx"); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} //Load an existing Word document into DocIO instance. WordDocument document = new WordDocument("Comment.docx"); -//Get the Ancestor comment. +//Get the ancestor comment. WComment ancestorComment = document.Comments[1].Ancestor; -//Save and Close the Word document. +//Save and close the Word document. document.Save("Result.docx", FormatType.Docx); document.Close(); - {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Load an existing Word document into DocIO instance. Dim document As WordDocument = New WordDocument("Comment.docx") -'Get the Ancestor comment. -Dim ancestorComment As WComment = document.Comments[1].Ancestor -'Save and Close the Word document. +'Get the ancestor comment. +Dim ancestorComment As WComment = document.Comments(1).Ancestor +'Save and close the Word document. document.Save("Result.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -394,7 +395,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Retrieve the commented word or items -The following code example illustrates how to get the paragraph item where it exists in the commented region based on the existing comment in the Word document. +The following code example illustrates how to retrieve the paragraph item that exists in the commented region of a particular comment in the Word document. {% tabs %} @@ -405,10 +406,10 @@ using(WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx)) //Iterate the comments in the Word document. foreach (WComment comment in document.Comments) { - //Get the commented word or part of a particular comment. + //Get the commented text or items of a particular comment. if (comment.TextBody.LastParagraph.Text == "This is the second comment.") ParagraphItemCollection paragraphItem = comment.CommentedItems; - } + } //Save the Word document to MemoryStream. MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); @@ -424,10 +425,10 @@ using(WordDocument document = new WordDocument("Comment.docx")) //Iterate the comments in the Word document. foreach (WComment comment in document.Comments) { - //Get the commented word or part of a particular comment. + //Get the commented text or items of a particular comment. if (comment.TextBody.LastParagraph.Text == "This is the second comment.") ParagraphItemCollection paragraphItem = comment.CommentedItems; - } + } document.Save("Result.docx", FormatType.Docx); } {% endhighlight %} @@ -436,6 +437,7 @@ using(WordDocument document = new WordDocument("Comment.docx")) Using document As New WordDocument("Comment.docx") 'Iterate the comments in the Word document. For Each comment As WComment In document.Comments + 'Get the commented text or items of a particular comment. If comment.TextBody.LastParagraph.Text = "This is the second comment." Then Dim paragraphItem As ParagraphItemCollection = comment.CommentedItems End If diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Find-and-Replace.md b/Document-Processing/Word/Word-Library/NET/Working-with-Find-and-Replace.md index 19ed7f2067..cf69caa128 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Find-and-Replace.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Find-and-Replace.md @@ -7,7 +7,7 @@ documentation: UG --- # Working with Find and Replace in Word Library -You can search a particular text you like to change and replace it with another text or part of the document. +You can search for particular text you want to change and replace it with another text or part of the document. To quickly get started with the Find and Replace options in a Word document, please check out this video: {% youtube "https://www.youtube.com/watch?v=EJDihId35nI" %} @@ -336,7 +336,7 @@ document.Close(); 'Loads the template document Dim document As New WordDocument("Template.docx", FormatType.Docx) 'Find the first occurrence of a particular text in the document -Dim textSelection As TextSelection = document.Find("AdventureWorks", false, true) +Dim textSelection As TextSelection = document.Find("AdventureWorks", False, True) 'Gets the found text as single text range Dim textRange As WTextRange = textSelection.GetAsOneRange() 'Modifies the text @@ -790,7 +790,7 @@ using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) 'Load an existing Word document. Using document As WordDocument = New WordDocument("Input.docx", FormatType.Docx) 'Replace all occurrences of non-breaking spaces with regular spaces. - document.Replace(ControlChar.NonBreakingSpace, ControlChar.Space, false, False) + document.Replace(ControlChar.NonBreakingSpace, ControlChar.Space, False, False) 'Save the Word document. document.Save("Sample.docx", FormatType.Docx) End Using @@ -803,7 +803,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Find and replace text with an image You can find placeholder text in a Word document and replace it with any desired image. -The following code example illustrates how to find and replace text in a word document with an image +The following code example illustrates how to find and replace text in a Word document with an image. {% tabs %} @@ -855,7 +855,7 @@ document.Close(); Dim document As WordDocument = New WordDocument("Template.docx") 'Finds all the image placeholder text in the Word document Dim textSelections() As TextSelection = document.FindAll(New Regex("^//(.*)")) -For i As Integer = 0 To textSelections.Length – 1 +For i As Integer = 0 To textSelections.Length - 1 'Replaces the image placeholder text with desired image Dim paragraph As WParagraph = New WParagraph(document) Dim picture As WPicture = CType(paragraph.AppendPicture(Image.FromFile("Filepath" + textSelections(i).SelectedText + ".png")), WPicture) @@ -937,7 +937,7 @@ document.Close(); 'Loads the template document Dim document As WordDocument = New WordDocument("Template.docx") 'Finds all the placeholder text enclosed within '«' and '»' in the Word document -Dim textSelections() As TextSelection = document.FindAll(New Regex("([(?i)image(?-i)]*:*[a-zA-Z0-9 ]*:*[a-zA-Z0-9 ]+)»")) +Dim textSelections() As TextSelection = document.FindAll(New Regex("«([(?i)image(?-i)]*:*[a-zA-Z0-9 ]*:*[a-zA-Z0-9 ]+)»")) Dim searchedPlaceholders() As String = New String(textSelections.Length - 1) {} For i As Integer = 0 To textSelections.Length - 1 searchedPlaceholders(i) = textSelections(i).SelectedText @@ -946,7 +946,7 @@ For i As Integer = 0 To searchedPlaceholders.Length - 1 'Replaces the placeholder text enclosed within '«' and '»' with desired merge field Dim paragraph As WParagraph = New WParagraph(document) paragraph.AppendField(searchedPlaceholders(i).TrimStart("«").TrimEnd("»"), FieldType.FieldMergeField) - Dim newSelection As TextSelection = New TextSelection(paragraph, 0, paragraph.Items.Count) + Dim newSelection As TextSelection = New TextSelection(paragraph, 0, paragraph.Items.Count) Dim bodyPart As TextBodyPart = New TextBodyPart(document) bodyPart.BodyItems.Add(paragraph) document.Replace(searchedPlaceholders(i), bodyPart, True, True, True) @@ -1059,7 +1059,7 @@ Dim bodyPart As TextBodyPart = New TextBodyPart(document) bodyPart.BodyItems.Add(table) document.Replace("[Suppliers table]", bodyPart, True, True, True) 'Saves the Word document -document.Save("Result.docx", FormatType.Docx) +document.Save("Sample.docx", FormatType.Docx) 'Closes the document document.Close() {% endhighlight %} @@ -1193,7 +1193,7 @@ The following code example provides supporting methods for the above code. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} -Private void ImportDataToRow(XmlReader reader, WTableRow tableRow) +private void ImportDataToRow(XmlReader reader, WTableRow tableRow) { if (reader == null) throw new Exception("reader"); @@ -1244,7 +1244,7 @@ Private void ImportDataToRow(XmlReader reader, WTableRow tableRow) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Private void ImportDataToRow(XmlReader reader, WTableRow tableRow) +private void ImportDataToRow(XmlReader reader, WTableRow tableRow) { if (reader == null) throw new Exception("reader"); @@ -1381,8 +1381,8 @@ for (int i = 0; i < textSelections.Length; i++) document.Replace(textSelections[i].SelectedText, subDocument, true, true); subDocument.Dispose(); } -//Saves and closes the document instance -document.Save("Result.docx"); +//Saves and closes the document +document.Save("Sample.docx"); document.Close(); {% endhighlight %} @@ -1397,8 +1397,8 @@ For i As Integer = 0 To textSelections.Length - 1 document.Replace(textSelections(i).SelectedText, subDocument, True, True) subDocument.Dispose() Next -'Saves and closes the document instance -document.Save("Result.docx") +'Saves and closes the document +document.Save("Sample.docx") document.Close() {% endhighlight %} @@ -1462,7 +1462,7 @@ Dim subDocument As WordDocument = New WordDocument("Source.docx", FormatType.Doc Dim replacePart As TextBodyPart = New TextBodyPart(subDocument) 'Gets the content from another Word document For Each bodyItem As TextBodyItem In subDocument.LastSection.Body.ChildEntities - replacePart.BodyItems.Add(bodyItem.Clone) + replacePart.BodyItems.Add(bodyItem.Clone()) Next Dim placeholderText As String = "Suppliers/Vendors of Northwind" + "Customers of Northwind" + "Employee details of Northwind traders" + "The product information" + "The inventory details" + "The shippers" + "Purchase Order transactions" + "Sales Order transaction" + "Inventory transactions" + "Invoices" + "[end replace]" 'Finds the text that extends to several paragraphs and replaces it with desired content @@ -1544,7 +1544,7 @@ The following code example illustrates how to replace the pattern of text with n {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Find-and-Replace/Replace-pattern-text-with-normal-text/.NET/Replace-pattern-text-with-normal-text/Program.cs" %} -//Open the file as Stream. +//Open the file as a Stream. using (FileStream docStream = new FileStream("Template.docx", FileMode.Open, FileAccess.Read)) { //Load the file stream into a Word document. @@ -1806,11 +1806,11 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Find and format text -You can able to find and format the text in Word document using DocIO. +You can find and format the text in a Word document using DocIO. ### Find and highlight all in Word document -You can find text in a Word document and format or highlight it .You can find the first occurrence of text using the [FindAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FindAll_System_String_System_Boolean_System_Boolean_) method. Find the next occurrences of the text using the [FindNext](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FindNext_Syncfusion_DocIO_DLS_TextBodyItem_System_String_System_Boolean_System_Boolean_) method. +You can find text in a Word document and format or highlight it. You can find the first occurrence of text using the [FindAll](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FindAll_System_String_System_Boolean_System_Boolean_) method. Find the next occurrences of the text using the [FindNext](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FindNext_Syncfusion_DocIO_DLS_TextBodyItem_System_String_System_Boolean_System_Boolean_) method. The following code example illustrates how to find all occurrences of a length of text and highlight it. diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Footnotes-and-endnotes.md b/Document-Processing/Word/Word-Library/NET/Working-with-Footnotes-and-endnotes.md index 7e6ec08113..2b6319320c 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Footnotes-and-endnotes.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Footnotes-and-endnotes.md @@ -1,5 +1,5 @@ --- -title: Working with Footnotes and endnotes | DocIO | Syncfusion +title: Working with Footnotes and Endnotes | DocIO | Syncfusion description: Learn how to add, modify, and remove footnotes and endnotes in a Word document using the .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -7,18 +7,18 @@ documentation: UG --- # Footnotes and endnotes -Footnotes and endnotes are separate text body contents used in documents to show the source of supplementary information that does not interrupt the normal body text of the Word document. Footnotes are typically located at the bottom of a page or beneath text being referenced, and endnotes are typically placed at the end of a document or at the end of a section. When document has been divided up into one or more sections, each section of a document can contain endnotes. +Footnotes and endnotes are separate text body contents used in documents to show the source of supplementary information that does not interrupt the normal body text of the Word document. Footnotes are typically located at the bottom of a page or beneath the text being referenced, and endnotes are typically placed at the end of a document or at the end of a section. When a document has been divided into one or more sections, each section of the document can contain endnotes. Both footnotes and endnotes consist of two parts: * A note reference mark with numbering value in the body text to indicate that additional information is in a footnote or endnote at the end of the page or the end of the document or section. * The footnote or endnote text body content. -## Adding a Footnotes +## Adding Footnotes N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. -The following code example shows how to insert the footnotes into the Word document. +The following code example shows how to insert footnotes into a Word document. {% tabs %} @@ -101,7 +101,7 @@ paragraph.AppendText("Sample content for footnotes").CharacterFormat.Bold = True 'Adds footnote text paragraph = footnote.TextBody.AddParagraph() paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company.") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -110,9 +110,9 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Footnotes-and-Endnotes/Add-footnotes-in-Word-document). -## Adding a Endnotes +## Adding Endnotes -The following code example shows how to insert the endnotes into the Word document. +The following code example shows how to insert endnotes into a Word document. {% tabs %} @@ -168,7 +168,7 @@ paragraph.AppendText("Sample content for endnotes").CharacterFormat.Bold = true; //Adds footnote text paragraph = endnote.TextBody.AddParagraph(); paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company."); -//Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx); document.Close(); {% endhighlight %} @@ -195,7 +195,7 @@ paragraph.AppendText("Sample content for endnotes").CharacterFormat.Bold = True 'Adds footnote text paragraph = endnote.TextBody.AddParagraph() paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company.") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -206,9 +206,9 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Set Footnotes and Endnotes position -Footnotes are typically located at the bottom of a page or beneath the text being referenced, and endnotes are typically placed at the end of a document or at the end of a section. This can be done using [FootnotePosition](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FootnotePosition) API and [EndnotePosition](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_EndnotePosition) API. +Footnotes are typically located at the bottom of a page or beneath the text being referenced, and endnotes are typically placed at the end of a document or at the end of a section. This can be done using the [FootnotePosition](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_FootnotePosition) API and [EndnotePosition](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_EndnotePosition) API. -The following code example illustrates how to set positions for footnotes and endnotes: +The following code example illustrates how to set the positions for footnotes and endnotes: {% tabs %} @@ -398,7 +398,7 @@ using (WordDocument document = new WordDocument()) //Appends the footnotes WFootnote footnote = (WFootnote)paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Footnote); WTextBody separator = document.Footnotes.Separator; - //Replaces the default footnote separated by text + //Replaces the default footnote separator with text separator.Paragraphs[0].Text = "Footnote separator"; //Sets the footnote character format footnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript; @@ -430,7 +430,7 @@ paragraph = section.AddParagraph(); //Appends the footnotes WFootnote footnote = (WFootnote)paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Footnote); WTextBody separator = document.Footnotes.Separator; -//Replaces the default footnote separated by text +//Replaces the default footnote separator with text separator.Paragraphs[0].Text = "Footnote separator"; //Sets the footnote character format footnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript; @@ -460,7 +460,7 @@ paragraph = section.AddParagraph() 'Appends the footnotes Dim footnote As WFootnote = DirectCast(paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Footnote), WFootnote) Dim separator As WTextBody = document.Footnotes.Separator -'Replaces the default footnote separated by text +'Replaces the default footnote separator with text separator.Paragraphs(0).Text = "Footnote separator" 'Sets the footnote character format footnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript @@ -469,7 +469,7 @@ paragraph.AppendText("Sample content for footnotes").CharacterFormat.Bold = True 'Adds footnote text paragraph = footnote.TextBody.AddParagraph() paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company.") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -499,7 +499,7 @@ using (WordDocument document = new WordDocument()) //Appends the endnotes WFootnote endnote = (WFootnote)paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Endnote); WTextBody separator = document.Endnotes.Separator; - //Replaces the default endnote separated by text + //Replaces the default endnote separator with text separator.Paragraphs[0].Text = "Endnote separator"; //Sets the endnote character format endnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript; @@ -531,13 +531,13 @@ paragraph = section.AddParagraph(); //Appends the endnote WFootnote endnote = (WFootnote)paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Endnote); WTextBody separator = document.Endnotes.Separator; -//Replaces the default foot note separate by text +//Replaces the default endnote separator with text separator.Paragraphs[0].Text = "Endnote separator"; //Sets the endnote character format endnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript; //Inserts the text into the paragraph paragraph.AppendText("Sample content for endnotes").CharacterFormat.Bold = true; -//Adds the footnote text +//Adds the endnote text paragraph = endnote.TextBody.AddParagraph(); paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company."); //Saves and closes the Word document instance @@ -561,16 +561,16 @@ paragraph = section.AddParagraph() 'Appends the endnote Dim endnote As WFootnote = DirectCast(paragraph.AppendFootnote(Syncfusion.DocIO.FootnoteType.Endnote), WFootnote) Dim separator As WTextBody = document.Endnotes.Separator -'Replaces the default footnote separated by text +'Replaces the default endnote separator with text separator.Paragraphs(0).Text = "Endnote separator" 'Sets the endnote character format endnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript 'Inserts the text into the paragraph paragraph.AppendText("Sample content for endnotes").CharacterFormat.Bold = True -'Adds the footnote text +'Adds the endnote text paragraph = endnote.TextBody.AddParagraph() paragraph.AppendText("AdventureWorks Cycles, the fictitious company on which the AdventureWorks sample databases are based, is a large, multinational manufacturing company.") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -580,9 +580,10 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Footnotes-and-Endnotes/Change-default-endnote-separator). ## Modify Footnote and Endnote content -Modify footnote and endnote contents in an existing Word document. -The following code example shows how to modify the footnote and endnote content from an existing Word document: +You can modify the footnote and endnote contents in an existing Word document. + +The following code example shows how to modify the footnote and endnote content of an existing Word document: {% tabs %} @@ -617,7 +618,7 @@ using (FileStream docStream = new FileStream("Input.docx", FileMode.Open, FileA endnote.MarkerCharacterFormat.SubSuperScript = SubSuperScript.SuperScript; //Append the endnote text. endnoteParagraph.AppendText(" Endnote is modified."); - //Save the the Word document to the MemoryStream. + //Save the Word document to the MemoryStream. MemoryStream outputStream = new MemoryStream(); document.Save(outputStream, FormatType.Docx); } @@ -693,9 +694,9 @@ End Using You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Footnotes-and-Endnotes/Modify-Footnote-and-Endnote-content). -## Removing a Footnotes/Endnotes +## Removing Footnotes/Endnotes -The following code example shows how to remove the footnotes/endnotes from the Word document. +The following code example shows how to remove footnotes/endnotes from a Word document. {% tabs %} @@ -836,7 +837,7 @@ private static void RemoveFootNoteEndNote(WTable table) 'Loads the template document Dim document As New WordDocument("Template.docx") 'Removes footnote from the document -RemoveFootNoteEndNote(document); +RemoveFootNoteEndNote(document) 'Saves and closes the Word document document.Save("Result.docx", FormatType.Docx) document.Close() @@ -866,7 +867,7 @@ Private Shared Sub RemoveFootNoteEndNote(ByVal textBody As WTextBody) 'Table is a collection of rows and cells 'Iterates through table's DOM and and Remove footnote. RemoveFootNoteEndNote(TryCast(bodyItemEntity, WTable)) - Case EntityType.BlockContentControl + Case EntityType.BlockContentControl Dim blockContentControl As BlockContentControl = TryCast(bodyItemEntity, BlockContentControl) 'Iterates to the body items of Block Content Control and Remove footnote. RemoveFootNoteEndNote(blockContentControl.TextBody) diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Form-Fields.md b/Document-Processing/Word/Word-Library/NET/Working-with-Form-Fields.md index ff09531b5e..9bd5a1b17a 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Form-Fields.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Form-Fields.md @@ -7,21 +7,21 @@ documentation: UG --- # Working with Form Fields in Word Library -You can create template document with form fields such as Text, Checkbox and Drop-Down. You can also open an existing template document and fill the form fields with the specified data. +You can create a template document with form fields such as Text, Checkbox, and Drop-Down. You can also open an existing template document and fill the form fields with the specified data. -The following are the types of form field in the Word document +The following are the types of form fields available in a Word document: * Checkbox – represented by an instance of [WCheckBox](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WCheckBox.html) -* Drop-down – represented by an instance of [WDropDownFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WDropDownFormField.html) +* Drop-Down – represented by an instance of [WDropDownFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WDropDownFormField.html) * Text input – represented by an instance of [WTextFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WTextFormField.html) N> To generate editable fields in the PDF converted from a Word document, use Form Fields; regular text and content controls will not be editable. Refer [here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf-settings#word-document-form-field-to-pdf-form-field) to learn more about converting form fields as editable fields during Word to PDF conversion. ## Check Box -You can add new Checkbox form field to a Word document by using [AppendCheckBox](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendCheckBox) method of [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. +You can add a new Checkbox form field to a Word document by using the [AppendCheckBox](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendCheckBox) method of the [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. -The following code illustrates how to add new checkbox form field. +The following code illustrates how to add a new Checkbox form field. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -116,7 +116,7 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Form-Fields/Add-checkbox-form-field). -You can modify the checkbox properties such as checked state, size, help text in a Word document. The following code illustrates how to modify the checkbox form field properties. +You can modify the checkbox properties such as checked state, size, and help text in a Word document. The following code illustrates how to modify the Checkbox form field properties. {% tabs %} @@ -190,9 +190,9 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Drop-Down -You can add new Dropdown form field to a Word document by using [AppendDropDownFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendDropDownFormField) method of [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. +You can add a new Drop-Down form field to a Word document by using the [AppendDropDownFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendDropDownFormField) method of the [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. -The following code illustrates how to add a new dropdown field. +The following code illustrates how to add a new Drop-Down form field. {% tabs %} @@ -273,7 +273,7 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Form-Fields/Add-dropdown-form-field). -You can add or modify list of items of a Dropdown form field in a Word document. The following code illustrates how to modify the dropdown list of a Dropdown form field. +You can add or modify the list of items of a Drop-Down form field in a Word document. The following code illustrates how to modify the drop-down list of a Drop-Down form field. {% tabs %} @@ -344,11 +344,11 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Form-Fields/Modify-dropdown-form-field). -## Text Form field +## Text Form Field -You can add new text form field to a Word document by using [AppendTextFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendTextFormField_System_String_) method of [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. +You can add a new Text form field to a Word document by using the [AppendTextFormField](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendTextFormField_System_String_) method of the [WParagraph](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html) class. -The following code illustrates how to add new text form field. +The following code illustrates how to add a new Text form field. {% tabs %} @@ -425,7 +425,7 @@ document.Close(); 'Creates a new Word document Dim document As New WordDocument() 'Adds new section to the document -section As IWSection = document.AddSection() +Dim section As IWSection = document.AddSection() 'Adds new paragraph to the section Dim paragraph As WParagraph = TryCast(section.AddParagraph(), WParagraph) paragraph.AppendText("General Information") @@ -459,7 +459,7 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Form-Fields/Add-text-form-field). -You can add or modify text form field properties such as default text, type in a Word document. The following code illustrates how to modify the text form field +You can add or modify Text form field properties such as default text and type in a Word document. The following code illustrates how to modify the Text form field. {% tabs %} diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Ink.md b/Document-Processing/Word/Word-Library/NET/Working-with-Ink.md index 05321731ed..feebbdfce1 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Ink.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Ink.md @@ -13,7 +13,7 @@ N> DocIO supports Ink only in DOCX format documents. ## Create Ink -The following code example illustrating how to create an Ink in a Word document. +The following code example illustrates how to create an Ink in a Word document. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -124,14 +124,14 @@ document.Close() {% endtabs %} -By running the above code, you will generate a a document with **Ink elements** as shown below. +By running the above code, you will generate a document with **Ink elements** as shown below. ![Process](Ink_images/Create-Ink.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Ink/Create-ink/.NET/). ## Create Ink with Multiple Traces -The following code example illustrating how to create an Ink with Multiple Traces (strokes) in a Word document. +The following code example illustrates how to create an Ink with Multiple Traces (strokes) in a Word document. {% tabs %} @@ -248,12 +248,12 @@ document.Close() {% endtabs %} -By running the above code, you will generate an **Ink with multiple trace points** as shown below. +By running the above code, you will generate an **Ink with multiple traces** as shown below. ![Process](Ink_images/Ink-multipletraces.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Ink/Create-ink-with-multipletraces/.NET/). -The following code example shows GetPoints method which is used to get trace points. +The following code example shows the `GetPoints` method, which is used to get trace points. {% tabs %} @@ -372,7 +372,7 @@ End Function ## Modify Ink -You can modify the appearance of Ink by changing the trace ink effects, color, size, points. +You can modify the appearance of Ink by changing the trace ink effects, color, size, and points. ### Modify Ink Effect @@ -553,10 +553,10 @@ WSection section = document.Sections[0]; WInk ink = section.Paragraphs[0].ChildEntities[0] as WInk; // Gets the ink trace from the ink object. IOfficeInkTrace inkTrace = ink.Traces[0]; -// Modify the ink size (thickness) to 1 point. +//Modify the ink size (thickness) to 1 point. inkTrace.Brush.Size = new SizeF(1f, 1f); //Saves and closes the Word document instance -document.Save("Sample.docx"); +document.Save("Result.docx"); //Closes the document document.Close(); @@ -575,7 +575,7 @@ Dim inkTrace As IOfficeInkTrace = ink.Traces(0) ' Modify the ink size (thickness) to 1 point. inkTrace.Brush.Size = New SizeF(1F, 1F) 'Saves and closes the Word document instance -document.Save("Sample.docx") +document.Save("Result.docx") 'Closes the document document.Close() @@ -628,7 +628,7 @@ IOfficeInkTrace inkTrace = ink.Traces[0]; // Close the ink stroke by setting the last point to be the same as the first point inkTrace.Points[inkTrace.Points.Length - 1] = new PointF(inkTrace.Points[0].X, inkTrace.Points[0].Y); //Saves and closes the Word document instance -document.Save("Sample.docx"); +document.Save("Result.docx"); //Closes the document document.Close(); @@ -647,7 +647,7 @@ Dim inkTrace As IOfficeInkTrace = ink.Traces(0) ' Close the ink stroke by setting the last point to be the same as the first point inkTrace.Points(inkTrace.Points.Length - 1) = New PointF(inkTrace.Points(0).X, inkTrace.Points(0).Y) 'Saves and closes the Word document instance -document.Save("Sample.docx") +document.Save("Result.docx") 'Closes the document document.Close() @@ -655,7 +655,7 @@ document.Close() {% endtabs %} -By running the above code, you will generate **modified ink points** as shown below. +By running the above code, you will generate **modified ink points** as shown below. ![Process](Ink_images/Modify-ink-points.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Ink/Modify-ink-points/.NET/). @@ -708,7 +708,7 @@ for (int i = 0; i < paragraph.ChildEntities.Count; i++) } } //Saves and closes the Word document instance -document.Save("Sample.docx"); +document.Save("Result.docx"); //Closes the document document.Close(); @@ -731,10 +731,7 @@ While i < paragraph.ChildEntities.Count i += 1 End While 'Saves and closes the Word document instance -document.Save("Sample.docx") -'Closes the document -document.Close() - +document.Save("Result.docx") {% endhighlight %} {% endtabs %} @@ -769,7 +766,7 @@ During Word-to-PDF and Word-to-Image conversions, Syncfusion Word Library uses f * [What is Ink Trace?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#what-is-ink-trace) * [How Ink Width and Height Work](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#how-ink-width-and-height-work) * [How Trace Points Are Calculated?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#how-trace-points-are-calculated) -* [Example: Triangle Ink Trace Points](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#example:-triangle-ink-trace-points) +* [Example: Triangle Ink Trace Points](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#example-triangle-ink-trace-points) * [How to Set Stroke Thickness?](https://help.syncfusion.com/document-processing/word/word-library/net/faqs/paragraph-and-paragraph-items-faqs#how-to-set-stroke-thickness) ## Online Demo diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-LaTeX.md b/Document-Processing/Word/Word-Library/NET/Working-with-LaTeX.md index 04af146130..f8a5c6e75d 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-LaTeX.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-LaTeX.md @@ -7,16 +7,16 @@ documentation: UG --- # Create Equation using LaTeX -The .NET Word (DocIO) library allows to create mathematical equation in Word document using **LaTeX**. +The .NET Word (DocIO) library allows you to create mathematical equations in a Word document using **LaTeX**. To quickly start working with LaTeX Equations, please check out this video: {% youtube "https://www.youtube.com/watch?v=pdN4HNlKTJs" %} ## Accent -Add **accent** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add an **accent** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create accent equation using LaTeX in Word document. +The following code example illustrates how to create an accent equation using LaTeX in a Word document. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -156,9 +156,9 @@ The following table demonstrates the LaTeX equivalent to professional format acc ## Bar -Add **bar** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **bar** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create bar equation using LaTeX in Word document. +The following code example illustrates how to create a bar equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Bar/.NET/Bar/Program.cs" %} @@ -169,7 +169,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an bar equation using LaTeX. +//Append a bar equation using LaTeX. document.LastParagraph.AppendMath(@"\overline{a}"); //Save the Word document to MemoryStream @@ -186,7 +186,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an bar equation using LaTeX. +//Append a bar equation using LaTeX. document.LastParagraph.AppendMath(@"\overline{a}"); //Save the Word document. @@ -201,7 +201,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an bar equation using LaTeX. +'Append a bar equation using LaTeX. document.LastParagraph.AppendMath(@"\overline{a}") 'Save the Word document. @@ -236,9 +236,9 @@ The following table demonstrates the LaTeX equivalent to professional format bar ## Box -Add **box** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **box** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create box equation using LaTeX in Word document. +The following code example illustrates how to create a box equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Box/.NET/Box/Program.cs" %} @@ -249,7 +249,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an box equation using LaTeX. +//Append a box equation using LaTeX. document.LastParagraph.AppendMath(@"\box{a}"); //Save the Word document to MemoryStream @@ -266,7 +266,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an box equation using LaTeX. +//Append a box equation using LaTeX. document.LastParagraph.AppendMath(@"\box{a}"); //Save the Word document. @@ -281,7 +281,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an box equation using LaTeX. +'Append a box equation using LaTeX. document.LastParagraph.AppendMath(@"\box{a}") 'Save the Word document. @@ -309,11 +309,11 @@ The following table demonstrates the LaTeX equivalent to professional format box
Feature

Server and hosted application

Server and Hosted application

WASM app

-## Border Box +## Border box -Add **border box** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **border box** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create border box equation using LaTeX in Word document. +The following code example illustrates how to create a border box equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Border-Box/.NET/Border-Box/Program.cs" %} @@ -325,7 +325,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an border box equation using LaTeX. +//Append a border box equation using LaTeX. document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}"); //Save the Word document to MemoryStream @@ -344,7 +344,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an border box equation using LaTeX. +//Append a border box equation using LaTeX. document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}"); //Save the Word document. @@ -361,7 +361,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an border box equation using LaTeX. +'Append a border box equation using LaTeX. document.LastParagraph.AppendMath(@"\boxed{{x}^{2}+{y}^{2}={z}^{2}}") 'Save the Word document. @@ -392,9 +392,9 @@ The following table demonstrates the LaTeX equivalent to professional format bor ## Delimiter -Add **delimiter** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **delimiter** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create delimiter equation using LaTeX in Word document. +The following code example illustrates how to create a delimiter equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Delimiter/.NET/Delimiter/Program.cs" %} @@ -405,7 +405,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an delimiter equation using LaTeX. +//Append a delimiter equation using LaTeX. document.LastParagraph.AppendMath(@"\left(a\right)"); //Save the Word document to MemoryStream @@ -422,7 +422,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an delimiter equation using LaTeX. +//Append a delimiter equation using LaTeX. document.LastParagraph.AppendMath(@"\left(a\right)"); //Save the Word document. @@ -437,7 +437,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an delimiter equation using LaTeX. +'Append a delimiter equation using LaTeX. document.LastParagraph.AppendMath(@"\left(a\right)") 'Save the Word document. @@ -600,11 +600,11 @@ The following table demonstrates the LaTeX equivalent to professional format del -## Equation Array +## Equation array -Add **equation array** to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add an **equation array** to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create an equation array using LaTeX in Word document. +The following code example illustrates how to create an equation array using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Equation-array/.NET/Equation-array/Program.cs" %} @@ -615,7 +615,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an box equation using LaTeX. +//Append an equation array using LaTeX. document.LastParagraph.AppendMath(@"\eqarray{a@&b}"); //Save the Word document to MemoryStream @@ -631,7 +631,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an box equation using LaTeX. +//Append an equation array using LaTeX. document.LastParagraph.AppendMath(@"\eqarray{a@&b}"); //Save the Word document. @@ -646,8 +646,8 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an box equation using LaTeX. -document.LastParagraph.AppendMath(@"\eqarray{a@&b}"); +'Append an equation array using LaTeX. +document.LastParagraph.AppendMath(@"\eqarray{a@&b}") 'Save the Word document. document.Save("Result.docx", FormatType.Docx) @@ -676,9 +676,9 @@ The following table demonstrates the LaTeX equivalent to professional format equ ## Fraction -Add **fraction** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **fraction** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create fraction equation using LaTeX in Word document. +The following code example illustrates how to create a fraction equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Fraction/.NET/Fraction/Program.cs" %} @@ -689,7 +689,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an fraction equation using LaTeX. +//Append a fraction equation using LaTeX. document.LastParagraph.AppendMath(@"{\frac{dy}{dx}}"); //Save the Word document to MemoryStream @@ -706,7 +706,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an fraction equation using LaTeX. +//Append a fraction equation using LaTeX. document.LastParagraph.AppendMath(@"{\frac{dy}{dx}}"); //Save the Word document. @@ -721,7 +721,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an fraction equation using LaTeX. +'Append a fraction equation using LaTeX. document.LastParagraph.AppendMath(@"{\frac{dy}{dx}}") 'Save the Word document. @@ -745,7 +745,7 @@ The following table demonstrates the LaTeX equivalent to professional format fra 1. Fraction equation -frac{\mathbit{dy}}{\mathbit{dx}} +\frac{\mathbit{dy}}{\mathbit{dx}} 2. @@ -754,11 +754,6 @@ The following table demonstrates the LaTeX equivalent to professional format fra 3. - - - - - Fraction equation {\frac{dy}{dx}} @@ -767,9 +762,9 @@ The following table demonstrates the LaTeX equivalent to professional format fra ## Function -Add **function** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **function** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create function equation using LaTeX in Word document. +The following code example illustrates how to create a function equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Function/.NET/Function/Program.cs" %} @@ -780,7 +775,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an function equation using LaTeX. +//Append a function equation using LaTeX. document.LastParagraph.AppendMath(@"\sin{\theta}"); //Save the Word document to MemoryStream @@ -797,7 +792,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an function equation using LaTeX. +//Append a function equation using LaTeX. document.LastParagraph.AppendMath(@"\sin{\theta}"); //Save the Word document. @@ -812,7 +807,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an function equation using LaTeX. +'Append a function equation using LaTeX. document.LastParagraph.AppendMath(@"\sin{\theta}") 'Save the Word document. @@ -987,9 +982,9 @@ The following table demonstrates the LaTeX equivalent to professional format fun ## Group character -Add **group character** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **group character** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create group character equation using LaTeX in Word document. +The following code example illustrates how to create a group character equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Group-character/.NET/Group-character/Program.cs" %} @@ -1000,7 +995,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an group character equation using LaTeX. +//Append a group character equation using LaTeX. document.LastParagraph.AppendMath(@"\overbrace{a-b}"); //Save the Word document to MemoryStream @@ -1017,7 +1012,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an group character equation using LaTeX. +//Append a group character equation using LaTeX. document.LastParagraph.AppendMath(@"\overbrace{a-b}"); //Save the Word document. @@ -1032,7 +1027,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an group character equation using LaTeX. +'Append a group character equation using LaTeX. document.LastParagraph.AppendMath(@"\overbrace{a-b}") 'Save the Word document. @@ -1067,9 +1062,9 @@ The following table demonstrates the LaTeX equivalent to professional format gro ## Limit -Add **limit** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **limit** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create limit equation using LaTeX in Word document. +The following code example illustrates how to create a limit equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Limit/.NET/Limit/Program.cs" %} @@ -1080,7 +1075,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an limit equation using LaTeX. +//Append a limit equation using LaTeX. document.LastParagraph.AppendMath(@"\lim\below{b}{a}"); //Save the Word document to MemoryStream @@ -1097,7 +1092,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an limit equation using LaTeX. +//Append a limit equation using LaTeX. document.LastParagraph.AppendMath(@"\lim\below{b}{a}"); //Save the Word document. @@ -1112,7 +1107,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an limit equation using LaTeX. +'Append a limit equation using LaTeX. document.LastParagraph.AppendMath(@"\lim\below{b}{a}") 'Save the Word document. @@ -1152,9 +1147,9 @@ The following table demonstrates the LaTeX equivalent to professional format lim ## Matrix -Add **matrix** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **matrix** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create matrix equation using LaTeX in Word document. +The following code example illustrates how to create a matrix equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Matrix/.NET/Matrix/Program.cs" %} @@ -1165,7 +1160,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an matrix equation using LaTeX. +//Append a matrix equation using LaTeX. document.LastParagraph.AppendMath(@"\begin{matrix}a&b\\\end{matrix}"); //Save the Word document to MemoryStream @@ -1182,7 +1177,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an matrix equation using LaTeX. +//Append a matrix equation using LaTeX. document.LastParagraph.AppendMath(@"\begin{matrix}a&b\\\end{matrix}"); //Save the Word document. @@ -1197,7 +1192,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an matrix equation using LaTeX. +'Append a matrix equation using LaTeX. document.LastParagraph.AppendMath(@"\begin{matrix}a&b\\\end{matrix}") 'Save the Word document. @@ -1227,9 +1222,9 @@ The following table demonstrates the LaTeX equivalent to professional format mat ## N-array -Add **N-array** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add an **N-array** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create N-array equation using LaTeX in Word document. +The following code example illustrates how to create an N-array equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/N-array/.NET/N-array/Program.cs" %} @@ -1352,9 +1347,9 @@ The following table demonstrates the LaTeX equivalent to professional format N-a ## Radical -Add **radical** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **radical** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create radical equation using LaTeX in Word document. +The following code example illustrates how to create a radical equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Radical/.NET/Radical/Program.cs" %} @@ -1365,7 +1360,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an radical equation using LaTeX. +//Append a radical equation using LaTeX. document.LastParagraph.AppendMath(@"\sqrt{a}"); //Save the Word document to MemoryStream @@ -1382,7 +1377,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an radical equation using LaTeX. +//Append a radical equation using LaTeX. document.LastParagraph.AppendMath(@"\sqrt{a}"); //Save the Word document. @@ -1397,7 +1392,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an radical equation using LaTeX. +'Append a radical equation using LaTeX. document.LastParagraph.AppendMath(@"\sqrt{a}") 'Save the Word document. @@ -1432,9 +1427,9 @@ The following table demonstrates the LaTeX equivalent to professional format rad ## SubSuperScript -Add **SubSuperScript** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **SubSuperScript** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create SubSuperScript equation using LaTeX in Word document. +The following code example illustrates how to create a SubSuperScript equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/SubSuperScript/.NET/SubSuperScript/Program.cs" %} @@ -1445,8 +1440,8 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an SubSuperScript equation using LaTeX. -document.LastParagraph.AppendMath((@"{a}^{b}"); +//Append a SubSuperScript equation using LaTeX. +document.LastParagraph.AppendMath(@"{a}^{b}"); //Save the Word document to MemoryStream using MemoryStream stream = new MemoryStream(); @@ -1462,8 +1457,8 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an SubSuperScript equation using LaTeX. -document.LastParagraph.AppendMath((@"{a}^{b}"); +//Append a SubSuperScript equation using LaTeX. +document.LastParagraph.AppendMath(@"{a}^{b}"); //Save the Word document. document.Save("Result.docx", FormatType.Docx); @@ -1477,8 +1472,8 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an SubSuperScript equation using LaTeX. -document.LastParagraph.AppendMath((@"{a}^{b}") +'Append a SubSuperScript equation using LaTeX. +document.LastParagraph.AppendMath(@"{a}^{b}") 'Save the Word document. document.Save("Result.docx", FormatType.Docx) @@ -1512,9 +1507,9 @@ The following table demonstrates the LaTeX equivalent to professional format Sub ## Left SubSuperScript -Add **Left SubSuperScript** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **Left SubSuperScript** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create Left SubSuperScript equation using LaTeX in Word document. +The following code example illustrates how to create a Left SubSuperScript equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Left-SubSuperScript/.NET/Left-SubSuperScript/Program.cs" %} @@ -1525,7 +1520,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an Left SubSuperScript equation using LaTeX. +//Append a Left SubSuperScript equation using LaTeX. document.LastParagraph.AppendMath(@"{_{40}^{20}}{100}"); //Save the Word document to MemoryStream @@ -1542,7 +1537,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an Left SubSuperScript equation using LaTeX. +//Append a Left SubSuperScript equation using LaTeX. document.LastParagraph.AppendMath(@"{_{40}^{20}}{100}"); //Save the Word document. @@ -1557,8 +1552,8 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an Left SubSuperScript equation using LaTeX. -document.LastParagraph.AppendMath(@"{_{40}^{20}}{100}"); +'Append a Left SubSuperScript equation using LaTeX. +document.LastParagraph.AppendMath(@"{_{40}^{20}}{100}") 'Save the Word document. document.Save("Result.docx", FormatType.Docx) @@ -1587,9 +1582,9 @@ The following table demonstrates the LaTeX equivalent to professional format Lef ## Right SubSuperScript -Add **Right SubSuperScript** equation to a Word document using the LaTeX through [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. +Add a **Right SubSuperScript** equation to a Word document using LaTeX through the [AppendMath](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WParagraph.html#Syncfusion_DocIO_DLS_WParagraph_AppendMath_System_String_) API. -The following code example illustrates how to create Right SubSuperScript equation using LaTeX in Word document. +The following code example illustrates how to create a Right SubSuperScript equation using LaTeX in a Word document. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/LaTeX-equations/Right-SubSuperScript/.NET/Right-SubSuperScript/Program.cs" %} @@ -1600,7 +1595,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an Right SubSuperScript equation using LaTeX. +//Append a Right SubSuperScript equation using LaTeX. document.LastParagraph.AppendMath(@"{100}_{40}^{20}"); //Save the Word document to MemoryStream @@ -1617,7 +1612,7 @@ using WordDocument document = new WordDocument(); //Add one section and one paragraph to the document. document.EnsureMinimal(); -//Append an Right SubSuperScript equation using LaTeX. +//Append a Right SubSuperScript equation using LaTeX. document.LastParagraph.AppendMath(@"{100}_{40}^{20}"); //Save the Word document. @@ -1632,7 +1627,7 @@ Dim document As WordDocument = New WordDocument() 'Add one section and one paragraph to the document. document.EnsureMinimal() -'Append an Right SubSuperScript equation using LaTeX. +'Append a Right SubSuperScript equation using LaTeX. document.LastParagraph.AppendMath(@"{100}_{40}^{20}") 'Save the Word document. @@ -1660,7 +1655,7 @@ The following table demonstrates the LaTeX equivalent to professional format Rig -## Format Equations +## Format equations ### Apply style to characters @@ -1739,7 +1734,7 @@ document.EnsureMinimal() 'Append an accent equation with Bold using LaTeX. document.LastParagraph.AppendMath(@"\dot{\mathbf{a}}") 'Append an accent equation with Bold-Italic using LaTeX. -document. LastSection.AddParagraph().AppendMath(@"\dot{\mathbit{a}}") +document.LastSection.AddParagraph().AppendMath(@"\dot{\mathbit{a}}") 'Save the Word document. document.Save("Result.docx", FormatType.Docx) @@ -1849,11 +1844,11 @@ document.LastParagraph.AppendMath(@"\dot{\mathbb{a}}") 'Append an accent equation with Fraktur font using LaTeX. document.LastSection.AddParagraph().AppendMath(@"\dot{\mathfrak{a}}") 'Append an accent equation with SansSerif font using LaTeX. -document. LastSection.AddParagraph().AppendMath(@"\dot{\mathsf{a}}") +document.LastSection.AddParagraph().AppendMath(@"\dot{\mathsf{a}}") 'Append an accent equation with Script using LaTeX. -document. LastSection.AddParagraph().AppendMath(@"\dot{\mathcal{a}}") +document.LastSection.AddParagraph().AppendMath(@"\dot{\mathcal{a}}") 'Append an accent equation with Script using LaTeX. -document. LastSection.AddParagraph().AppendMath(@"\dot{\mathscr{a}}") +document.LastSection.AddParagraph().AppendMath(@"\dot{\mathscr{a}}") 'Save a Word document. document.Save("Result.docx", FormatType.Docx) @@ -2010,14 +2005,14 @@ if (math != null) } //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Save the Word document to a MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -// Open the FileStream for reading and writing the "Template.docx" file +// Load the "Template.docx" file into a WordDocument instance WordDocument document = new WordDocument("Template.docx"); // Access the first paragraph from the last section of the document WParagraph paragraph = document.LastSection.Body.ChildEntities[0] as WParagraph; @@ -2030,12 +2025,10 @@ if (math != null) // Replace occurrences of 'x' with 'k' in the LaTeX representation math.MathParagraph.LaTeX = laTeX.Replace("x", "k"); } -//Saves the word document -document.Save("Sample.docx"); -//Close the word document +//Save the modified Word document +document.Save("Sample.docx", FormatType.Docx); +//Close the Word document document.Close(); -// Save the modified document to the FileStream in DOCX format -document.Save(stream, FormatType.Docx); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} @@ -2044,15 +2037,16 @@ Dim document As WordDocument = New WordDocument("Template.docx") 'Access the paragraph from Word document Dim paragraph As WParagraph = CType(document.LastSection.Body.ChildEntities(0), WParagraph) 'Access the mathematical equation from the paragraph -Dim math As WMath = CType(paragraph.ChildEntities(0), WMath)If math IsNot Nothing Then +Dim math As WMath = CType(paragraph.ChildEntities(0), WMath) +If math IsNot Nothing Then ' Get the LaTeX representation of the math equation Dim laTeX As String = math.MathParagraph.LaTeX ' Replace occurrences of 'x' with 'k' in the LaTeX representation math.MathParagraph.LaTeX = laTeX.Replace("x", "k") End If -'Saves the word document -document.Save("Sample.docx") -'Close the word document +'Saves the Word document +document.Save("Sample.docx", FormatType.Docx) +'Close the Word document document.Close() {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Macros.md b/Document-Processing/Word/Word-Library/NET/Working-with-Macros.md index 7fc557f117..d4fee31486 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Macros.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Macros.md @@ -1,19 +1,19 @@ --- title: Working with Macros in Word document | DocIO | Syncfusion -description: Learn how to load and save a macro enabled Word documents and remove macros from Word document using the .NET Word (DocIO) library. +description: Learn how to load and save a macro-enabled Word document and remove macros from a Word document using the .NET Word (DocIO) library. platform: document-processing control: DocIO documentation: UG --- # Working with Macros in Word document -Macro is a way to automate the tasks that you perform repeatedly. It is a saved sequence of commands or keyboard strokes that can be recalled with a single command or keyboard stroke. +A macro is a way to automate the tasks that you perform repeatedly. It is a saved sequence of commands or keyboard strokes that can be recalled with a single command or keyboard stroke. -The following link shows how to create a macro in the Word document. +The following link shows how to create a macro in a Word document. -[https://support.office.com/en-in/article/Create-or-run-a-macro-c6b99036-905c-49a6-818a-dfb98b7c3c9c](https://support.office.com/en-in/article/Create-or-run-a-macro-c6b99036-905c-49a6-818a-dfb98b7c3c9c#) +[https://support.office.com/en-in/article/Create-or-run-a-macro-c6b99036-905c-49a6-818a-dfb98b7c3c9c](https://support.office.com/en-in/article/Create-or-run-a-macro-c6b99036-905c-49a6-818a-dfb98b7c3c9c) -The following code illustrates how to load and save a macro enabled document. +The following code illustrates how to load and save a macro-enabled document. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -55,22 +55,28 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Macros/Open-and-save-macro-enabled-document). -The following code example illustrates how to remove the macros present in the document by using [RemoveMacros](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_RemoveMacros) method. +The following code example illustrates how to remove the macros present in the document by using the [RemoveMacros](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_RemoveMacros) method. + +N> You must load the document with the **Docm** or **Dotm** format type to preserve macros; otherwise, `HasMacros` will return `false` and `RemoveMacros` will have no effect. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Macros/Remove-macros-in-document/.NET/Remove-macros-in-document/Program.cs" %} //Loads the document with macros -FileStream fileStreamPath = new FileStream("Template.docm", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); -WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx); -//Checks whether the document has macros and then removes them -if (document.HasMacros) - document.RemoveMacros(); -//Saves the Word document to MemoryStream -MemoryStream stream = new MemoryStream(); -document.Save(stream, FormatType.Docx); -//Closes the document -document.Close(); +using (FileStream fileStreamPath = new FileStream("Template.docm", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) +{ + using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docm)) + { + //Checks whether the document has macros and then removes them + if (document.HasMacros) + document.RemoveMacros(); + //Saves the Word document to MemoryStream + using (MemoryStream stream = new MemoryStream()) + { + document.Save(stream, FormatType.Docx); + } + } +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Mathematical-Equation.md b/Document-Processing/Word/Word-Library/NET/Working-with-Mathematical-Equation.md index 218152451f..1f7ed91108 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Mathematical-Equation.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Mathematical-Equation.md @@ -1,22 +1,22 @@ --- title: Working with Mathematical Equation | DocIO | Syncfusion -description: Learn how to add, modify, and remove mathematical equations in a Word document using the .NET Word (DocIO) library without Microsoft Word. +description: Learn how to add and modify mathematical equations in a Word document using the .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO documentation: UG --- # Working with Mathematical Equation -Equations in Word document are combination of mathematical symbols or text. For example, you can create a Fourier series equation in Word document. +Equations in a Word document are combinations of mathematical symbols or text. For example, you can create a Fourier series equation in a Word document. -The [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) (DocIO) offers two ways to create and modify equations in Word document. +The [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) (DocIO) offers two ways to create and modify equations in a Word document. * [Using WMath DOM](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-mathematical-equation#types-of-equation). * [Using LaTeX](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-latex). ![Mathematical equation in Microsoft Word document](WorkingwithMathematicalEquation_images/Mathematical Equation.png) -N> You can use mathematical equation only in documents that are saved in the Open XML Format and cannot be used in the Word 97-2003 document (.doc) format. +N> You can use mathematical equations only in documents that are saved in the Open XML Format and cannot use them in the Word 97-2003 document (.doc) format. ## Types of equation @@ -55,7 +55,7 @@ N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-plat WordDocument document = new WordDocument(); //Adds one section and one paragraph to the document document.EnsureMinimal(); -//Appends a new mathematical equation to the paragraph +//Appends a new mathematical equation to the paragraph WMath math = document.LastParagraph.AppendMath(); //Adds a new math IOfficeMath officeMath = math.MathParagraph.Maths.Add(); @@ -74,7 +74,7 @@ textRange.CharacterFormat.Bold = true; textRange.CharacterFormat.Italic = true; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -84,7 +84,7 @@ document.Close(); WordDocument document = new WordDocument(); //Adds one section and one paragraph to the document document.EnsureMinimal(); -//Appends a new mathematical equation to the paragraph +//Appends a new mathematical equation to the paragraph WMath math = document.LastParagraph.AppendMath(); //Adds a new math IOfficeMath officeMath = math.MathParagraph.Maths.Add(); @@ -112,14 +112,14 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add 'Adds an accent equation Dim mathAccent As IOfficeMathAccent = CType(officeMath.Functions.Add(MathFunctionType.Accent), IOfficeMathAccent) 'Sets the accent character -mathAccent.AccentCharacter = "" +mathAccent.AccentCharacter = "̆" Dim officeMathRunElement As IOfficeMathRunElement = CType(mathAccent.Equation.Functions.Add(MathFunctionType.RunElement), IOfficeMathRunElement) officeMathRunElement.Item = New WTextRange(document) Dim textRange As WTextRange = CType(officeMathRunElement.Item, WTextRange) @@ -140,7 +140,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Bar -You can add a bar (which adds horizontal line on top or bottom) to the equation. The following code example shows how to add a bar to the equation. +You can add a bar (which adds a horizontal line on top or bottom) to the equation. The following code example shows how to add a bar to the equation. {% tabs %} @@ -153,7 +153,7 @@ document.EnsureMinimal(); WMath math = document.LastParagraph.AppendMath(); //Adds a new math IOfficeMath officeMath = math.MathParagraph.Maths.Add(); -//Adds an bar function +//Adds a bar equation IOfficeMathBar mathBar = officeMath.Functions.Add(0, MathFunctionType.Bar) as IOfficeMathBar; //Sets the bar top mathBar.BarTop = true; @@ -162,9 +162,11 @@ IOfficeMathRunElement officeMathRunElement = mathBar.Equation.Functions.Add(0, M officeMathRunElement.Item = new WTextRange(document); //Sets text for bar equation (officeMathRunElement.Item as WTextRange).Text = "a"; -//Saves the Word document to MemoryStream +//Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); +document.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -196,7 +198,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -260,7 +262,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "adx"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -311,7 +313,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -388,7 +390,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a+b-c"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -437,7 +439,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -474,7 +476,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Delimiter -You can add a delimiter (parenthesis, square brackets and other characters) to the equation. The following code example shows how to a add delimiter to the equation. +You can add a delimiter (parenthesis, square brackets, and other characters) to the equation. The following code example shows how to add a delimiter to the equation. {% tabs %} @@ -506,7 +508,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a+b"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -548,7 +550,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -615,7 +617,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "x+y-z=1"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -663,7 +665,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -714,12 +716,12 @@ IOfficeMath officeMath = math.MathParagraph.Maths.Add(); //Adds a fraction equation IOfficeMathFraction mathFraction = officeMath.Functions.Add(0, MathFunctionType.Fraction) as IOfficeMathFraction; -//Sets the denominator for fraction +//Sets the numerator for fraction IOfficeMathRunElement officeMathRunElement = mathFraction.Numerator.Functions.Add(0, MathFunctionType.RunElement) as IOfficeMathRunElement; officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a"; -//Sets the numerator for fraction +//Sets the denominator for fraction officeMathRunElement = mathFraction.Denominator.Functions.Add(0, MathFunctionType.RunElement) as IOfficeMathRunElement; officeMathRunElement.Item = new WTextRange(document); @@ -728,7 +730,7 @@ officeMathRunElement.Item = new WTextRange(document); mathFraction.FractionType = MathFractionType.NormalFractionBar; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -745,12 +747,12 @@ IOfficeMath officeMath = math.MathParagraph.Maths.Add(); //Adds a fraction equation IOfficeMathFraction mathFraction = officeMath.Functions.Add(0, MathFunctionType.Fraction) as IOfficeMathFraction; -//Sets the denominator for fraction +//Sets the numerator for fraction IOfficeMathRunElement officeMathRunElement = mathFraction.Numerator.Functions.Add(0, MathFunctionType.RunElement) as IOfficeMathRunElement; officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a"; -//Sets the numerator for fraction +//Sets the denominator for fraction officeMathRunElement = mathFraction.Denominator.Functions.Add(0, MathFunctionType.RunElement) as IOfficeMathRunElement; officeMathRunElement.Item = new WTextRange(document); @@ -768,16 +770,16 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add Dim mathFraction As IOfficeMathFraction = CType(officeMath.Functions.Add(0, MathFunctionType.Fraction), IOfficeMathFraction) -'Sets the denominator for fraction +'Sets the numerator for fraction Dim officeMathRunElement As IOfficeMathRunElement = CType(mathFraction.Numerator.Functions.Add(0, MathFunctionType.RunElement), IOfficeMathRunElement) officeMathRunElement.Item = New WTextRange(document) CType(officeMathRunElement.Item, WTextRange).Text = "a" -'Sets the numerator for fraction +'Sets the denominator for fraction officeMathRunElement = CType(mathFraction.Denominator.Functions.Add(0, MathFunctionType.RunElement), IOfficeMathRunElement) officeMathRunElement.Item = New WTextRange(document) CType(officeMathRunElement.Item, WTextRange).Text = "b" @@ -824,7 +826,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "90"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -863,7 +865,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -919,7 +921,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a-b"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -959,7 +961,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1024,7 +1026,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "x"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1072,7 +1074,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1112,7 +1114,7 @@ You can create a matrix equation in a Word document. The following code example {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Mathematical-Equation/Create-matrix-equation/.NET/Create-matrix-equation/Program.cs" %} //Creates a new Word document WordDocument document = new WordDocument(); -///Adds one section and one paragraph to the document +//Adds one section and one paragraph to the document document.EnsureMinimal(); //Appends a new mathematical equation to the paragraph WMath wmath = document.LastParagraph.AppendMath(); @@ -1157,7 +1159,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "2"; //Gets an argument in first cell in second row officeMath = mathMatrix.Rows[1].Arguments[0]; -//Sets text for argument in first cell in seond row +//Sets text for argument in first cell in second row officeMathRunElement = officeMath.Functions.Add(MathFunctionType.RunElement) as IOfficeMathRunElement; officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "3"; @@ -1169,7 +1171,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "4"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1177,7 +1179,7 @@ document.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Creates a new Word document WordDocument document = new WordDocument(); -///Adds one section and one paragraph to the document +//Adds one section and one paragraph to the document document.EnsureMinimal(); //Appends a new mathematical equation to the paragraph WMath wmath = document.LastParagraph.AppendMath(); @@ -1243,7 +1245,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1348,7 +1350,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "x"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1398,7 +1400,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1465,7 +1467,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "x"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1504,7 +1506,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1571,7 +1573,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "a-b"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1621,7 +1623,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1688,7 +1690,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "x"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1729,7 +1731,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -1792,7 +1794,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "Y"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} @@ -1835,7 +1837,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add 'Adds a left subsuperscript equation. @@ -1899,7 +1901,7 @@ officeMathRunElement.Item = new WTextRange(document); (officeMathRunElement.Item as WTextRange).Text = "Y"; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); stream.Position = 0; @@ -1947,7 +1949,7 @@ document.Close(); Dim document As WordDocument = New WordDocument 'Adds one section and one paragraph to the document document.EnsureMinimal() -'Appends a new mathematical equation to the paragraph +'Appends a new mathematical equation to the paragraph Dim math As WMath = document.LastParagraph.AppendMath 'Adds a new math Dim officeMath As IOfficeMath = math.MathParagraph.Maths.Add @@ -2021,7 +2023,7 @@ MathParagraphItem.Item = new WTextRange(document); MathParagraphItem.MathFormat.Style = MathStyleType.Italic; //Saves and closes the Word document instance MemoryStream stream = new MemoryStream(); -//Saves the Word document to MemoryStream +//Saves the Word document to MemoryStream document.Save(stream, FormatType.Docx); document.Close(); {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Security.md b/Document-Processing/Word/Word-Library/NET/Working-with-Security.md index f0da8f9c10..e72fcc10b4 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Security.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Security.md @@ -1,5 +1,5 @@ --- -title: Working with Word document Protection | DocIO | Syncfusion +title: Working with Word Document Protection | DocIO | Syncfusion description: Learn how to encrypt, decrypt, and control changes by protecting the Word document using the .NET Word (DocIO) library without Microsoft Word. platform: document-processing control: DocIO @@ -7,14 +7,14 @@ documentation: UG --- # Working with Security -You can encrypt a Word document with password to restrict unauthorized access. You can also control the types of changes you make to this document. +You can encrypt a Word document with a password to restrict unauthorized access. You can also control the types of changes that can be made to the document. -To quickly encrypt and decrypt a Word document with the .NET Word (DOCIO) Library, please check out this video: +To quickly encrypt and decrypt a Word document with the .NET Word (DocIO) Library, please check out this video: {% youtube "https://www.youtube.com/watch?v=7EMtR2zrW80" %} -## Encrypting with password +## Encrypting with a password -The following code example shows how to encrypt the Word document with password. +The following code example shows how to encrypt the Word document with a password. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -48,7 +48,7 @@ document.Close(); Dim document As New WordDocument("Template.docx") 'Encrypts the Word document with a password document.EncryptDocument("syncfusion") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -86,7 +86,7 @@ document.Close(); {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Opens an encrypted Word document Dim document As New WordDocument("Template.docx", "password") -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -97,7 +97,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Remove encryption -You can open the encrypted Word document and remove the encryption from the document. The following code example shows how to remove the encryption from encrypted Word document. +You can open the encrypted Word document and remove the encryption from it. The following code example shows how to remove the encryption from an encrypted Word document. {% tabs %} @@ -130,7 +130,7 @@ document.Close(); Dim document As New WordDocument("Template.docx", FormatType.Docx, "syncfusion") 'Removes encryption in Word document document.RemoveEncryption() -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -139,11 +139,11 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Remove-encryption-from-Word-document). -## Protecting Word document from editing +## Protecting a Word document from editing -You can restrict a Word document from editing either by providing a password or without password. +You can restrict a Word document from editing either by providing a password or without a password. -To quickly restrict editing in a Word document using the .NET Word (DOCIO) Library, please check out this video: +To quickly restrict editing in a Word document using the .NET Word (DocIO) Library, please check out this video: {% youtube "https://www.youtube.com/watch?v=gRoW8EwjkoE" %} The following are the types of protection: @@ -152,11 +152,11 @@ The following are the types of protection: 2. [AllowOnlyFormFields](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): You can modify the form field values in the Word document. -3. [AllowOnlyRevisions](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): Allow only revisions to be made to existing content. After enabling this flag, accept and reject changes options in Microsoft Word application are disabled. +3. [AllowOnlyRevisions](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): Allow only revisions to be made to existing content. After enabling this flag, the accept and reject changes options in the Microsoft Word application are disabled. 4. [AllowOnlyReading](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): You can only view the content in the Word document. -5. [NoProtection](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): You can access/edit the Word document contents as normally. +5. [NoProtection](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.ProtectionType.html): You can access/edit the Word document contents as normal. The following code example shows how to restrict editing to modify only form fields in a Word document. @@ -164,13 +164,13 @@ The following code example shows how to restrict editing to modify only form fie {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/Security/Allow-editing-form-fields-only/.NET/Allow-editing-form-fields-only/Program.cs" %} FileStream fileStreamPath = new FileStream("Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); -//Opens an existing document from file system through constructor of WordDocument class +//Opens an existing document from stream through constructor of WordDocument class using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx)) { //Sets the protection with password and it allows only to modify the form fields type document.Protect(ProtectionType.AllowOnlyFormFields, "password"); MemoryStream stream = new MemoryStream(); - document.Save(stream, FormatType.docx); + document.Save(stream, FormatType.Docx); //Closes the Word document document.Close(); } @@ -289,14 +289,14 @@ End Using {% endtabs %} -By running the above code, you will generate a **Editable range** as shown below. +By running the above code, you will generate an **editable range** as shown below. ![Editable range](Security_images/EditableRangeInParagraph.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Add-editable-range). -### Retrieve Id of an editable range +### Retrieve ID of an editable range -You can retrieve the ID of an editable range using the **Id** property of the **EditableRange** class. +You can retrieve the ID of an editable range using the **Id** property of the **EditableRangeStart** class. The following code example illustrates how to retrieve the ID of an editable range from a Word document. @@ -389,7 +389,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Find an editable range -You can find an editable range of specific id in the collection of editable ranges through **FindById** method of **EditableRangeCollection** class. +You can find an editable range with a specific ID in the collection of editable ranges through the **FindById** method of the **EditableRangeCollection** class. The following code example illustrates how to find the editable range in a Word document. @@ -502,7 +502,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync An editable range at a specific index can also be removed from the **EditableRangeCollection** using the **RemoveAt** method. -The following code example demonstrates how to remove an editable range at particular index from a Word document. +The following code example demonstrates how to remove an editable range at a particular index from a Word document. {% tabs %} @@ -551,11 +551,12 @@ End Using You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Remove-editable-range-at-an-index). ### Editing permission + You can restrict editable ranges to specific groups or individuals. -#### Group permission +#### Group Permission -You can make an editable range editable by a group using the **EditorGroup** property of the **EditableRange** class. +You can make an editable range editable by a group using the **EditorGroup** property of the **EditableRangeStart** class. The following code example illustrates how to make an editable range available to a group in a Word document. @@ -649,9 +650,9 @@ End Using You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Group-permission-for-editable-range). -#### Single user permission +#### Single User Permission -Use the **SingleUser** property of the **EditableRange** class to make an editable range available to a single user for editing. +Use the **SingleUser** property of the **EditableRangeStart** class to make an editable range available to a single user for editing. The following code example illustrates how to make an editable range available to a single user in a Word document. @@ -745,9 +746,9 @@ End Using You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Single-user-permission-for-editable-range). -### Add editable range in a table +### Add an editable range in a table -Using the **FirstColumn** and **LastColumn** properties of the **EditableRange** class, you can specify the starting and ending columns of an editable range within a table. +Using the **FirstColumn** and **LastColumn** properties of the **EditableRangeStart** class, you can specify the starting and ending columns of an editable range within a table. The following code example illustrates how to add an editable range inside a table in a Word document. @@ -839,13 +840,12 @@ End Using {% endtabs %} -By running the above code, you will generate a **Editable range** as shown below. +By running the above code, you will generate an **editable range** as shown below. ![Editable range](Security_images/EditableRangeInTable.png) You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Security/Add-editable-range-in-a-table). -N> 1. Editable ranges are supported only in DOCX format. -N> 2. The **SingleUser** and **EditorGroup** properties cannot be set simultaneously for the same editable range. Setting one will clear the other. +N> The **SingleUser** and **EditorGroup** properties cannot be set simultaneously for the same editable range. Setting one will clear the other. ## Online Demo diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-SmartArts.md b/Document-Processing/Word/Word-Library/NET/Working-with-SmartArts.md index 0f76a08a35..9c06fc8285 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-SmartArts.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-SmartArts.md @@ -9,6 +9,8 @@ documentation: UG A SmartArt diagram is a visual representation of information that helps effectively communicate ideas in documents. You can add and modify SmartArt diagrams in Word documents using the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) (DocIO). +N> To use the SmartArt APIs, install the `Syncfusion.DocIO.Net` (cross-platform) or `Syncfusion.DocIO.WinForms` (Windows-specific) NuGet package and add the following namespaces: `Syncfusion.DocIO` and `Syncfusion.DocIO.DLS`. For setup details, see the [NuGet Packages](../../NuGet-Packages.md) page. SmartArt support is available starting from DocIO version 27.2.2. + ## Create SmartArt You can create the following categories of SmartArt in a Word document. @@ -26,7 +28,7 @@ N> DocIO supports SmartArt only in DOCX format document. ### List -The following code example illustrating how to create a **List SmartArt** in a Word document. +The following code example illustrates how to create a **List SmartArt** in a Word document. N> Refer to the appropriate tabs in the code snippets section: ***C# [Cross-platform]*** for ASP.NET Core, Blazor, Xamarin, UWP, .NET MAUI, and WinUI; ***C# [Windows-specific]*** for WinForms and WPF; ***VB.NET [Windows-specific]*** for VB.NET applications. @@ -189,11 +191,11 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Process -The following code example illustrating how to create a **Process SmartArt** in a Word document. +The following code example illustrates how to create a **Process SmartArt** in a Word document. {% tabs %} -{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/SmartArts/Create-SmartArt-Process/.NET/Create-SmartArt-List/Program.cs" %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/DocIO-Examples/main/SmartArts/Create-SmartArt-Process/.NET/Create-SmartArt-Process/Program.cs" %} //Creates a new Word document. WordDocument document = new WordDocument(); //Adds new section to the document @@ -353,7 +355,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Cycle -The following code example illustrating how to create a **Cycle SmartArt** in a Word document. +The following code example illustrates how to create a **Cycle SmartArt** in a Word document. {% tabs %} @@ -488,7 +490,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Hierarchy -The following code example illustrating how to create a **Hierarchy SmartArt** in a Word document. +The following code example illustrates how to create a **Hierarchy SmartArt** in a Word document. {% tabs %} @@ -605,7 +607,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Relationship -The following code example illustrating how to create a **Relationship SmartArt** in a Word document. +The following code example illustrates how to create a **Relationship SmartArt** in a Word document. {% tabs %} @@ -763,7 +765,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Matrix -The following code example illustrating how to create a **Matrix SmartArt** in a Word document. +The following code example illustrates how to create a **Matrix SmartArt** in a Word document. {% tabs %} @@ -961,7 +963,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Pyramid -The following code example illustrating how to create a **Pyramid SmartArt** in a Word document. +The following code example illustrates how to create a **Pyramid SmartArt** in a Word document. {% tabs %} @@ -1070,7 +1072,9 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ### Picture -The following code example illustrating how to create a **Picture SmartArt** in a Word document. +The following code example illustrates how to create a **Picture SmartArt** in a Word document. + +N> This example requires PNG image files (`Nancy Davolio.png`, `Andrew Fuller.png`, `Janet Leverling.png`) placed in an `Images` folder under the project output directory. You can obtain sample images from the [GitHub sample](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/SmartArts/Create-SmartArt-Picture/.NET/Create-SmartArt-Picture/Images). {% tabs %} @@ -1803,9 +1807,9 @@ foreach (IOfficeSmartArtNode node in smartArt.Nodes) } //Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream(); -document.Save(stream, FormatType.Docx); +wordDocument.Save(stream, FormatType.Docx); //Closes the document -document.Close(); +wordDocument.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} @@ -1827,8 +1831,8 @@ foreach (IOfficeSmartArtNode node in smartArt.Nodes) } } //Saves and closes the document instance -document.Save("Result.docx", FormatType.Docx); -document.Close(); +wordDocument.Save("Result.docx", FormatType.Docx); +wordDocument.Close(); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} diff --git a/Document-Processing/Word/Word-Library/NET/Working-with-Table-Of-Contents.md b/Document-Processing/Word/Word-Library/NET/Working-with-Table-Of-Contents.md index 9bd75ddfc3..180ebf71e2 100644 --- a/Document-Processing/Word/Word-Library/NET/Working-with-Table-Of-Contents.md +++ b/Document-Processing/Word/Word-Library/NET/Working-with-Table-Of-Contents.md @@ -7,12 +7,11 @@ documentation: UG --- # Working with Table Of Contents -[Table of contents](https://support.microsoft.com/en-gb/office/insert-a-table-of-contents-882e8564-0edb-435e-84b5-1d8552ccf0c0?redirectSourcePath=%252fen-us%252farticle%252fCreate-a-table-of-contents-or-update-a-table-of-contents-eb275189-b93e-4559-8dd9-c279457bfd72#__create_a_table ) (TOC) is used to provide an outline of the Word document. By default table of contents will be created automatically from heading styles. +[Table of contents](https://support.microsoft.com/en-gb/office/insert-a-table-of-contents-882e8564-0edb-435e-84b5-1d8552ccf0c0) (TOC) is used to provide an outline of the Word document. By default, the table of contents is created automatically from heading styles. -You can add the TOC into the paragraph by specifying the [LowerHeadingLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.TableOfContent.html#Syncfusion_DocIO_DLS_TableOfContent_LowerHeadingLevel) and [UpperHeadingLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.TableOfContent.html#Syncfusion_DocIO_DLS_TableOfContent_UpperHeadingLevel). The heading level range must be from 1 to 9. - -Basically TOC determines the TOC entries based on the TOC switches. +You can add a TOC into the paragraph by specifying the [LowerHeadingLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.TableOfContent.html#Syncfusion_DocIO_DLS_TableOfContent_LowerHeadingLevel) and [UpperHeadingLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.TableOfContent.html#Syncfusion_DocIO_DLS_TableOfContent_UpperHeadingLevel). The heading level range must be from 1 to 9. +TOC determines its entries based on the TOC switches. ## Switches in TOC @@ -59,6 +58,16 @@ Builds a table of figures of the given label.

7

+ + + +
\a

Builds a table of figures but does not include the caption's label and number.

+8

+\u

+Uses the applied paragraph outline level.

+9

+\f

+Includes entries based on the TC (Table of Contents Entry) fields instead of heading styles.

@@ -67,7 +76,7 @@ To quickly start create and update a table of contents in Word document, please ## Adding a TOC field -The following code example shows how to add a table of contents (TOC) in Word document. +The following code example shows how to add a table of contents (TOC) in a Word document. {% tabs %} @@ -209,7 +218,7 @@ paragraph.ApplyStyle(BuiltinStyle.Heading3) section.AddParagraph().AppendText(paraText) 'Updates the table of contents document.UpdateTableOfContents() -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -224,13 +233,13 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Updating table of contents -You can also update or re-build the TOC in an existing document or document created from the scratch. +You can also update or rebuild the TOC in an existing document or a document created from scratch. N> 1. Updating of TOC is not supported in Silverlight, WinRT, Universal and Windows Phone applications. -N> 2. Updating TOC makes use of the Word to PDF layout engine that may lead to update incorrect page number due to its limitations. +N> 2. Updating TOC makes use of the Word to PDF layout engine that may lead to updating incorrect page numbers due to its limitations. N> 3. In ASP.NET Core, Blazor, and Xamarin platforms, to update TOC in a Word document we recommend you to use Word to PDF [assemblies](https://help.syncfusion.com/document-processing/word/word-library/net/assemblies-required#converting-word-document-to-pdf) or [NuGet](https://help.syncfusion.com/document-processing/word/word-library/net/nuget-packages-required#converting-word-document-to-pdf) as a reference in your application. -The following code example shows how to update a TOC in an existing word document. +The following code example shows how to update a TOC in an existing Word document. {% tabs %} @@ -248,8 +257,8 @@ document.Close(); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -//Opens an input word template -WordDocument document = new WordDocument(@”Template.docx”); +//Opens an input Word template +WordDocument document = new WordDocument(@"Template.docx"); //Updates the table of contents. document.UpdateTableOfContents(); //Saves and closes the Word document instance. @@ -262,7 +271,7 @@ document.Close(); Dim document As New WordDocument("Template.docx") 'Updates the table of contents. document.UpdateTableOfContents() -‘Saves and closes the Word document instance. +'Saves and closes the Word document instance. document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -280,7 +289,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## Creating table of contents with user-defined styles -The following code example shows how to create table of contents with user-defined styles instead of heading styles. +The following code example shows how to create a table of contents with user-defined styles instead of heading styles. {% tabs %} @@ -441,12 +450,12 @@ paragraph = section.AddParagraph() 'Adds the text for the headings paragraph.AppendText("Third Chapter") 'Sets the built-in heading style -paragraph.ApplyStyle("My style") +paragraph.ApplyStyle("MyStyle") 'Adds the text to the paragraph section.AddParagraph().AppendText(paraText) 'Updates the table of contents document.UpdateTableOfContents() -‘Saves and closes the Word document instance +'Saves and closes the Word document instance document.Save("Sample.docx", FormatType.Docx) document.Close() {% endhighlight %} @@ -717,7 +726,7 @@ End Using ## Removing table of contents -The following code example shows how to remove table of contents (TOC) in Word document. +The following code example shows how to remove a table of contents (TOC) in a Word document. {% tabs %} @@ -734,7 +743,6 @@ using (WordDocument document = new WordDocument()) //Saves the file in the given path MemoryStream stream = new MemoryStream(); document.Save(stream, FormatType.Docx); - docStream.Dispose(); //Closes the document document.Close(); } @@ -769,7 +777,7 @@ End Using {% endtabs %} -The helper methods helps for removing table of contents (TOC) in Word document. +The helper methods help to remove a table of contents (TOC) in a Word document. {% tabs %} diff --git a/Document-Processing/Word/Word-Library/NET/faqs/html-and-epub-conversions-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/html-and-epub-conversions-faqs.md index 9306bf8f92..0c41ecbc20 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/html-and-epub-conversions-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/html-and-epub-conversions-faqs.md @@ -39,12 +39,6 @@ Dim document As New WordDocument("Template.docx", FormatType.Docx) document.BuiltinDocumentProperties.Title = "This is a title in EPub document" 'Saves and closes the document. document.Save("Sample.epub", FormatType.EPub) -document.Close()'Loads the existing Word document by using DocIO instance -Dim document As New WordDocument("Template.docx", FormatType.Docx) -'Sets title for Word document -document.BuiltinDocumentProperties.Title = "This is a title in EPub document" -'Saves and closes the document. -document.Save("Sample.epub", FormatType.EPub) document.Close() {% endhighlight %} @@ -95,7 +89,7 @@ When importing an HTML file into a Word document using DocIO, it is essential to {% tabs %} {% highlight html tabtitle="HTML" %} -

Hello world

{% endhighlight %} {% endtabs %} diff --git a/Document-Processing/Word/Word-Library/NET/faqs/linux-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/linux-faqs.md index acb5552357..b106a4acba 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/linux-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/linux-faqs.md @@ -33,7 +33,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## How to copy necessary Microsoft compatible fonts to Linux? -The fonts present in the location (in Linux) "/usr/share/fonts/" is used for conversion. By default, there will be limited number of fonts available in the Linux. +The fonts present in the location (in Linux) "/usr/share/fonts/" are used for conversion. By default, only a limited number of fonts will be available in the Linux environment. Use the following code example to install the Microsoft compatible fonts to Linux. @@ -51,7 +51,7 @@ N> To use Microsoft fonts in your environment, kindly get the license clearance ## How to install necessary fonts in Linux containers? -In Word to PDF conversion, Essential® DocIO uses the fonts which are installed in the corresponding production machine to measure and draw the text. If the font is not available in the production environment, then the alternate font will be used to measure and draw text based on the environment. And so, it is mandatory to install all the fonts used in the Word document in machine to achieve proper preservation. +In Word to PDF conversion, Essential® DocIO uses the fonts which are installed in the corresponding production machine to measure and draw the text. If the font is not available in the production environment, then the alternate font will be used to measure and draw text based on the environment. And so, it is mandatory to install all the fonts used in the Word document in the machine to achieve proper preservation. Use the following code example to install fonts in containers. @@ -60,7 +60,7 @@ Use the following code example to install fonts in containers. {% highlight Dockerfile %} RUN apt-get update -y && apt-get install libfontconfig -y RUN echo "deb http://httpredir.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list \ - && echo "deb http://httpredir.debian.org/debian buster-updates main contrib non- free" >> /etc/apt/sources.list \ + && echo "deb http://httpredir.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list \ && echo "deb http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list \ && echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \ && apt-get update \ @@ -87,7 +87,7 @@ By default, Culture/Locale that is specified in the container image will be used If you want to change or set Culture/Locale in the Docker container, set the required Culture/Locale in Docker file. -T> We recommend you check whether the required Culture/Locale is set to the Docker containers since some Docker container may not have Culture/Locale. +T> We recommend you check whether the required Culture/Locale is set to the Docker containers since some Docker containers may not have Culture/Locale. The following code example will set en_US locale to the container by setting Language to en_US. @@ -147,7 +147,7 @@ In addition to the previous NuGet packages, SkiaSharp.Linux helper NuGet package {% endhighlight %} {% endtabs %} -4. Make sure that the nuget.exe file is present along with SkiaSharp.Linux folder (in the parent folder of SkiaSharp.Linux folder). If not, download it from [here](https://www.nuget.org/downloads#). +4. Make sure that the nuget.exe file is present along with SkiaSharp.Linux folder (in the parent folder of SkiaSharp.Linux folder). If not, download it from [here](https://www.nuget.org/downloads). 5. Open a command prompt and navigate to SkiaSharp.Linux folder. 6. Execute the following command. @@ -157,7 +157,7 @@ nuget pack SkiaSharp.Linux\SkiaSharp.Linux.nuspec -outputdirectory "C:\NuGet" The output directory can be customized as per your need. -Now, SkiaSharp.Linux NuGet will be generated in the mentioned output directory and add the generated NuGet as additional reference. You can also find the SkiaSharp.Linux NuGet package created by us from [here](https://www.syncfusion.com/downloads/support/directtrac/general/ze/SkiaSharp.Linux.1.59.3-2103435070#). +Now, SkiaSharp.Linux NuGet will be generated in the mentioned output directory and add the generated NuGet as additional reference. You can also find the SkiaSharp.Linux NuGet package created by us from [here](https://www.syncfusion.com/downloads/support/directtrac/general/ze/SkiaSharp.Linux.1.59.3-2103435070). ## What are the NuGet packages to be installed to perform Word to PDF conversion in Linux OS? diff --git a/Document-Processing/Word/Word-Library/NET/faqs/migrate-from-net-framework-to-net-core.md b/Document-Processing/Word/Word-Library/NET/faqs/migrate-from-net-framework-to-net-core.md index 9c8643ac00..04e318cd3c 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/migrate-from-net-framework-to-net-core.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/migrate-from-net-framework-to-net-core.md @@ -23,7 +23,7 @@ In this section, we will see about the changes which need to be considered while {{'[Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core)'| markdownify }} -{{'[Syncfusion.DocToPDFConverter.WinForms](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.WinForms)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.Wpf](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.Wpf)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.AspNet](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.AspNet)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.DocToPdfConverter.AspNet.Mvc4)'| markdownify }}
{{'[Syncfusion.DocIToPDFConverter.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.DocToPdfConverter.AspNet.Mvc5)'| markdownify }} +{{'[Syncfusion.DocToPDFConverter.WinForms](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.WinForms)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.Wpf](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.Wpf)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.AspNet](https://www.nuget.org/packages/Syncfusion.DocToPDFConverter.AspNet)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.DocToPdfConverter.AspNet.Mvc4)'| markdownify }}
{{'[Syncfusion.DocToPDFConverter.AspNet.Mvc5](https://www.nuget.org/packages/Syncfusion.DocToPdfConverter.AspNet.Mvc5)'| markdownify }} {{'[Syncfusion.DocIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIORenderer.Net.Core)'| markdownify }} @@ -138,7 +138,7 @@ In this section, we will see about the changes which need to be considered while You can open the document as stream from the file system using {{'[WordDocument.Open(Stream, FormatType)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Open_System_IO_Stream_Syncfusion_DocIO_FormatType_)'| markdownify }} API -{{'[WordDocument.Save(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_)'| markdownify }}
{{'[WordDocumentSave(String, FormatType)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_)'| markdownify }} +{{'[WordDocument.Save(String)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_)'| markdownify }}
{{'[WordDocument.Save(String, FormatType)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_String_Syncfusion_DocIO_FormatType_)'| markdownify }} You can save the document as stream to the file system using {{'[WordDocument.Save(Stream, FormatType)](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.WordDocument.html#Syncfusion_DocIO_DLS_WordDocument_Save_System_IO_Stream_Syncfusion_DocIO_FormatType_)'| markdownify }} API @@ -196,5 +196,5 @@ EMF and WMF images are not supported in .NET Core platforms. N> If you want to migrate without any code changes from [“Syncfusion.DocIO.ASP.NET”](https://www.nuget.org/packages/Syncfusion.DocIO.AspNet) NuGet in application targeting .NET Framework, you can consider to use anyone of the packages N> * [Syncfusion.DocIO.WinForms](https://www.nuget.org/packages/Syncfusion.DocIO.WinForms) N> * [Syncfusion.DocIO.Wpf](https://www.nuget.org/packages/Syncfusion.DocIO.Wpf) -N> * [Syncfusion.DocIO.AspNet.Mcv4](https://www.nuget.org/packages/Syncfusion.DocIO.AspNet.Mvc4) +N> * [Syncfusion.DocIO.AspNet.Mvc4](https://www.nuget.org/packages/Syncfusion.DocIO.AspNet.Mvc4) N>*But, this is not a recommended approach.* diff --git a/Document-Processing/Word/Word-Library/NET/faqs/migration-from-microsoft-office-automation-to-docio.md b/Document-Processing/Word/Word-Library/NET/faqs/migration-from-microsoft-office-automation-to-docio.md index 3ab3f31188..56054ad557 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/migration-from-microsoft-office-automation-to-docio.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/migration-from-microsoft-office-automation-to-docio.md @@ -633,7 +633,7 @@ Imports word = Microsoft.Office.Interop.Word ---------------- -Initializes objects. +‘Initializes objects. Dim nullobject As Object = Missing.Value Dim newFilePath As Object = "Sample.docx" ‘Starts the application. @@ -675,7 +675,7 @@ PictureWatermark picWatermark = new PictureWatermark(); picWatermark.Scaling = 120f; picWatermark.Washout = true; doc.Watermark = picWatermark; -picWatermark.Picture = Image.FromFile(ImagesPath + "Water lilies.jpg"); +picWatermark.Picture = Image.FromFile("Water lilies.jpg"); //Saves the document. MemoryStream stream = new MemoryStream(); doc.Save(stream, FormatType.Docx); @@ -692,7 +692,7 @@ PictureWatermark picWatermark = new PictureWatermark(); picWatermark.Scaling = 120f; picWatermark.Washout = true; doc.Watermark = picWatermark; -picWatermark.Picture = Image.FromFile(ImagesPath + "Water lilies.jpg"); +picWatermark.Picture = Image.FromFile("Water lilies.jpg"); //Saves the document. doc.Save("Sample.docx", FormatType.Docx); //Closes the document. @@ -708,7 +708,7 @@ Dim picWatermark As PictureWatermark = New PictureWatermark() picWatermark.Scaling = 120f picWatermark.Washout = True doc.Watermark = picWatermark -picWatermark.Picture = Image.FromFile(ImagesPath and "Water lilies.jpg") +picWatermark.Picture = Image.FromFile("Water lilies.jpg") ‘Saves the document. doc.Save("Sample.docx", FormatType.Docx) ‘Closes the document. @@ -755,7 +755,7 @@ foreach (word.Section section in document.Sections) section.Footers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "Internal"; section.Footers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.ParagraphFormat.Alignment = word.WdParagraphAlignment.wdAlignParagraphLeft; //Header. - section.Headers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Fields.Add(section.Headers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range,reffieldEmpty, ref autoText, ref preserveFormatting); + section.Headers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Fields.Add(section.Headers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range, ref fieldEmpty, ref autoText, ref preserveFormatting); section.Headers[word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.ParagraphFormat.Alignment = word.WdParagraphAlignment.wdAlignParagraphRight; } //Saves the document. @@ -825,7 +825,7 @@ foreach (WSection sec in doc.Sections) para.AppendField("page", FieldType.FieldPage); para.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Right; sec.HeadersFooters.Header.Paragraphs.Add(para); - /Footer. + //Footer. WParagraph para1 = new WParagraph(doc); para1.AppendText("Internal"); para1.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Left; @@ -849,7 +849,7 @@ foreach (WSection sec in doc.Sections) para.AppendField("page", FieldType.FieldPage); para.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Right; sec.HeadersFooters.Header.Paragraphs.Add(para); - /Footer. + //Footer. WParagraph para1 = new WParagraph(doc); para1.AppendText("Internal"); para1.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Left; diff --git a/Document-Processing/Word/Word-Library/NET/faqs/multithreading-in-word-library-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/multithreading-in-word-library-faqs.md index 2770067e24..e674952ae4 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/multithreading-in-word-library-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/multithreading-in-word-library-faqs.md @@ -22,7 +22,7 @@ The following code example illustrates how to use multithreading to open, edit, {% highlight c# tabtitle="C# [Cross-platform]" %} class MultiThreading { - //Indicates the number of threads to be create. + //Indicates the number of threads to be created. private const int TaskCount = 1000; public static async Task Main() { @@ -60,7 +60,7 @@ class MultiThreading {% highlight c# tabtitle="C# [Windows-specific]" %} class MultiThreading { - //Indicates the number of threads to be create. + //Indicates the number of threads to be created. private const int TaskCount = 1000; public static async Task Main() { @@ -97,7 +97,7 @@ class MultiThreading {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} Module MultiThreading - 'Indicates the number of threads to be create. + 'Indicates the number of threads to be created. Private Const TaskCount As Integer = 1000 Public Sub Main() 'Create an array of tasks based on the TaskCount. @@ -141,7 +141,7 @@ class MultiThreading { static void Main(string[] args) { - //Indicates the number of threads to be create. + //Indicates the number of threads to be created. int limit = 5; Console.WriteLine("Parallel For Loop"); Parallel.For(0, limit, count => @@ -178,7 +178,7 @@ class MultiThreading { static void Main(string[] args) { - //Indicates the number of threads to be create. + //Indicates the number of threads to be created. int limit = 5; Console.WriteLine("Parallel For Loop"); Parallel.For(0, limit, count => diff --git a/Document-Processing/Word/Word-Library/NET/faqs/paragraph-and-paragraph-items-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/paragraph-and-paragraph-items-faqs.md index a5cd154405..9014b7bd10 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/paragraph-and-paragraph-items-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/paragraph-and-paragraph-items-faqs.md @@ -90,7 +90,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## How to set OpenType Font Features? -The Open type features provide special effects for the text. This feature is specific to Word 2010 and later version documents. +The OpenType features provide special effects for the text. This feature is specific to Word 2010 and later version documents. The OpenType features includes the following: @@ -675,13 +675,13 @@ This behavior aligns with Microsoft Word's standards, and the DocIO library adhe ## Does importing content using keep source formatting option copy the format from the style to the destination document? -Yes, when you use [ImportOptions.KeepSourceFormatting](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html#fields) while importing content using [ImportContent](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html) API, it copies both the style and inline formatting. For example, if the text is red and bold in the source document(which applied through the style), the destination document will keep the same red color and bold effect. +Yes, when you use [ImportOptions.KeepSourceFormatting](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html#fields) while importing content using [ImportContent](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html) API, it copies both the style and inline formatting. For example, if the text is red and bold in the source document (which is applied through the style), the destination document will keep the same red color and bold effect. However, if part of the text has inline formatting (like a blue color), it will override the style only for that part of the text. So, the destination document will show the blue part, but the rest of the text will stay red and bold. In short, **inline formatting** takes priority over the style for specific parts of the text, while "Keep Source Formatting" ensures that most formatting is preserved. -This behavior follows the Microsoft Word when using "Keep Source Formatting". Similarly, DocIO also follows this behavior when you use [ImportOptions.KeepSourceFormatting](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html#fields). +This behavior follows the Microsoft Word behavior when using "Keep Source Formatting". Similarly, DocIO also follows this behavior when you use [ImportOptions.KeepSourceFormatting](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.ImportOptions.html#fields). ## Are strip lines on charts supported in DocIO? diff --git a/Document-Processing/Word/Word-Library/NET/faqs/sections-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/sections-faqs.md index 23a9170032..bac99d1b48 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/sections-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/sections-faqs.md @@ -25,17 +25,17 @@ WordDocument document = new WordDocument(docStream, FormatType.Docx); foreach (WSection section in document.Sections) { HeaderFooter header; - //Gets even footer of current section + //Gets even header of current section header = section.HeadersFooters[HeaderFooterType.EvenHeader]; - //Removes even footer + //Removes even header header.ChildEntities.Clear(); - //Gets odd footer of current section + //Gets odd header of current section header = section.HeadersFooters[HeaderFooterType.OddHeader]; - //Removes odd footer + //Removes odd header header.ChildEntities.Clear(); - //Gets first page footer + //Gets first page header header = section.HeadersFooters[HeaderFooterType.FirstPageHeader]; - //Removes first page footer + //Removes first page header header.ChildEntities.Clear(); } //Saves and closes the document @@ -51,17 +51,17 @@ WordDocument document = new WordDocument("Template.docx", FormatType.Docx); foreach (WSection section in document.Sections) { HeaderFooter header; - //Gets even footer of current section + //Gets even header of current section header = section.HeadersFooters[HeaderFooterType.EvenHeader]; - //Removes even footer + //Removes even header header.ChildEntities.Clear(); - //Gets odd footer of current section + //Gets odd header of current section header = section.HeadersFooters[HeaderFooterType.OddHeader]; - //Removes odd footer + //Removes odd header header.ChildEntities.Clear(); - //Gets first page footer + //Gets first page header header = section.HeadersFooters[HeaderFooterType.FirstPageHeader]; - //Removes first page footer + //Removes first page header header.ChildEntities.Clear(); } //Saves and closes the document @@ -75,17 +75,17 @@ Dim document As New WordDocument("Template.docx", FormatType.Docx) 'Iterates through the sections For Each section As WSection In document.Sections Dim header As HeaderFooter - 'Gets even footer of current section + 'Gets even header of current section header = section.HeadersFooters(HeaderFooterType.EvenHeader) - 'Removes even footer + 'Removes even header header.ChildEntities.Clear() - 'Gets odd footer of current section + 'Gets odd header of current section header = section.HeadersFooters(HeaderFooterType.OddHeader) - 'Removes odd footer + 'Removes odd header header.ChildEntities.Clear() - 'Gets first page footer + 'Gets first page header header = section.HeadersFooters(HeaderFooterType.FirstPageHeader) - 'Removes first page footer + 'Removes first page header header.ChildEntities.Clear() Next 'Saves and closes the document @@ -130,7 +130,7 @@ document.Close(); {% highlight c# tabtitle="C# [Windows-specific]" %} //Loads the template document -WordDocument document = new WordDocument("Template.docx"); +WordDocument document = new WordDocument("Template.docx", FormatType.Docx); //Iterates through the sections foreach (WSection section in document.Sections) { diff --git a/Document-Processing/Word/Word-Library/NET/faqs/tables-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/tables-faqs.md index feba9011ac..8c4c8eca1c 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/tables-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/tables-faqs.md @@ -215,7 +215,7 @@ End Sub You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/FAQs/Insert-data-table-in-Word-document). -## How to insert a table from HTML string in Word document? +## How to insert a table from HTML string in a Word document? An HTML string can be inserted to the Word document at text body or paragraph. The following code illustrates how to insert a table to the document from the HTML string. @@ -294,7 +294,7 @@ foreach (WTableRow row in table.Rows) //Sets width as 100 for cells in even column cell.Width = 100; else - //Sets width as 150 for cell in odd column + //Sets width as 150 for cells in odd column cell.Width = 150; } } @@ -322,7 +322,7 @@ foreach (WTableRow row in table.Rows) //Sets width as 100 for cells in even column cell.Width = 100; else - //Sets width as 150 for cell in odd column + //Sets width as 150 for cells in odd column cell.Width = 150; } } @@ -347,7 +347,7 @@ For Each row As WTableRow In table.Rows 'Sets width as 100 for cells in even column cell.Width = 100 Else - 'Sets width as 150 for cell in odd column + 'Sets width as 150 for cells in odd column cell.Width = 150 End If Next @@ -418,7 +418,7 @@ document.Close() You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main/Tables/Set-position-for-table). -## How to set the text direction to a table in Word document? +## How to set the text direction to a table in a Word document? The contents of the table cell can be in vertical or horizontal direction. Each cell content can have different text direction. The following code illustrates how to set the text direction for the text in the table. @@ -645,7 +645,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## How to access a specific cell in a table in a Word document? -To access a specific cell in a table, iterate through the rows and cells of the table. Refer [here]( https://help.syncfusion.com/document-processing/word/word-library/net/working-with-tables#iterating-through-table-elements) for detailed instructions on how to iterate through the table and access particular cell. +To access a specific cell in a table, iterate through the rows and cells of the table. Refer [here](https://help.syncfusion.com/document-processing/word/word-library/net/working-with-tables#iterating-through-table-elements) for detailed instructions on how to iterate through the table and access particular cell. ## Is it possible to access and edit the content of a table in a Word document? diff --git a/Document-Processing/Word/Word-Library/NET/faqs/track-changes-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/track-changes-faqs.md index f4cbe068f0..ba98a06ca8 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/track-changes-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/track-changes-faqs.md @@ -69,7 +69,7 @@ You can **accept or reject track changes by revision type** in the tracked chang For example, if you like to accept or reject changes of specific revision type (insertions, deletions, formatting, move to, or move from), you can iterate into the revisions in Word document and then accept or reject the particular revision type using Essential DocIO. -The following code example shows how to accept or reject track changes of specific type in the Word document . +The following code example shows how to accept or reject track changes of specific type in the Word document. {% tabs %} @@ -128,7 +128,7 @@ For i As Integer = document.Revisions.Count - 1 To 0 Step -1 End If 'Resets to last item when accept the moving related revisions. If i > document.Revisions.Count - 1 Then - i = document.Revisions.Count + i = document.Revisions.Count End If Next 'Saves and closes the document diff --git a/Document-Processing/Word/Word-Library/NET/faqs/word-document-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/word-document-faqs.md index faff12d874..bca66a9697 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/word-document-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/word-document-faqs.md @@ -239,7 +239,7 @@ You can download a complete working sample from [GitHub](https://github.com/Sync ## How to check the compatibility mode of the Word document? -The [CompatibilityMode](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.CompatibilityMode.html) of a Word document can also be determined. The following code example illustrates how to check the compatibility mode of the Word document. +The [CompatibilityMode](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocIO.DLS.CompatibilityMode.html) of a Word document can be determined. The following code example illustrates how to check the compatibility mode of the Word document. {% tabs %} @@ -273,7 +273,7 @@ using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) 'Load an existing Word document. Using document As WordDocument = New WordDocument("Input.docx", FormatType.Docx) 'Get the compatibility mode. - CompatibilityMode compatibilityMode = document.Settings.CompatibilityMode + Dim compatibilityMode As CompatibilityMode = document.Settings.CompatibilityMode Console.WriteLine(compatibilityMode) 'Save a Word document. document.Save("Sample.docx", FormatType.Docx) @@ -308,12 +308,12 @@ float marginInPoints = marginInCentimeter * 28.3465f; // Assuming you have a margin value in millimeters float marginInMillimeter = 20f; -// Convert cm to points +// Convert mm to points float marginInPoints = marginInMillimeter * 2.83465f; // Assuming you have a margin value in inches float marginInInches = 1f; -// Convert cm to points +// Convert inches to points float marginInPoints = marginInInches * 72f; {% endhighlight %} @@ -325,12 +325,12 @@ float marginInPoints = marginInCentimeter * 28.3465f; // Assuming you have a margin value in millimeters float marginInMillimeter = 20f; -// Convert cm to points +// Convert mm to points float marginInPoints = marginInMillimeter * 2.83465f; // Assuming you have a margin value in inches float marginInInches = 1f; -// Convert cm to points +// Convert inches to points float marginInPoints = marginInInches * 72f; {% endhighlight %} diff --git a/Document-Processing/Word/Word-Library/NET/faqs/word-to-pdf-and-image-conversions-faqs.md b/Document-Processing/Word/Word-Library/NET/faqs/word-to-pdf-and-image-conversions-faqs.md index 8b9ea599a7..8106e63439 100644 --- a/Document-Processing/Word/Word-Library/NET/faqs/word-to-pdf-and-image-conversions-faqs.md +++ b/Document-Processing/Word/Word-Library/NET/faqs/word-to-pdf-and-image-conversions-faqs.md @@ -12,11 +12,11 @@ The frequently asked questions about Word to PDF and image conversions using Doc ## Could not find Syncfusion.OfficeChartToImageConverter assembly in .NET 3.5 Framework, does it mean there is no support for chart conversion in this Framework? -Yes, OfficeChartToImageConverter assembly is not supported in .NET 3.5 Framework and it is available in .NET 4.0 Framework. +Yes, the OfficeChartToImageConverter assembly is not supported in .NET 3.5 Framework, and it is available in .NET 4.0 Framework. ## Is it possible to convert 3D charts to PDF or image? -Current version of the DocIO library does not provide support for converting 3D charts to PDF or image format. +The current version of the DocIO library does not provide support for converting 3D charts to PDF or image format. ## Is it possible to specify PDF conformance level in Word to PDF conversion? @@ -69,7 +69,7 @@ For details on resolving font preservation issues during Word-to-PDF or image co ## Why is the chart not preserved during Word-to-PDF or image conversion in .NET Framework? -During Word-to-PDF conversion in .NET Framework, need to initialize the [ChartToImageConverter]( https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) to ensure that the chart is preserved in the PDF document. +During Word-to-PDF conversion in .NET Framework, you need to initialize the [ChartToImageConverter]( https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html) to ensure that the chart is preserved in the PDF document. The following code example illustrates how to initialize [ChartToImageConverter]( https://help.syncfusion.com/cr/document-processing/Syncfusion.OfficeChartToImageConverter.ChartToImageConverter.html). diff --git a/Document-Processing/Word/Word-Library/NET/find-item-in-word-document.md b/Document-Processing/Word/Word-Library/NET/find-item-in-word-document.md index 3a16993395..ed41e0ba0b 100644 --- a/Document-Processing/Word/Word-Library/NET/find-item-in-word-document.md +++ b/Document-Processing/Word/Word-Library/NET/find-item-in-word-document.md @@ -188,9 +188,9 @@ using (FileStream docStream = new FileStream("Input.docx", FileMode.Open, FileAc //Load the file stream into a Word document. using (WordDocument document = new WordDocument(docStream, FormatType.Docx)) { - //Find all footnote and endnote by EntityType in Word document. + //Find all footnotes by EntityType in Word document. List footNotes = document.FindAllItemsByProperty(EntityType.Footnote, null, null); - //Remove the footnotes and endnotes. + //Remove the footnotes. for (int i = 0; i < footNotes.Count; i++) { WFootnote footnote = footNotes[i] as WFootnote; @@ -220,9 +220,9 @@ using (FileStream docStream = new FileStream("Input.docx", FileMode.Open, FileAc //Load an existing Word document. using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) { - //Find all footnote and endnote by EntityType in Word document. + //Find all footnotes by EntityType in Word document. List footNotes = document.FindAllItemsByProperty(EntityType.Footnote, null, null); - //Remove the footnotes and endnotes. + //Remove the footnotes. for (int i = 0; i < footNotes.Count; i++) { WFootnote footnote = footNotes[i] as WFootnote; @@ -247,9 +247,9 @@ using (WordDocument document = new WordDocument("Input.docx", FormatType.Docx)) {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} 'Load an existing Word document. Using document As WordDocument = New WordDocument("Input.docx", FormatType.Docx) - 'Find all footnote and endnote by EntityType in Word document. + 'Find all footnotes by EntityType in Word document. Dim footNotes As List(Of Entity) = document.FindAllItemsByProperty(EntityType.Footnote, Nothing, Nothing) - 'Remove the footnotes and endnotes. + 'Remove the footnotes. For i = 0 To footNotes.Count - 1 Dim footnote As WFootnote = TryCast(footNotes(i), WFootnote) footnote.OwnerParagraph.ChildEntities.Remove(footnote) @@ -261,7 +261,7 @@ Using document As WordDocument = New WordDocument("Input.docx", FormatType.Docx) 'Creates hyperlink instance from field to manipulate the hyperlink. Dim hyperlink As Hyperlink = New Hyperlink(TryCast(fields(i), WField)) 'Modifies the Uri of the hyperlink. - If hyperlink.Type Is HyperlinkType.WebLink AndAlso hyperlink.TextToDisplay Is "HTML" Then hyperlink.Uri = "http://www.w3schools.com/" + If hyperlink.Type = HyperlinkType.WebLink AndAlso hyperlink.TextToDisplay = "HTML" Then hyperlink.Uri = "http://www.w3schools.com/" Next 'Save a Word document. document.Save("Sample.docx", FormatType.Docx) diff --git a/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-download.md b/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-download.md index 4e3db2769a..46dc4a9f1d 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-download.md +++ b/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-download.md @@ -1,14 +1,14 @@ --- layout: post -title: Downloading Syncfusion® Word linux installer - Syncfusion® -description: Learn here about how to download the Syncfusion® Word linux installer from our Syncfusion® website with license. +title: Downloading Syncfusion® Word Linux installer - Syncfusion® +description: Learn here about how to download the Syncfusion® Word Linux installer from our Syncfusion® website with license. platform: document-processing control: Installation and Deployment documentation: ug --- -# Download Syncfusion Word Linux Installer +# Download Syncfusion® Word Linux Installer The Syncfusion® installer can be downloaded from the [Syncfusion](https://www.syncfusion.com/) website. You can either download the licensed installer or try our trial installer depending on your license. @@ -27,14 +27,14 @@ Our 30-day trial can be downloaded in two ways. ### Download Free Trial Setup -1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the product -2. After completing the required form or logging in with your registered Syncfusion® account, you can download the trial installer from the confirmation page. (as shown in below screenshot.) +1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the Word product. +2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page (as shown in the below screenshot). ![Trial and downloads of Syncfusion Word](images/trial-confirmation.png) 3. With a trial license, only the latest version’s trial installer can be downloaded. 4. Unlock key is not required to install the Syncfusion Word Linux trial installer. -5. Before the trial expires, you can download the trial installer at any time from your registered account’s [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in below screenshot.) +5. Before the trial expires, you can download the trial installer at any time from your registered account's [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in the below screenshot.) ![Trial and downloads of Syncfusion Word](images/trial-download.png) @@ -52,12 +52,12 @@ You should initiate an evaluation if you have already obtained our components th ![Trial and downloads of Syncfusion Word](images/start-trial-download.png) -2. To access this page, you must sign up\log in with your Syncfusion® account. +2. To access this page, you must sign up or log in with your Syncfusion® account. 3. Begin your trial by selecting the Syncfusion® product. N> If you've already used the trial products and they haven't expired, you won't be able to start the trial for the same product again. -4. After you've started the trial, go to the [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page to get the latest version trial installer. You can generate the [unlock key](https://www.syncfusion.com/kb/8069/how-to-generate-unlock-key-for-essentials-studio-products) and [license key](https://help.syncfusion.com/common/essential-studio/licensing/how-to-generate) here at any time before the trial period expires. (as shown in below screenshot.) +4. After you've started the trial, go to the [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page to get the latest version trial installer. You can generate the [unlock key](https://www.syncfusion.com/kb/8069/how-to-generate-unlock-key-for-essentials-studio-products) and [license key](https://help.syncfusion.com/common/essential-studio/licensing/how-to-generate) here at any time before the trial period expires (as shown in the below screenshot). ![License and downloads of Syncfusion Word](images/start-trial-download-installer.png) @@ -72,9 +72,9 @@ You should initiate an evaluation if you have already obtained our components th ![License and downloads of Syncfusion Word](images/license-download.png) -4. Unlock key is not required to install the Syncfusion® Word Linux trial installer. -5. For Linux OS, ZIP formats is available for download. +4. Unlock key is not required to install the Syncfusion® Word Linux installer. +5. For Linux OS, ZIP format is available for download. ![License and downloads of Syncfusion Word](images/Linux_Download.PNG) -You can also refer to the [**Word Linux installer**](https://help.syncfusion.com/document-processing/docio/installation/linux-installer/how-to-install) links for step-by-step installation guidelines. +You can also refer to the [**Word Linux installer**](https://help.syncfusion.com/document-processing/word/word-library/net/installation/linux-installer/how-to-download) links for step-by-step installation guidelines. diff --git a/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-install.md b/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-install.md index 906968df9b..6dbda43bf4 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-install.md +++ b/Document-Processing/Word/Word-Library/NET/installation/linux-installer/how-to-install.md @@ -1,7 +1,7 @@ --- layout: post -title: Installing Syncfusion® Word linux installer-Syncfusion® -description: Learn here about how to install Syncfusion® Word linux installer after downloading from our Syncfusion® website. +title: Installing Syncfusion® Word Linux installer - Syncfusion® +description: Learn here about how to install the Syncfusion® Word Linux installer after downloading from our Syncfusion® website. platform: document-processing control: Installation and Deployment documentation: ug @@ -12,9 +12,9 @@ documentation: ug ## Step-by-Step Installation -The steps below show how to install Word Linux installer. +The steps below show how to install the Syncfusion® Word Linux installer. -1. Extract the Syncfusion® Word Linux installer(.zip) file. The files are extracted in your machine. +1. Extract the Syncfusion® Word Linux installer (.zip) file. The files are extracted to your machine. ![Welcome wizard](images/Linux_Installer1.png) @@ -25,17 +25,19 @@ The steps below show how to install Word Linux installer. N> The Unlock key is not required to install the Linux installer. +3. You can launch the demo source and use the NuGet packages included in the Linux installer. -4. You can launch the demo source and use the NuGet packages included in the Linux installer. +4. Run the following command on the Linux machine to deploy the ASP.NET Core samples in order to restore the NuGet packages: - -5. Run the following command in linux machine to deploy the ASP.NET Core samples - - **dotnet restore projectname -s \nuget** in order to restore. + ``` + dotnet restore -s ./nuget + ``` + + N> Replace `` with the name of the demo project you want to restore. ## License key registration in samples -After the installation, the license key is required to register the demo source that is included in the Mac installer. To learn about the steps for license registration for the ASP.NET Core - EJ2 samples in the Essential Studio® Word linux installer, please refer to this. +After installation, the license key is required to register the demo source that is included in the Linux installer. To learn about the steps for license registration for the ASP.NET Core - EJ2 samples in the Essential Studio® Word Linux installer, please refer to the following: * Register the license key in the [Program.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-60) file if you created the ASP.NET Core web application with Visual Studio 2022 and .NET 6.0. -* Register the license key in Configure method of [Startup.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-50-or-net-31) \ No newline at end of file +* Register the license key in the Configure method of [Startup.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-50-or-net-31) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-download.md b/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-download.md index 77ebee380f..ca95343291 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-download.md +++ b/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-download.md @@ -1,7 +1,7 @@ --- layout: post title: Downloading Syncfusion® Word Mac installer - Syncfusion® -description: Learn here about the how to download Syncfusion® Word Mac installer from our Syncfusion® website with license. +description: Learn here about how to download the Syncfusion® Word Mac installer from our Syncfusion® website with license. platform: document-processing control: Installation and Deployment documentation: ug @@ -26,14 +26,14 @@ Our 30-day trial can be downloaded in two ways. ### Download Free Trial Setup -1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the product -2. After completing the required form or logging in with your registered Syncfusion® account, you can download the trial installer from the confirmation page. (as shown in below screenshot.) +1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the Word product. +2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page (as shown in the below screenshot). ![Trial and downloads of Syncfusion Essential Studio](images/trial-confirmation.png) 3. With a trial license, only the latest version’s trial installer can be downloaded. 4. Unlock key is not required to install the Syncfusion® Word Mac trial installer. -5. Before the trial expires, you can download the trial installer at any time from your registered account’s [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in below screenshot.) +5. Before the trial expires, you can download the trial installer at any time from your registered account's [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in the below screenshot.) ![Trial and downloads of Syncfusion Essential Studio](images/trial-download.png) @@ -51,7 +51,7 @@ You should initiate an evaluation if you have already obtained our components th ![Trial and downloads of Syncfusion Essential Studio](images/start-trial-download.png) -2. To access this page, you must sign up\log in with your Syncfusion® account. +2. To access this page, you must sign up or log in with your Syncfusion® account. 3. Begin your trial by selecting the Syncfusion® product. N> If you've already used the trial products and they haven't expired, you won't be able to start the trial for the same product again. @@ -71,8 +71,8 @@ You should initiate an evaluation if you have already obtained our components th ![License and downloads of Syncfusion Essential Studio](images/license-download.png) -4. Unlock key is not required to install the Syncfusion® Word Mac trial installer. -5. For Mac OS, DMG formats is available for download. +4. Unlock key is not required to install the Syncfusion® Word Mac installer. +5. For Mac OS, DMG format is available for download. ![License and downloads of Syncfusion Essential Studio](images/Mac_Download.PNG) diff --git a/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-install.md b/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-install.md index ddb032f676..7309b87aaa 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-install.md +++ b/Document-Processing/Word/Word-Library/NET/installation/mac-installer/how-to-install.md @@ -55,13 +55,13 @@ The steps below show how to install Essential Studio® Word Mac in ![Installation type wizard](images/Mac_Installer5.png) -6. To remove the DMG file, right-click on the virtual drive on your desktop or in the Finder sidebar and select “Eject.” Also delete the folder from the Applications +6. To remove the DMG file, right-click on the virtual drive on your desktop or in the Finder sidebar and select "Eject." Also delete the folder from the Applications. ![Credential wizard](images/Mac_Installer6.png) ## License key registration in samples -After the installation, the license key is required to register the demo source that is included in the Mac installer. To learn about the steps for license registration for the ASP.NET Core - EJ2 samples in the Essential Studio® Word Mac installer, please refer to this. +After the installation, the license key is required to register the demo source that is included in the Mac installer. To learn about the steps for license registration for the ASP.NET Core - EJ2 samples in the Essential Studio® Word Mac installer, please refer to the following: * Register the license key in the [Program.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-60) file if you created the ASP.NET Core web application with Visual Studio 2022 and .NET 6.0. -* Register the license key in Configure method of [Startup.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-50-or-net-31) \ No newline at end of file +* Register the license key in the Configure method of [Startup.cs](https://ej2.syncfusion.com/aspnetcore/documentation/licensing/how-to-register-in-an-application#for-aspnet-core-application-using-net-50-or-net-31) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Library/NET/installation/offline-installer/how-to-download.md b/Document-Processing/Word/Word-Library/NET/installation/offline-installer/how-to-download.md index 479bb917b1..d6592153fc 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/offline-installer/how-to-download.md +++ b/Document-Processing/Word/Word-Library/NET/installation/offline-installer/how-to-download.md @@ -26,13 +26,13 @@ Our 30-day trial can be downloaded in two ways. ### Download Free Trial Setup 1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the Word platform. -2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page. (as shown in below screenshot.) +2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page (as shown in the below screenshot). ![Trial and downloads of Syncfusion Essential Studio](images/trial-confirmation.png) 3. With a trial license, only the latest version’s trial installer can be downloaded. 4. After downloading, the Syncfusion® Word trial installer can be unlocked using either the trial unlock key or the Syncfusion® registered login credential. More information on generating an unlock key can be found in [this](https://support.syncfusion.com/kb/article/7053/how-to-generate-unlock-key-for-essentials-studio-products) article. -5. Before the trial expires, you can download the trial installer at any time from your registered account’s [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in below screenshot +5. Before the trial expires, you can download the trial installer at any time from your registered account's [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in the below screenshot). ![Trial and downloads of Syncfusion Essential Studio](images/trial-download.png) @@ -53,7 +53,7 @@ You should initiate an evaluation if you have already obtained our components th N> If you've already used the trial products and they haven't expired, you won't be able to start the trial for the same product again. -4. After you've started the trial, go to the [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page to get the latest version trial installer. You can generate the [unlock key](https://support.syncfusion.com/kb/article/7053/how-to-generate-unlock-key-for-essentials-studio-products) and [license key](https://help.syncfusion.com/document-processing/licensing/how-to-generate) here at any time before the trial period expires. (as shown in below screenshot.) +4. After you've started the trial, go to the [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page to get the latest version trial installer. You can generate the [unlock key](https://support.syncfusion.com/kb/article/7053/how-to-generate-unlock-key-for-essentials-studio-products) and [license key](https://help.syncfusion.com/document-processing/licensing/how-to-generate) here at any time before the trial period expires (as shown in the below screenshot). ![License and downloads of Syncfusion Essential Studio](images/start-trial-download-installer.png) diff --git a/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-download.md b/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-download.md index 261b4098b5..51b8d08e66 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-download.md +++ b/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-download.md @@ -26,13 +26,13 @@ Our 30-day trial can be downloaded in two ways. ### Download Free Trial Setup 1. You can evaluate our 30-day free trial by visiting the [Download Free Trial](https://www.syncfusion.com/downloads) page and select the Word platform. -2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page. (as shown in below screenshot.) +2. After completing the required form or logging in with your registered Syncfusion® account, you can download the Word trial installer from the confirmation page (as shown in the below screenshot). ![Trial and downloads of Syncfusion Essential Studio](images/trial-confirmation.png) 3. With a trial license, only the latest version’s trial installer can be downloaded. 4. After downloading, the Syncfusion® Word trial installer can be unlocked using either the trial unlock key or the Syncfusion® registered login credential. More information on generating an unlock key can be found in [this](https://www.syncfusion.com/kb/8069/how-to-generate-unlock-key-for-essentials-studio-products) article. -5. Before the trial expires, you can download the trial installer at any time from your registered account’s [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in below screenshot.) +5. Before the trial expires, you can download the trial installer at any time from your registered account's [Trials & Downloads](https://www.syncfusion.com/account/manage-trials/downloads) page (as shown in the below screenshot.) 6. Click the Download (element 1 in the screenshot below) button to get the Syncfusion® Essential Studio® Word web installer. ![Trial and downloads of Syncfusion Essential Studio](images/trial-download.png) diff --git a/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-install.md b/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-install.md index 607a6f1168..7533b95459 100644 --- a/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-install.md +++ b/Document-Processing/Word/Word-Library/NET/installation/web-installer/how-to-install.md @@ -110,12 +110,12 @@ The steps below show how to install Essential Studio® Word Web In ## Uninstallation -Syncfusion® Word installer can be uninstalled in two ways. +The Syncfusion® Word installer can be uninstalled in two ways: - * Uninstall the Word using the Syncfusion® Word web installer - * Uninstall the Word from Windows Control Panel + * Uninstall Syncfusion® Word using the Syncfusion® Word web installer. + * Uninstall Syncfusion® Word from the Windows Control Panel. -Follow either one of the option below to uninstall Syncfusion® Essential Studio® Word installer. +Follow either one of the options below to uninstall the Syncfusion® Essential Studio® Word installer. **Option 1: Uninstall the Word using the Syncfusion® Word web installer** @@ -133,7 +133,7 @@ You can uninstall all the installed products by selecting the **Syncfusion& N> If the **Syncfusion® Essential Studio® for Word {version}** entry is selected from the Windows control panel, the Syncfusion® Essential Studio® Word alone will be removed and the below default MSI uninstallation window will be displayed. 1. The Syncfusion® Word Web Installer's welcome wizard will be displayed. Click the Next button - + ![Welcome wizard uninstall](images/Step-by-Step-Installation_img2.png) 2. The Platform Selection Wizard will appear. From the **Installed** tab, select the products to be uninstalled. To select all products, check the **Uninstall All** checkbox. Click the Next button. diff --git a/Document-Processing/Word/Word-Library/overview.md b/Document-Processing/Word/Word-Library/overview.md index 69748f74c1..d3ce5bbc2d 100644 --- a/Document-Processing/Word/Word-Library/overview.md +++ b/Document-Processing/Word/Word-Library/overview.md @@ -1,7 +1,7 @@ --- title: Word Document Processing Library | Syncfusion canonical_url: "https://www.syncfusion.com/document-sdk/net-word-library" -description: The .NET Word document processing library allows you create, read and write Word documents through code in .NET and Java applications without Microsoft Office dependencies. +description: The .NET Word document processing library allows you to create, read and write Word documents through code in .NET and Java applications without Microsoft Office dependencies. platform: document-processing control: general documentation: UG @@ -46,5 +46,6 @@ keywords: Word, SDK, Automation, API, create, read, write {% enddoccards %} -Syncfusion® Word Document Processing library is a class library used to create, read, and write Word documents through code in .NET [Windows Forms, WPF, ASP.NET MVC, ASP.NET Core, Blazor, MAUI] and Java applications without Microsoft Office dependencies. It supports various Word processing functionalities like mail merge, find and replace, bookmarks, split and merge documents, compare documents, and more. It eases you developers to just integrate this library to achieve the required Word document processing functionalities and concentrate on core logics of your application. +Syncfusion® Word Document Processing library is a class library used to create, read, and write Word documents through code in .NET [Windows Forms, WPF, ASP.NET MVC, ASP.NET Core, Blazor, .NET MAUI] and Java applications without Microsoft Office dependencies. It supports various Word processing functionalities like mail merge, find and replace, bookmarks, split and merge documents, compare documents, and more. It enables developers to integrate this library to achieve the required Word document processing functionalities and concentrate on the core logic of their applications. +N> Looking for the full .NET Word Library overview, features, pricing, and documentation? Visit the [.NET Word Library](https://www.syncfusion.com/document-sdk/net-word-library) page.