diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-WASM-Standalone-app-template.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-WASM-Standalone-app-template.png new file mode 100644 index 000000000..104bb4ead Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-WASM-Standalone-app-template.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-Web-app-template.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-Web-app-template.png new file mode 100644 index 000000000..23d65753b Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor-Web-app-template.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_WASM_Standalone.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_WASM_Standalone.png new file mode 100644 index 000000000..244de2a1b Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_WASM_Standalone.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Server_Web_Additional_Information.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Server_Web_Additional_Information.png new file mode 100644 index 000000000..4f8ec78c0 Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Server_Web_Additional_Information.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_App.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_App.png new file mode 100644 index 000000000..904c511db Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_App.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_ProjectName.png b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_ProjectName.png new file mode 100644 index 000000000..d424433e3 Binary files /dev/null and b/Document-Processing/Word/Word-Library/NET/Blazor_Images/Blazor_image_Web_ProjectName.png differ diff --git a/Document-Processing/Word/Word-Library/NET/Create-Word-document-in-Blazor.md b/Document-Processing/Word/Word-Library/NET/Create-Word-document-in-Blazor.md index 101e2d396..2b5e3712a 100644 --- a/Document-Processing/Word/Word-Library/NET/Create-Word-document-in-Blazor.md +++ b/Document-Processing/Word/Word-Library/NET/Create-Word-document-in-Blazor.md @@ -1,20 +1,20 @@ --- title: Create Word document in Blazor | DocIO | Syncfusion -description: Create Word document without Microsoft Word or interop dependencies in Blazor application using Syncfusion® .NET Word (DocIO) library. +description: Create Word documents without Microsoft Word or interop dependencies in Blazor applications using Syncfusion® .NET Word (DocIO) library. platform: document-processing control: DocIO documentation: UG --- -# Create Word document in Blazor +# Create Word Document in Blazor -Syncfusion® Essential® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-processing/word-framework/net-core/word-library) used to create, read, and edit **Word** documents programmatically without **Microsoft Word** or interop dependencies. Using this library, you can **create a Word document in Blazor**. +Syncfusion® Essential® DocIO is a [.NET Core Word library](https://www.syncfusion.com/document-processing/word-framework/net-core/word-library) used to create, read, and edit **Word** documents programmatically without **Microsoft Word** or interop dependencies. Using this library, a **create a Word document in Blazor**. -To quickly get started with creating a Word document in Blazor, check this video: +To quickly get started with creating a Word document in Blazor, watch this video: {% youtube "https://www.youtube.com/watch?v=yVfDlpewbpU" %} -## Server app +## Blazor Web App Server Application {% tabcontents %} @@ -22,49 +22,63 @@ To quickly get started with creating a Word document in Blazor, check this video **Prerequisites:** -* Visual Studio 2022. -* Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later. +* Visual Studio 2022. +* Install [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later. + +Step 1: Create a new C# Blazor Web app project. +* Select "Blazor Web App" from the template and click **Next**. + + + +* Name the project and click **Next**. -Step 1: Create a new C# Blazor Server app project. Select Blazor Server App from the template and click the Next button. + - +* Select the framework and click **Create** button. -Step 2: To **create a Word document in Blazor Server app**, install [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) to the Blazor project. + + +Step 2: Install the `Syncfusion.DocIO.Net.Core` NuGet package. +To **create a Word document in a Blazor Web App Server**, install [Syncfusion.DocIO.Net.Core](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) into the Blazor project.  -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 Syncfusion® assemblies are referenced from trial setup or from the NuGet feed, the "Syncfusion.Licensing" assembly reference must also be added and a license key included in projects. Refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in an application to use Syncfusion components. -Step 3: Create a razor file with name as **DocIO** under **Pages** folder and include the following namespaces in the file. +Step 3: Create a Razor file named `DocIO.razor` in the `Pages` folder, which is located inside the `Components` folder. +Include the following namespaces in the file: {% tabs %} {% highlight c# tabtitle="C#" %} +@rendermode InteractiveServer @page "/DocIO" @using System.IO; -@using ServerSideApplication; -@inject ServerSideApplication.Data.WordService service +@using Create_Word_document; +@inject Create_Word_document.Data.WordService service @inject Microsoft.JSInterop.IJSRuntime JS {% endhighlight %} {% endtabs %} -Step 4: Add the following code in **DocIO.razor** file to create a new button. +Step 4: Add a button to `DocIO.razor`. +Include the following code to create a new button that triggers document creation: {% tabs %} {% highlight CSHTML %} -
Syncfusion DocIO library (Essential DocIO) is a Blazor DocIO library used to create, read, edit, and convert Word files in your applications without Microsoft Office dependencies.
+The Syncfusion DocIO library (Essential DocIO) is a Blazor DocIO library used to create, read, edit, and convert Word files in applications without Microsoft Office dependencies.
{% endhighlight %} {% endtabs %} -Step 5: Add the following code in **DocIO.razor** file to create and download the **Word document**. +Step 5: Implement `CreateWord` method in `DocIO.razor`. +Add the following code to create and download the Word document: {% tabs %} {% highlight c# tabtitle="C#" %} @code { MemoryStream documentStream; ///