Skip to content

Commit 3ae4a86

Browse files
committed
Loading and Saving
1 parent c9fb459 commit 3ae4a86

File tree

8 files changed

+118
-0
lines changed

8 files changed

+118
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35417.141 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Loading and Saving", "Loading and Saving\Loading and Saving.csproj", "{92F21BDF-C075-4EFA-916A-A7194BC5CB36}"
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+
{92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{92F21BDF-C075-4EFA-916A-A7194BC5CB36}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# 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.
2+
3+
# This stage is used when running from VS in fast mode (Default for Debug configuration)
4+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
5+
USER $APP_UID
6+
WORKDIR /app
7+
8+
9+
# This stage is used to build the service project
10+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
11+
ARG BUILD_CONFIGURATION=Release
12+
WORKDIR /src
13+
COPY ["Loading and Saving/Loading and Saving.csproj", "Loading and Saving/"]
14+
RUN dotnet restore "./Loading and Saving/Loading and Saving.csproj"
15+
COPY . .
16+
WORKDIR "/src/Loading and Saving"
17+
RUN dotnet build "./Loading and Saving.csproj" -c $BUILD_CONFIGURATION -o /app/build
18+
19+
# This stage is used to publish the service project to be copied to the final stage
20+
FROM build AS publish
21+
ARG BUILD_CONFIGURATION=Release
22+
RUN dotnet publish "./Loading and Saving.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
23+
24+
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
25+
FROM base AS final
26+
WORKDIR /app
27+
COPY --from=publish /app/publish .
28+
ENTRYPOINT ["dotnet", "Loading and Saving.dll"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Loading_and_Saving</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
14+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="*" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<None Update="Data\*">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
</None>
21+
<None Update="Output\*">
22+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
23+
</None>
24+
</ItemGroup>
25+
</Project>

Loading and Saving/Docker/Loading and Saving/Loading and Saving/Output/.gitkeep

Whitespace-only changes.
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Syncfusion.XlsIO;
2+
namespace Loading_and_Saving
3+
{
4+
class Program
5+
{
6+
public static void Main(string[] args)
7+
{
8+
using (ExcelEngine excelEngine = new ExcelEngine())
9+
{
10+
IApplication application = excelEngine.Excel;
11+
application.DefaultVersion = ExcelVersion.Xlsx;
12+
13+
//Load an existing Excel document
14+
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read);
15+
IWorkbook workbook = application.Workbooks.Open(inputStream);
16+
17+
//Access first worksheet from the workbook.
18+
IWorksheet worksheet = workbook.Worksheets[0];
19+
20+
//Set Text in cell A3.
21+
worksheet.Range["A3"].Text = "Hello World";
22+
23+
//Saving the workbook
24+
FileStream outputStream = new FileStream(Path.GetFullPath("Output/Output.xlsx"), FileMode.Create, FileAccess.Write);
25+
workbook.SaveAs(outputStream);
26+
27+
//Dispose streams
28+
inputStream.Dispose();
29+
outputStream.Dispose();
30+
}
31+
}
32+
}
33+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"profiles": {
3+
"Loading and Saving": {
4+
"commandName": "Project"
5+
},
6+
"Container (Dockerfile)": {
7+
"commandName": "Docker"
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)