diff --git a/HTML-conversions/Customize-image-data/.NET/Customize-image-data/Program.cs b/HTML-conversions/Customize-image-data/.NET/Customize-image-data/Program.cs
index e3b9ec146..8ba6f38ec 100644
--- a/HTML-conversions/Customize-image-data/.NET/Customize-image-data/Program.cs
+++ b/HTML-conversions/Customize-image-data/.NET/Customize-image-data/Program.cs
@@ -7,25 +7,20 @@ namespace Customize_image_data
class Program
{
static void Main(string[] args)
- {
- //Loads an existing Word document into DocIO instance.
- using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.html"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+ {
+ //Creates a new instance of WordDocument
+ using (WordDocument document = new WordDocument())
{
- using (WordDocument document = new WordDocument())
- {
- //Hooks the ImageNodeVisited event to open the image from a specific location.
- document.HTMLImportSettings.ImageNodeVisited += OpenImage;
- //Opens the input HTML document.
- document.Open(fileStreamPath, FormatType.Html);
- //Unhooks the ImageNodeVisited event after loading HTML.
- document.HTMLImportSettings.ImageNodeVisited -= OpenImage;
- //Creates file stream.
- using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/HtmlToWord.docx"), FileMode.Create, FileAccess.ReadWrite))
- {
- //Saves the Word document to file stream.
- document.Save(outputFileStream, FormatType.Docx);
- }
- }
+ //Hooks the ImageNodeVisited event to open the image from a specific location
+ document.HTMLImportSettings.ImageNodeVisited += OpenImage;
+ //Opens the input HTML document
+ document.Open(@"Data\Input.html", FormatType.Html);
+ //Unhooks the ImageNodeVisited event after loading HTML
+ document.HTMLImportSettings.ImageNodeVisited -= OpenImage;
+ //Saves the Word document
+ document.Save(@"Output\HtmlToWord.docx", FormatType.Docx);
+ //Closes the WordDocument instance
+ document.Close();
}
}
private static void OpenImage(object sender, ImageNodeVisitedEventArgs args)
@@ -34,4 +29,5 @@ private static void OpenImage(object sender, ImageNodeVisitedEventArgs args)
args.ImageStream = System.IO.File.OpenRead(args.Uri);
}
}
+
}
diff --git a/Markdown-to-Word-conversion/Customize-image/.NET/Customize-image/Program.cs b/Markdown-to-Word-conversion/Customize-image/.NET/Customize-image/Program.cs
index 448364f18..33b9aabc5 100644
--- a/Markdown-to-Word-conversion/Customize-image/.NET/Customize-image/Program.cs
+++ b/Markdown-to-Word-conversion/Customize-image/.NET/Customize-image/Program.cs
@@ -3,6 +3,7 @@
using Syncfusion.Drawing;
using System.IO;
using System.Net;
+using System.Net.Http;
namespace Customize_image
{
@@ -31,12 +32,12 @@ private static void MdImportSettings_ImageNodeVisited(object sender, Syncfusion.
//Retrive the image from the website and use it.
else if (args.Uri.StartsWith("https://"))
{
- WebClient client = new WebClient();
//Download the image as a stream.
- byte[] image = client.DownloadData(args.Uri);
- Stream stream = new MemoryStream(image);
- //Set the retrieved image from the input Markdown.
- args.ImageStream = stream;
+ using (HttpClient client = new HttpClient())
+ {
+ byte[] image = client.GetByteArrayAsync(args.Uri).GetAwaiter().GetResult();
+ args.ImageStream = new MemoryStream(image);
+ }
}
}
}
diff --git a/Markdown-to-Word-conversion/Modify-image-size/Modify-image-size/Program.cs b/Markdown-to-Word-conversion/Modify-image-size/Modify-image-size/Program.cs
index c14f4ae3e..242fceb1b 100644
--- a/Markdown-to-Word-conversion/Modify-image-size/Modify-image-size/Program.cs
+++ b/Markdown-to-Word-conversion/Modify-image-size/Modify-image-size/Program.cs
@@ -34,11 +34,10 @@ static void MdImportSettings_ImageNodeVisited(object sender, Syncfusion.Office.M
// Retrieve the image from the website and use it.
else if (args.Uri.StartsWith("https://"))
{
- WebClient client = new WebClient();
- // Download the image as a stream.
- byte[] image = client.DownloadData(args.Uri);
- Stream stream = new MemoryStream(image);
- // Set the retrieved image from the input Markdown.
- args.ImageStream = stream;
+ using (HttpClient client = new HttpClient())
+ {
+ byte[] image = client.GetByteArrayAsync(args.Uri).GetAwaiter().GetResult();
+ args.ImageStream = new MemoryStream(image);
+ }
}
}
diff --git a/Word-document/Extract-Text-From-Word-Document/.NET/Extract-Text-From-Word-Document/Extract-Text-From-Word-Document.csproj b/Word-document/Extract-Text-From-Word-Document/.NET/Extract-Text-From-Word-Document/Extract-Text-From-Word-Document.csproj
index 32561db42..35f65617b 100644
--- a/Word-document/Extract-Text-From-Word-Document/.NET/Extract-Text-From-Word-Document/Extract-Text-From-Word-Document.csproj
+++ b/Word-document/Extract-Text-From-Word-Document/.NET/Extract-Text-From-Word-Document/Extract-Text-From-Word-Document.csproj
@@ -14,9 +14,12 @@
Always
-
+
Always
+
+ Always
+
diff --git a/Word-to-Image-conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs b/Word-to-Image-conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
index 4f4a1c448..7e5d6f0b6 100644
--- a/Word-to-Image-conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
+++ b/Word-to-Image-conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
@@ -42,7 +42,7 @@ static void Main(string[] args)
private static void FontSettings_SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment.
- if (args.OrignalFontName == "Arial Unicode MS")
+ if (args.OriginalFontName == "Arial Unicode MS")
{
switch (args.FontStyle)
{
diff --git a/Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Alpine/WordToPDFDockerSample/Dockerfile b/Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Alpine/WordToPDFDockerSample/Dockerfile
index c3b7b6e19..3ac43e602 100644
--- a/Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Alpine/WordToPDFDockerSample/Dockerfile
+++ b/Word-to-PDF-Conversion/Convert-Word-document-to-PDF/Docker/Alpine/WordToPDFDockerSample/Dockerfile
@@ -1,8 +1,7 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
-RUN apk update && apk upgrade && apk add fontconfig
-RUN apk add --update ttf-dejavu fontconfig
+RUN apk update && apk add --no-cache fontconfig ttf-dejavu
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
diff --git a/Word-to-PDF-Conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs b/Word-to-PDF-Conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
index bcf8fb0aa..51b6410c0 100644
--- a/Word-to-PDF-Conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
+++ b/Word-to-PDF-Conversion/Use-alternate-font-without-installing/.NET/Use-alternate-font-without-installing/Program.cs
@@ -38,7 +38,7 @@ static void Main(string[] args)
private static void FontSettings_SubstituteFont(object sender, SubstituteFontEventArgs args)
{
//Sets the alternate font when a specified font is not installed in the production environment.
- if (args.OrignalFontName == "Arial Unicode MS")
+ if (args.OriginalFontName == "Arial Unicode MS")
{
switch (args.FontStyle)
{