Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clone-and-merge-word-document", "Clone-and-merge-word-document\Clone-and-merge-word-document.csproj", "{5CA9367C-0457-46D2-888A-2546415F959D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5CA9367C-0457-46D2-888A-2546415F959D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5CA9367C-0457-46D2-888A-2546415F959D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5CA9367C-0457-46D2-888A-2546415F959D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5CA9367C-0457-46D2-888A-2546415F959D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E9FAA86B-9898-40D7-8F82-BC653E801479}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Clone_and_merge_word_document</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.ComponentModel;
using System.Diagnostics;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;

class Program
{
static void Main()
{
string sourceFolder = Path.GetFullPath("../../../Data/SourceDocument/");
string destinationFolder = Path.GetFullPath("../../../Data/DestinationDocument/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all source files
string[] sourceFiles = Directory.GetFiles(sourceFolder, "*.docx");

foreach (string sourcePath in sourceFiles)
{
string fileName = Path.GetFileName(sourcePath);
string destinationPath = Path.Combine(destinationFolder, fileName);

if (!File.Exists(destinationPath))
{
Console.WriteLine($"Skipping {fileName} - No matching destination file found.");
continue;
}

string outputPath = Path.Combine(outputFolder, fileName);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open source and destination document
WordDocument sourceDocument = new WordDocument(sourcePath);
WordDocument destinationDocument = new WordDocument(destinationPath);

// Clone and merge all slides
foreach (WSection section in sourceDocument.Sections)
{
WSection clonedSection = section.Clone();
destinationDocument.Sections.Add(clonedSection);
}

// Save the merged document.
destinationDocument.Save(outputPath);

stopwatch.Stop();
Console.WriteLine($"{fileName} is cloned and merged in {stopwatch.Elapsed.TotalSeconds} seconds.");
sourceDocument.Close();
destinationDocument.Close();
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Open-and-Save-Word-document", "Open-and-Save-Word-document\Open-and-Save-Word-document.csproj", "{F630EBAE-8A20-4D79-B012-781410BF2CC1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F630EBAE-8A20-4D79-B012-781410BF2CC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F630EBAE-8A20-4D79-B012-781410BF2CC1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F630EBAE-8A20-4D79-B012-781410BF2CC1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F630EBAE-8A20-4D79-B012-781410BF2CC1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A90BE93F-7358-4498-9C69-E8FB76BF2773}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Open_and_Save_Word_document</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

using System.Diagnostics;
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;


class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .docx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.docx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string outputPath = Path.Combine(outputFolder, fileName);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Load or open Word document
WordDocument document = new WordDocument(inputPath);

// Save the Word document to Output folder
document.Save(outputPath);
stopwatch.Stop();
Console.WriteLine($"{fileName} open and saved in {stopwatch.Elapsed.TotalSeconds} seconds");
document.Close();
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Word-document-to-image", "Word-document-to-image\Word-document-to-image.csproj", "{E988CDD3-C3C0-4C8F-8A70-45F8EBF9250A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E988CDD3-C3C0-4C8F-8A70-45F8EBF9250A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E988CDD3-C3C0-4C8F-8A70-45F8EBF9250A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E988CDD3-C3C0-4C8F-8A70-45F8EBF9250A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E988CDD3-C3C0-4C8F-8A70-45F8EBF9250A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DFC95597-6898-4ECD-8871-95EDCE78A20D}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using System;
using System.Diagnostics;

class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .docx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.docx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string documentOutputFolder = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(fileName));
Directory.CreateDirectory(documentOutputFolder);

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open an existing Word document
WordDocument document = new WordDocument(inputPath);
DocIORenderer renderer = new DocIORenderer();
//Convert the entire Word document to images.
Stream[] imageStreams = document.RenderAsImages();
for (int i = 0; i < imageStreams.Length; i++)
{
//Save the image stream as file.
string imagePath = Path.Combine(documentOutputFolder, $"WordToImage_{i + 1}.jpg");
using (FileStream fileStreamOutput = new(imagePath, FileMode.Create, FileAccess.Write))
{
imageStreams[i].CopyTo(fileStreamOutput);
}
}
stopwatch.Stop();
Console.WriteLine($"{fileName} processed in {stopwatch.Elapsed.TotalSeconds} seconds");

}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Word_document_to_image</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions Performance-metrices/Word-to-PDF/.NET/Word-to-PDF/Word-to-PDF.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36518.9 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Word-to-PDF", "Word-to-PDF\Word-to-PDF.csproj", "{92182A29-BB5A-4792-A75C-C84A3CD35C80}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92182A29-BB5A-4792-A75C-C84A3CD35C80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92182A29-BB5A-4792-A75C-C84A3CD35C80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92182A29-BB5A-4792-A75C-C84A3CD35C80}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92182A29-BB5A-4792-A75C-C84A3CD35C80}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A17A51C1-D438-418D-A678-4E93528210AE}
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;
using System.Diagnostics;
using System.IO;
using System.Reflection.Metadata;

class Program
{
static void Main()
{
string inputFolder = Path.GetFullPath("../../../Data/");
string outputFolder = Path.GetFullPath("../../../Output/");

Directory.CreateDirectory(outputFolder);

// Get all .docx files in the Data folder
string[] files = Directory.GetFiles(inputFolder, "*.docx");

foreach (string inputPath in files)
{
string fileName = Path.GetFileName(inputPath);
string outputPath = Path.Combine(outputFolder, Path.GetFileNameWithoutExtension(fileName) + ".pdf");

Stopwatch stopwatch = Stopwatch.StartNew();

try
{
// Open and convert Word to PDF
using (WordDocument document = new WordDocument(inputPath))
{
DocIORenderer render = new DocIORenderer();
// Convert Word to PDF
using (PdfDocument pdfDocument = render.ConvertToPDF(document))
{
pdfDocument.Save(outputPath);
}
}
stopwatch.Stop();
Console.WriteLine($"{fileName} taken time to convert as PDF: {stopwatch.Elapsed.TotalSeconds} seconds");
}
catch (Exception ex)
{
Console.WriteLine($"Error processing {fileName}: {ex.Message}");
}
}
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Word_to_PDF</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

</Project>
Loading