Skip to content

Commit 2384e5b

Browse files
committed
FAQ
1 parent 6f6c0c3 commit 2384e5b

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.9.34310.174
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Multithreading", "Multithreading\Multithreading.csproj", "{FF011E2F-22A0-4FE9-927E-E19D6943A39F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {3FF7195C-8AA0-4979-9884-45A22FE9BCE4}
24+
EndGlobalSection
25+
EndGlobal
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="27.1.53" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<None Update="Data\*">
16+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
17+
</None>
18+
</ItemGroup>
19+
20+
</Project>

FAQ/Multithreading/.NET/Multithreading/Multithreading/Output/.gitkeep

Whitespace-only changes.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using Syncfusion.XlsIO;
2+
using Syncfusion.XlsIORenderer;
3+
using Syncfusion.Pdf;
4+
5+
namespace Multithreading
6+
{
7+
class MultiThreading
8+
{
9+
//Defines the number of threads to be created
10+
private const int ThreadCount = 1000;
11+
public static void Main()
12+
{
13+
//Create an array of threads based on the ThreadCount
14+
Thread[] threads = new Thread[ThreadCount];
15+
for (int i = 0; i < ThreadCount; i++)
16+
{
17+
threads[i] = new Thread(ReadEditConvertExcel);
18+
threads[i].Start();
19+
}
20+
21+
//Ensure all threads complete by calling Join on each thread
22+
for (int i = 0; i < ThreadCount; i++)
23+
{
24+
threads[i].Join();
25+
}
26+
}
27+
28+
//Method to convert Excel to PDF
29+
static void ReadEditConvertExcel()
30+
{
31+
using (ExcelEngine excelEngine = new ExcelEngine())
32+
{
33+
IApplication application = excelEngine.Excel;
34+
application.DefaultVersion = ExcelVersion.Excel2016;
35+
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
36+
IWorkbook workbook = application.Workbooks.Open(inputStream);
37+
inputStream.Close();
38+
IWorksheet sheet = workbook.Worksheets[0];
39+
40+
//Add text, formula, and number in the worksheet
41+
sheet.Range["A1"].Text = "Hello World" + DateTime.Now;
42+
Console.WriteLine(sheet.Range["A1"].Text);
43+
sheet.Range["A2"].Formula = "=Now()";
44+
sheet.Range["A3"].Number = 12345;
45+
46+
//Convert the Excel workbook to PDF
47+
XlsIORenderer xlsIORenderer = new XlsIORenderer();
48+
PdfDocument pdfDocument = xlsIORenderer.ConvertToPDF(workbook);
49+
50+
//Save the PDF document
51+
MemoryStream fileStream = new MemoryStream();
52+
pdfDocument.Save(fileStream);
53+
fileStream.Close();
54+
pdfDocument.Dispose();
55+
}
56+
}
57+
}
58+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Does XlsIO library support multithreading and thread-safe?

0 commit comments

Comments
 (0)