Skip to content

Commit 1506f4a

Browse files
858102-CREExcelElasticBeanStalkExample
1 parent 2fde28b commit 1506f4a

File tree

79 files changed

+74858
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+74858
-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.14.36127.28 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditExcel", "EditExcel\EditExcel.csproj", "{5E409EA1-7A46-41BA-A285-3388825A4865}"
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+
{5E409EA1-7A46-41BA-A285-3388825A4865}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{5E409EA1-7A46-41BA-A285-3388825A4865}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{5E409EA1-7A46-41BA-A285-3388825A4865}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{5E409EA1-7A46-41BA-A285-3388825A4865}.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 = {A01AC03C-89C1-4BCF-8BDB-60BD2DDBDEE0}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
using EditExcel.Models;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Syncfusion.Drawing;
4+
using Syncfusion.XlsIO;
5+
using Syncfusion.XlsIO.Implementation.Collections;
6+
using System.Diagnostics;
7+
using static Syncfusion.XlsIO.Parser.Biff_Records.Charts.ChartPicfRecord;
8+
9+
namespace Create_Excel.Controllers
10+
{
11+
public class HomeController : Controller
12+
{
13+
private readonly ILogger<HomeController> _logger;
14+
15+
public HomeController(ILogger<HomeController> logger)
16+
{
17+
_logger = logger;
18+
}
19+
20+
public IActionResult Index()
21+
{
22+
return View();
23+
}
24+
25+
public ActionResult EditExcelDocument()
26+
{
27+
using (ExcelEngine excelEngine = new ExcelEngine())
28+
{
29+
//Instantiate the Excel application object
30+
IApplication application = excelEngine.Excel;
31+
32+
//Assigns default application version
33+
application.DefaultVersion = ExcelVersion.Xlsx;
34+
35+
//A existing workbook is opened.
36+
FileStream sampleFile = new FileStream("Data/InputTemplate.xlsx", FileMode.Open);
37+
IWorkbook workbook = application.Workbooks.Open(sampleFile);
38+
39+
//Access first worksheet from the workbook.
40+
IWorksheet worksheet = workbook.Worksheets[0];
41+
42+
//Set Text in cell A3.
43+
worksheet.Range["A3"].Text = "Hello World";
44+
//Saving the Excel to the MemoryStream
45+
MemoryStream stream = new MemoryStream();
46+
workbook.SaveAs(stream);
47+
48+
//Set the position as '0'.
49+
stream.Position = 0;
50+
51+
//Download Word document in the browser.
52+
return File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Sample.xlsx");
53+
}
54+
55+
}
56+
public IActionResult Privacy()
57+
{
58+
return View();
59+
}
60+
61+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
62+
public IActionResult Error()
63+
{
64+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
65+
}
66+
}
67+
}
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="29.2.7" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<ActiveDebugProfile>https</ActiveDebugProfile>
5+
</PropertyGroup>
6+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace EditExcel.Models
2+
{
3+
public class ErrorViewModel
4+
{
5+
public string? RequestId { get; set; }
6+
7+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
8+
}
9+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var builder = WebApplication.CreateBuilder(args);
2+
3+
// Add services to the container.
4+
builder.Services.AddControllersWithViews();
5+
6+
var app = builder.Build();
7+
8+
// Configure the HTTP request pipeline.
9+
if (!app.Environment.IsDevelopment())
10+
{
11+
app.UseExceptionHandler("/Home/Error");
12+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
13+
app.UseHsts();
14+
}
15+
16+
app.UseHttpsRedirection();
17+
app.UseStaticFiles();
18+
19+
app.UseRouting();
20+
21+
app.UseAuthorization();
22+
23+
app.MapControllerRoute(
24+
name: "default",
25+
pattern: "{controller=Home}/{action=Index}/{id?}");
26+
27+
app.Run();
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"iisSettings": {
4+
"windowsAuthentication": false,
5+
"anonymousAuthentication": true,
6+
"iisExpress": {
7+
"applicationUrl": "http://localhost:42435",
8+
"sslPort": 44340
9+
}
10+
},
11+
"profiles": {
12+
"http": {
13+
"commandName": "Project",
14+
"dotnetRunMessages": true,
15+
"launchBrowser": true,
16+
"applicationUrl": "http://localhost:5107",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"https": {
22+
"commandName": "Project",
23+
"dotnetRunMessages": true,
24+
"launchBrowser": true,
25+
"applicationUrl": "https://localhost:7105;http://localhost:5107",
26+
"environmentVariables": {
27+
"ASPNETCORE_ENVIRONMENT": "Development"
28+
}
29+
},
30+
"IIS Express": {
31+
"commandName": "IISExpress",
32+
"launchBrowser": true,
33+
"environmentVariables": {
34+
"ASPNETCORE_ENVIRONMENT": "Development"
35+
}
36+
}
37+
}
38+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@{
2+
Html.BeginForm("EditExcelDocument", "Home", FormMethod.Get);
3+
{
4+
<div>
5+
<input type="submit" value="Edit Excel document" style="width:200px;height:27px" />
6+
</div>
7+
}
8+
Html.EndForm();
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@{
2+
ViewData["Title"] = "Privacy Policy";
3+
}
4+
<h1>@ViewData["Title"]</h1>
5+
6+
<p>Use this page to detail your site's privacy policy.</p>

0 commit comments

Comments
 (0)