From 2384e5bc72664c38c5a9ab3201af0ee0c01001b7 Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Fri, 18 Oct 2024 18:45:56 +0530 Subject: [PATCH 1/2] FAQ --- .../.NET/Multithreading/Multithreading.sln | 25 ++++++++ .../Multithreading/Data/InputTemplate.xlsx | Bin 0 -> 6199 bytes .../Multithreading/Multithreading.csproj | 20 ++++++ .../Multithreading/Output/.gitkeep | 0 .../Multithreading/Multithreading/Program.cs | 58 ++++++++++++++++++ .../.NET/Multithreading/README.md | 1 + 6 files changed, 104 insertions(+) create mode 100644 FAQ/Multithreading/.NET/Multithreading/Multithreading.sln create mode 100644 FAQ/Multithreading/.NET/Multithreading/Multithreading/Data/InputTemplate.xlsx create mode 100644 FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj create mode 100644 FAQ/Multithreading/.NET/Multithreading/Multithreading/Output/.gitkeep create mode 100644 FAQ/Multithreading/.NET/Multithreading/Multithreading/Program.cs create mode 100644 FAQ/Multithreading/.NET/Multithreading/README.md diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading.sln b/FAQ/Multithreading/.NET/Multithreading/Multithreading.sln new file mode 100644 index 00000000..b0303033 --- /dev/null +++ b/FAQ/Multithreading/.NET/Multithreading/Multithreading.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34310.174 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Multithreading", "Multithreading\Multithreading.csproj", "{FF011E2F-22A0-4FE9-927E-E19D6943A39F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF011E2F-22A0-4FE9-927E-E19D6943A39F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3FF7195C-8AA0-4979-9884-45A22FE9BCE4} + EndGlobalSection +EndGlobal diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Data/InputTemplate.xlsx b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Data/InputTemplate.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..39d8d2cc9792395b9023e4f8f06b07fb6fee527c GIT binary patch literal 6199 zcmeHLcU05cvJTP_1gTO4L69Q7_YQ_)KtMu~7Klfj|&LIHm%eC3Lquadmb=t^#^ej zsrlNY9=H^y7WIDTF=jnf9Nx~p5J#x98;=!&b$gu8cQ+M+?Mr}j~YHwtNvA|Eb~l>9fbu-6T^|X zyY~{t%Ln|fae=dSC|xZ05{+}!|T>ML;BGDCcr(V#K8*~a- zC6$=K$-Ne*hqV$X((Oa-YzO@BtKu&F^iL2misv|Sttp1R{4WAh>u~mFphK^VddJ^- z{=l$uy8kQN@6Ld9Ga)k;pOxsXHO+(=#aCxhZ*QJAYvtffGqtX)6Qhm$`!^;)^Iyzg z`;_xLy8S>(Dg-bLcJ9Lk%IMW%5+pt0A9~col5^y5P$RhCpXu2tg5OcvyVnPgVkllf zBkkEUK`P0y*drgjw zMQcNKoa8Y*Z{$aT9gknT&nL_BGGJNR#78Tgj?BU-0Q(VEnW9>vuGVYYT!98tvC7fT zIqGHMT_}v^#TVh3lv_9YN~>Cu9q!=?ji;=WvlVte)nFhh&%1lF=jg6ZST<3g*is#O zl6+QFEe3%VpZHZSC1pfKuGg8GRORJyCuP)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q<7wJER|1D$wrRBfH?Ufcz^1r$8uPD}3!$w;L03blWe9%5Fpt$_@ E4@yitumAu6 literal 0 HcmV?d00001 diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj new file mode 100644 index 00000000..fe74e2d4 --- /dev/null +++ b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + Always + + + + diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Output/.gitkeep b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Program.cs b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Program.cs new file mode 100644 index 00000000..e202b178 --- /dev/null +++ b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Program.cs @@ -0,0 +1,58 @@ +using Syncfusion.XlsIO; +using Syncfusion.XlsIORenderer; +using Syncfusion.Pdf; + +namespace Multithreading +{ + class MultiThreading + { + //Defines the number of threads to be created + private const int ThreadCount = 1000; + public static void Main() + { + //Create an array of threads based on the ThreadCount + Thread[] threads = new Thread[ThreadCount]; + for (int i = 0; i < ThreadCount; i++) + { + threads[i] = new Thread(ReadEditConvertExcel); + threads[i].Start(); + } + + //Ensure all threads complete by calling Join on each thread + for (int i = 0; i < ThreadCount; i++) + { + threads[i].Join(); + } + } + + //Method to convert Excel to PDF + static void ReadEditConvertExcel() + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Excel2016; + FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + inputStream.Close(); + IWorksheet sheet = workbook.Worksheets[0]; + + //Add text, formula, and number in the worksheet + sheet.Range["A1"].Text = "Hello World" + DateTime.Now; + Console.WriteLine(sheet.Range["A1"].Text); + sheet.Range["A2"].Formula = "=Now()"; + sheet.Range["A3"].Number = 12345; + + //Convert the Excel workbook to PDF + XlsIORenderer xlsIORenderer = new XlsIORenderer(); + PdfDocument pdfDocument = xlsIORenderer.ConvertToPDF(workbook); + + //Save the PDF document + MemoryStream fileStream = new MemoryStream(); + pdfDocument.Save(fileStream); + fileStream.Close(); + pdfDocument.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/FAQ/Multithreading/.NET/Multithreading/README.md b/FAQ/Multithreading/.NET/Multithreading/README.md new file mode 100644 index 00000000..eb8b3bcc --- /dev/null +++ b/FAQ/Multithreading/.NET/Multithreading/README.md @@ -0,0 +1 @@ +# Does XlsIO library support multithreading and thread-safe? From 9a5397e0501dd022fd290a439a17ad3c49b75e09 Mon Sep 17 00:00:00 2001 From: KurmithaSF4004 Date: Fri, 18 Oct 2024 18:50:08 +0530 Subject: [PATCH 2/2] FAQ --- .../.NET/Multithreading/Multithreading/Multithreading.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj index fe74e2d4..0bd425b1 100644 --- a/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj +++ b/FAQ/Multithreading/.NET/Multithreading/Multithreading/Multithreading.csproj @@ -8,7 +8,7 @@ - +