You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/Word/Word-Library/NET/Create-Word-Document-in-ASP-NET-Core-WEB-API.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ Step 1: Create a new C# ASP.NET Core Web API project.
25
25
26
26
Step 2: Add a name for the project.
27
27
28
-

28
+

29
29
30
30
Step 3: 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).
31
31
@@ -35,7 +35,7 @@ N> Starting with v16.2.0.x, if you reference Syncfusion<sup>®</sup> assembli
35
35
36
36
Step 4: Add a new API controller empty file in the project.
37
37
38
-

38
+

39
39
40
40
Step 5: Include the following namespaces in the **ValuesController.cs** file.
41
41
@@ -63,7 +63,7 @@ Step 6: Add a new action method CreateDocument in **ValuesController.cs** and in
@@ -72,7 +72,7 @@ Step 6: Add a new action method CreateDocument in **ValuesController.cs** and in
72
72
catch (Exception ex)
73
73
{
74
74
// Log or handle the exception
75
-
return BadRequest($"Error occurred while creating Excel file: {ex.Message}");
75
+
return BadRequest("Error occurred while creating Excel file: " + ex.Message);
76
76
}
77
77
}
78
78
@@ -175,11 +175,12 @@ Step 1: Create a console application.
175
175

176
176
177
177
Step 2: Add a name for the application.
178
-

178
+

179
179
180
180
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).
181
181
182
182
Step 3: Add the below code snippet in the **Program.cs** file for accessing the Web API using HTTP requests.
183
+
183
184
This method sends a GET request to the Web API endpoint to retrieve and save the generated Word document.
184
185
185
186
{% tabs %}
@@ -229,4 +230,4 @@ A complete working sample is available on [GitHub](https://github.com/Syncfusion
229
230
230
231
Upon executing the program, the **Word document** will be generated as follows.
231
232
232
-

233
+

0 commit comments