diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving.sln b/Loading and Saving/Docker/Loading and Saving/Loading and Saving.sln new file mode 100644 index 00000000..91d475b6 --- /dev/null +++ b/Loading and Saving/Docker/Loading and Saving/Loading and Saving.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35417.141 d17.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loading and Saving", "Loading and Saving\Loading and Saving.csproj", "{92F21BDF-C075-4EFA-916A-A7194BC5CB36}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Data/InputTemplate.xlsx b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Data/InputTemplate.xlsx new file mode 100644 index 00000000..04c7f107 Binary files /dev/null and b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Data/InputTemplate.xlsx differ diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Dockerfile b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Dockerfile new file mode 100644 index 00000000..8ab0960c --- /dev/null +++ b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Dockerfile @@ -0,0 +1,28 @@ +# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base +USER $APP_UID +WORKDIR /app + + +# This stage is used to build the service project +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Loading and Saving/Loading and Saving.csproj", "Loading and Saving/"] +RUN dotnet restore "./Loading and Saving/Loading and Saving.csproj" +COPY . . +WORKDIR "/src/Loading and Saving" +RUN dotnet build "./Loading and Saving.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./Loading and Saving.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Loading and Saving.dll"] \ No newline at end of file diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Loading and Saving.csproj b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Loading and Saving.csproj new file mode 100644 index 00000000..5bb4eb2b --- /dev/null +++ b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Loading and Saving.csproj @@ -0,0 +1,25 @@ + + + + Exe + net8.0 + Loading_and_Saving + enable + enable + Linux + + + + + + + + + + Always + + + Always + + + diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/.gitkeep b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/Output.xlsx b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/Output.xlsx new file mode 100644 index 00000000..5e04bab2 Binary files /dev/null and b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/Output.xlsx differ diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Program.cs b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Program.cs new file mode 100644 index 00000000..f1ed726b --- /dev/null +++ b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Program.cs @@ -0,0 +1,33 @@ +using Syncfusion.XlsIO; +namespace Loading_and_Saving +{ + class Program + { + public static void Main(string[] args) + { + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Load an existing Excel document + FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + + //Access first worksheet from the workbook. + IWorksheet worksheet = workbook.Worksheets[0]; + + //Set Text in cell A3. + worksheet.Range["A3"].Text = "Hello World"; + + //Saving the workbook + FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write); + workbook.SaveAs(outputStream); + + //Dispose streams + inputStream.Dispose(); + outputStream.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Properties/launchSettings.json b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Properties/launchSettings.json new file mode 100644 index 00000000..a95a153d --- /dev/null +++ b/Loading and Saving/Docker/Loading and Saving/Loading and Saving/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "Loading and Saving": { + "commandName": "Project" + }, + "Container (Dockerfile)": { + "commandName": "Docker" + } + } +} \ No newline at end of file