diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel.sln b/Getting Started/ASP.NET Core/Create Excel/Create Excel.sln index 7d3230a6..2c58f7fa 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel.sln +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31729.503 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34310.174 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create Excel", "Create Excel\Create Excel.csproj", "{FD4DFA50-0712-445D-8B57-00BBE2879B8C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create Excel", "Create Excel\Create Excel.csproj", "{4C6910F2-CF16-477F-A790-E80A55920350}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,15 +11,15 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FD4DFA50-0712-445D-8B57-00BBE2879B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FD4DFA50-0712-445D-8B57-00BBE2879B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD4DFA50-0712-445D-8B57-00BBE2879B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FD4DFA50-0712-445D-8B57-00BBE2879B8C}.Release|Any CPU.Build.0 = Release|Any CPU + {4C6910F2-CF16-477F-A790-E80A55920350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C6910F2-CF16-477F-A790-E80A55920350}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C6910F2-CF16-477F-A790-E80A55920350}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C6910F2-CF16-477F-A790-E80A55920350}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {015F00D8-E636-4CF5-9C7C-ABB4A8708896} + SolutionGuid = {AB6292D3-7D51-4FBB-86F9-FCB52357C7C0} EndGlobalSection EndGlobal diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Controllers/HomeController.cs b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Controllers/HomeController.cs index f5ee9eef..ad4b248f 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Controllers/HomeController.cs +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Controllers/HomeController.cs @@ -1,11 +1,6 @@ -using Create_Excel.Models; +using Create_Excel.Models; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; using Syncfusion.XlsIO; using System.IO; using Syncfusion.Drawing; @@ -27,191 +22,190 @@ public IActionResult Index() } public IActionResult CreateDocument() { - //Create an instance of ExcelEngine - using (ExcelEngine excelEngine = new ExcelEngine()) - { - IApplication application = excelEngine.Excel; - application.DefaultVersion = ExcelVersion.Xlsx; - - //Create a workbook - IWorkbook workbook = application.Workbooks.Create(1); - IWorksheet worksheet = workbook.Worksheets[0]; - - //Adding a picture - FileStream imageStream = new FileStream("AdventureCycles-Logo.png", FileMode.Open, FileAccess.Read); - IPictureShape shape = worksheet.Pictures.AddPicture(1, 1, imageStream, 20, 20); - - //Disable gridlines in the worksheet - worksheet.IsGridLinesVisible = false; - - //Enter values to the cells from A3 to A5 - worksheet.Range["A3"].Text = "46036 Michigan Ave"; - worksheet.Range["A4"].Text = "Canton, USA"; - worksheet.Range["A5"].Text = "Phone: +1 231-231-2310"; - - //Make the text bold - worksheet.Range["A3:A5"].CellStyle.Font.Bold = true; - - //Merge cells - worksheet.Range["D1:E1"].Merge(); - - //Enter text to the cell D1 and apply formatting. - worksheet.Range["D1"].Text = "INVOICE"; - worksheet.Range["D1"].CellStyle.Font.Bold = true; - worksheet.Range["D1"].CellStyle.Font.RGBColor = Color.FromArgb(42, 118, 189); - worksheet.Range["D1"].CellStyle.Font.Size = 35; - - //Apply alignment in the cell D1 - worksheet.Range["D1"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignRight; - worksheet.Range["D1"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignTop; - - //Enter values to the cells from D5 to E8 - worksheet.Range["D5"].Text = "INVOICE#"; - worksheet.Range["E5"].Text = "DATE"; - worksheet.Range["D6"].Number = 1028; - worksheet.Range["E6"].Value = "12/31/2018"; - worksheet.Range["D7"].Text = "CUSTOMER ID"; - worksheet.Range["E7"].Text = "TERMS"; - worksheet.Range["D8"].Number = 564; - worksheet.Range["E8"].Text = "Due Upon Receipt"; - - //Apply RGB backcolor to the cells from D5 to E8 - worksheet.Range["D5:E5"].CellStyle.Color = Color.FromArgb(42, 118, 189); - worksheet.Range["D7:E7"].CellStyle.Color = Color.FromArgb(42, 118, 189); - - //Apply known colors to the text in cells D5 to E8 - worksheet.Range["D5:E5"].CellStyle.Font.Color = ExcelKnownColors.White; - worksheet.Range["D7:E7"].CellStyle.Font.Color = ExcelKnownColors.White; - - //Make the text as bold from D5 to E8 - worksheet.Range["D5:E8"].CellStyle.Font.Bold = true; - - //Apply alignment to the cells from D5 to E8 - worksheet.Range["D5:E8"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; - worksheet.Range["D5:E5"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; - worksheet.Range["D7:E7"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; - worksheet.Range["D6:E6"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignTop; - - //Enter value and applying formatting in the cell A7 - worksheet.Range["A7"].Text = " BILL TO"; - worksheet.Range["A7"].CellStyle.Color = Color.FromArgb(42, 118, 189); - worksheet.Range["A7"].CellStyle.Font.Bold = true; - worksheet.Range["A7"].CellStyle.Font.Color = ExcelKnownColors.White; - - //Apply alignment - worksheet.Range["A7"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignLeft; - worksheet.Range["A7"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; - - //Enter values in the cells A8 to A12 - worksheet.Range["A8"].Text = "Steyn"; - worksheet.Range["A9"].Text = "Great Lakes Food Market"; - worksheet.Range["A10"].Text = "20 Whitehall Rd"; - worksheet.Range["A11"].Text = "North Muskegon,USA"; - worksheet.Range["A12"].Text = "+1 231-654-0000"; - - //Create a Hyperlink for e-mail in the cell A13 - IHyperLink hyperlink = worksheet.HyperLinks.Add(worksheet.Range["A13"]); - hyperlink.Type = ExcelHyperLinkType.Url; - hyperlink.Address = "Steyn@greatlakes.com"; - hyperlink.ScreenTip = "Send Mail"; - - //Merge column A and B from row 15 to 22 - worksheet.Range["A15:B15"].Merge(); - worksheet.Range["A16:B16"].Merge(); - worksheet.Range["A17:B17"].Merge(); - worksheet.Range["A18:B18"].Merge(); - worksheet.Range["A19:B19"].Merge(); - worksheet.Range["A20:B20"].Merge(); - worksheet.Range["A21:B21"].Merge(); - worksheet.Range["A22:B22"].Merge(); - - //Enter details of products and prices - worksheet.Range["A15"].Text = " DESCRIPTION"; - worksheet.Range["C15"].Text = "QTY"; - worksheet.Range["D15"].Text = "UNIT PRICE"; - worksheet.Range["E15"].Text = "AMOUNT"; - worksheet.Range["A16"].Text = "Cabrales Cheese"; - worksheet.Range["A17"].Text = "Chocos"; - worksheet.Range["A18"].Text = "Pasta"; - worksheet.Range["A19"].Text = "Cereals"; - worksheet.Range["A20"].Text = "Ice Cream"; - worksheet.Range["C16"].Number = 3; - worksheet.Range["C17"].Number = 2; - worksheet.Range["C18"].Number = 1; - worksheet.Range["C19"].Number = 4; - worksheet.Range["C20"].Number = 3; - worksheet.Range["D16"].Number = 21; - worksheet.Range["D17"].Number = 54; - worksheet.Range["D18"].Number = 10; - worksheet.Range["D19"].Number = 20; - worksheet.Range["D20"].Number = 30; - worksheet.Range["D23"].Text = "Total"; - - //Apply number format - worksheet.Range["D16:E22"].NumberFormat = "$.00"; - worksheet.Range["E23"].NumberFormat = "$.00"; - - //Apply incremental formula for column Amount by multiplying Qty and UnitPrice - application.EnableIncrementalFormula = true; - worksheet.Range["E16:E20"].Formula = "=C16*D16"; - - //Formula for Sum the total - worksheet.Range["E23"].Formula = "=SUM(E16:E22)"; - - //Apply borders - worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.Thin; - worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin; - worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].Color = ExcelKnownColors.Grey_25_percent; - worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].Color = ExcelKnownColors.Grey_25_percent; - worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.Thin; - worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin; - worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].Color = ExcelKnownColors.Black; - worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].Color = ExcelKnownColors.Black; - - //Apply font setting for cells with product details - worksheet.Range["A3:E23"].CellStyle.Font.FontName = "Arial"; - worksheet.Range["A3:E23"].CellStyle.Font.Size = 10; - worksheet.Range["A15:E15"].CellStyle.Font.Color = ExcelKnownColors.White; - worksheet.Range["A15:E15"].CellStyle.Font.Bold = true; - worksheet.Range["D23:E23"].CellStyle.Font.Bold = true; - - //Apply cell color - worksheet.Range["A15:E15"].CellStyle.Color = Color.FromArgb(42, 118, 189); - - //Apply alignment to cells with product details - worksheet.Range["A15"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignLeft; - worksheet.Range["C15:C22"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; - worksheet.Range["D15:E15"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; - - //Apply row height and column width to look good - worksheet.Range["A1"].ColumnWidth = 36; - worksheet.Range["B1"].ColumnWidth = 11; - worksheet.Range["C1"].ColumnWidth = 8; - worksheet.Range["D1:E1"].ColumnWidth = 18; - worksheet.Range["A1"].RowHeight = 47; - worksheet.Range["A2"].RowHeight = 15; - worksheet.Range["A3:A4"].RowHeight = 15; - worksheet.Range["A5"].RowHeight = 18; - worksheet.Range["A6"].RowHeight = 29; - worksheet.Range["A7"].RowHeight = 18; - worksheet.Range["A8"].RowHeight = 15; - worksheet.Range["A9:A14"].RowHeight = 15; - worksheet.Range["A15:A23"].RowHeight = 18; - - //Saving the Excel to the MemoryStream - MemoryStream stream = new MemoryStream(); - workbook.SaveAs(stream); - - //Set the position as '0'. - stream.Position = 0; - - //Download the Excel file in the browser - FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/excel"); - fileStreamResult.FileDownloadName = "CreateExcel.xlsx"; - return fileStreamResult; - } - } - + //Create an instance of ExcelEngine + using (ExcelEngine excelEngine = new ExcelEngine()) + { + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + + //Create a workbook + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Adding a picture + FileStream imageStream = new FileStream("AdventureCycles-Logo.png", FileMode.Open, FileAccess.Read); + IPictureShape shape = worksheet.Pictures.AddPicture(1, 1, imageStream, 20, 20); + + //Disable gridlines in the worksheet + worksheet.IsGridLinesVisible = false; + + //Enter values to the cells from A3 to A5 + worksheet.Range["A3"].Text = "46036 Michigan Ave"; + worksheet.Range["A4"].Text = "Canton, USA"; + worksheet.Range["A5"].Text = "Phone: +1 231-231-2310"; + + //Make the text bold + worksheet.Range["A3:A5"].CellStyle.Font.Bold = true; + + //Merge cells + worksheet.Range["D1:E1"].Merge(); + + //Enter text to the cell D1 and apply formatting. + worksheet.Range["D1"].Text = "INVOICE"; + worksheet.Range["D1"].CellStyle.Font.Bold = true; + worksheet.Range["D1"].CellStyle.Font.RGBColor = Color.FromArgb(42, 118, 189); + worksheet.Range["D1"].CellStyle.Font.Size = 35; + + //Apply alignment in the cell D1 + worksheet.Range["D1"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignRight; + worksheet.Range["D1"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignTop; + + //Enter values to the cells from D5 to E8 + worksheet.Range["D5"].Text = "INVOICE#"; + worksheet.Range["E5"].Text = "DATE"; + worksheet.Range["D6"].Number = 1028; + worksheet.Range["E6"].Value = "12/31/2018"; + worksheet.Range["D7"].Text = "CUSTOMER ID"; + worksheet.Range["E7"].Text = "TERMS"; + worksheet.Range["D8"].Number = 564; + worksheet.Range["E8"].Text = "Due Upon Receipt"; + + //Apply RGB backcolor to the cells from D5 to E8 + worksheet.Range["D5:E5"].CellStyle.Color = Color.FromArgb(42, 118, 189); + worksheet.Range["D7:E7"].CellStyle.Color = Color.FromArgb(42, 118, 189); + + //Apply known colors to the text in cells D5 to E8 + worksheet.Range["D5:E5"].CellStyle.Font.Color = ExcelKnownColors.White; + worksheet.Range["D7:E7"].CellStyle.Font.Color = ExcelKnownColors.White; + + //Make the text as bold from D5 to E8 + worksheet.Range["D5:E8"].CellStyle.Font.Bold = true; + + //Apply alignment to the cells from D5 to E8 + worksheet.Range["D5:E8"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; + worksheet.Range["D5:E5"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; + worksheet.Range["D7:E7"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; + worksheet.Range["D6:E6"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignTop; + + //Enter value and applying formatting in the cell A7 + worksheet.Range["A7"].Text = " BILL TO"; + worksheet.Range["A7"].CellStyle.Color = Color.FromArgb(42, 118, 189); + worksheet.Range["A7"].CellStyle.Font.Bold = true; + worksheet.Range["A7"].CellStyle.Font.Color = ExcelKnownColors.White; + + //Apply alignment + worksheet.Range["A7"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignLeft; + worksheet.Range["A7"].CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter; + + //Enter values in the cells A8 to A12 + worksheet.Range["A8"].Text = "Steyn"; + worksheet.Range["A9"].Text = "Great Lakes Food Market"; + worksheet.Range["A10"].Text = "20 Whitehall Rd"; + worksheet.Range["A11"].Text = "North Muskegon,USA"; + worksheet.Range["A12"].Text = "+1 231-654-0000"; + + //Create a Hyperlink for e-mail in the cell A13 + IHyperLink hyperlink = worksheet.HyperLinks.Add(worksheet.Range["A13"]); + hyperlink.Type = ExcelHyperLinkType.Url; + hyperlink.Address = "Steyn@greatlakes.com"; + hyperlink.ScreenTip = "Send Mail"; + + //Merge column A and B from row 15 to 22 + worksheet.Range["A15:B15"].Merge(); + worksheet.Range["A16:B16"].Merge(); + worksheet.Range["A17:B17"].Merge(); + worksheet.Range["A18:B18"].Merge(); + worksheet.Range["A19:B19"].Merge(); + worksheet.Range["A20:B20"].Merge(); + worksheet.Range["A21:B21"].Merge(); + worksheet.Range["A22:B22"].Merge(); + + //Enter details of products and prices + worksheet.Range["A15"].Text = " DESCRIPTION"; + worksheet.Range["C15"].Text = "QTY"; + worksheet.Range["D15"].Text = "UNIT PRICE"; + worksheet.Range["E15"].Text = "AMOUNT"; + worksheet.Range["A16"].Text = "Cabrales Cheese"; + worksheet.Range["A17"].Text = "Chocos"; + worksheet.Range["A18"].Text = "Pasta"; + worksheet.Range["A19"].Text = "Cereals"; + worksheet.Range["A20"].Text = "Ice Cream"; + worksheet.Range["C16"].Number = 3; + worksheet.Range["C17"].Number = 2; + worksheet.Range["C18"].Number = 1; + worksheet.Range["C19"].Number = 4; + worksheet.Range["C20"].Number = 3; + worksheet.Range["D16"].Number = 21; + worksheet.Range["D17"].Number = 54; + worksheet.Range["D18"].Number = 10; + worksheet.Range["D19"].Number = 20; + worksheet.Range["D20"].Number = 30; + worksheet.Range["D23"].Text = "Total"; + + //Apply number format + worksheet.Range["D16:E22"].NumberFormat = "$0.00"; + worksheet.Range["E23"].NumberFormat = "$0.00"; + + //Apply incremental formula for column Amount by multiplying Qty and UnitPrice + application.EnableIncrementalFormula = true; + worksheet.Range["E16:E20"].Formula = "=C16*D16"; + + //Formula for Sum the total + worksheet.Range["E23"].Formula = "=SUM(E16:E22)"; + + //Apply borders + worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.Thin; + worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin; + worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].Color = ExcelKnownColors.Grey_25_percent; + worksheet.Range["A16:E22"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].Color = ExcelKnownColors.Grey_25_percent; + worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.Thin; + worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin; + worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeTop].Color = ExcelKnownColors.Black; + worksheet.Range["A23:E23"].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].Color = ExcelKnownColors.Black; + + //Apply font setting for cells with product details + worksheet.Range["A3:E23"].CellStyle.Font.FontName = "Arial"; + worksheet.Range["A3:E23"].CellStyle.Font.Size = 10; + worksheet.Range["A15:E15"].CellStyle.Font.Color = ExcelKnownColors.White; + worksheet.Range["A15:E15"].CellStyle.Font.Bold = true; + worksheet.Range["D23:E23"].CellStyle.Font.Bold = true; + + //Apply cell color + worksheet.Range["A15:E15"].CellStyle.Color = Color.FromArgb(42, 118, 189); + + //Apply alignment to cells with product details + worksheet.Range["A15"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignLeft; + worksheet.Range["C15:C22"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; + worksheet.Range["D15:E15"].CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter; + + //Apply row height and column width to look good + worksheet.Range["A1"].ColumnWidth = 36; + worksheet.Range["B1"].ColumnWidth = 11; + worksheet.Range["C1"].ColumnWidth = 8; + worksheet.Range["D1:E1"].ColumnWidth = 18; + worksheet.Range["A1"].RowHeight = 47; + worksheet.Range["A2"].RowHeight = 15; + worksheet.Range["A3:A4"].RowHeight = 15; + worksheet.Range["A5"].RowHeight = 18; + worksheet.Range["A6"].RowHeight = 29; + worksheet.Range["A7"].RowHeight = 18; + worksheet.Range["A8"].RowHeight = 15; + worksheet.Range["A9:A14"].RowHeight = 15; + worksheet.Range["A15:A23"].RowHeight = 18; + + //Saving the Excel to the MemoryStream + MemoryStream stream = new MemoryStream(); + workbook.SaveAs(stream); + + //Set the position as '0'. + stream.Position = 0; + + //Download the Excel file in the browser + FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/excel"); + fileStreamResult.FileDownloadName = "Output.xlsx"; + return fileStreamResult; + } + } public IActionResult Privacy() { return View(); diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj index da60b1f0..c94bd163 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj @@ -1,12 +1,24 @@ - netcoreapp3.1 + net8.0 + enable + enable Create_Excel - + + + + + + Always + + + + + diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj.user b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj.user new file mode 100644 index 00000000..b9eb5dcd --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Create Excel.csproj.user @@ -0,0 +1,7 @@ + + + + https + C:\Syncfusion\XlsIO-Examples-AzureNew\Getting Started\ASP.NET Core\Create Excel\Create Excel\Properties\PublishProfiles\CreateExcel20240717150739 - Web Deploy1.pubxml + + \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Models/ErrorViewModel.cs b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Models/ErrorViewModel.cs index 4a6e6642..3c1e7a18 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Models/ErrorViewModel.cs +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Models/ErrorViewModel.cs @@ -1,10 +1,8 @@ -using System; - namespace Create_Excel.Models { public class ErrorViewModel { - public string RequestId { get; set; } + public string? RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); } diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Program.cs b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Program.cs index 461bd5a8..07274680 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Program.cs +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Program.cs @@ -1,26 +1,27 @@ -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Create_Excel +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddControllersWithViews(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) { - public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureWebHostDefaults(webBuilder => - { - webBuilder.UseStartup(); - }); - } + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); } + +app.UseHttpsRedirection(); +app.UseStaticFiles(); + +app.UseRouting(); + +app.UseAuthorization(); + +app.MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}"); + +app.Run(); diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml new file mode 100644 index 00000000..617133e2 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml @@ -0,0 +1,30 @@ + + + + + MSDeploy + /subscriptions/431b6c0e-6e67-43e0-b169-2a182a91b202/resourcegroups/CreateExcel20240717150739/providers/Microsoft.Web/sites/CreateExcel20240717150739 + CreateExcel20240717150739 + AzureWebSite + Release + Any CPU + https://createexcel20240717150739.azurewebsites.net + true + false + 4c6910f2-cf16-477f-a790-e80a55920350 + createexcel20240717150739.scm.azurewebsites.net:443 + CreateExcel20240717150739 + + true + WMSVC + true + true + $CreateExcel20240717150739 + <_SavePWD>true + <_DestinationType>AzureWebSite + false + + \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml.user b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml.user new file mode 100644 index 00000000..c3547bf7 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy.pubxml.user @@ -0,0 +1,13 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAjeBIP9TRokGwlBDE4aW+rwAAAAACAAAAAAAQZgAAAAEAACAAAACNuCWzrifONuFKeOBsx3bdbzWYQLy9O88KVjJKJnMi4QAAAAAOgAAAAAIAACAAAAC+lQXL2HcVog79arcajQnqzqJwW0FSs8Q573YE+50OxoAAAAACLwDrXy/oRfQ/8razjRTuNVpw5Fgl6kE7zx4n46OAjlE0WdLqeR+1yzepxl/d/7tdf35sbq0RWpLZNud3LBTbLR1+qMKaLUSTMluyITtNH2pdNQru/ft3QyEOgA25XBoHI6moYnyYjhF+OlvGJW49Tq27EvWCo5Ge40AUczmcikAAAAAICbV71OUyQbIEiAU41UsERxxbAJM0nRLtPlFiEi8gJdR6a8kDK6shr47Y4+cSF4mcTbN6V7bXFaiz6uZ0DoiM + True|2024-07-17T09:53:58.2701452Z;True|2024-07-17T15:17:14.7994045+05:30; + + + \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml new file mode 100644 index 00000000..4ea77ff0 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml @@ -0,0 +1,30 @@ + + + + + MSDeploy + /subscriptions/431b6c0e-6e67-43e0-b169-2a182a91b202/resourceGroups/CreateExcel20240717150739/providers/Microsoft.Web/sites/CreateExcel20240717150739 + CreateExcel20240717150739 + AzureWebSite + Release + Any CPU + https://createexcel20240717150739.azurewebsites.net + true + false + 4c6910f2-cf16-477f-a790-e80a55920350 + createexcel20240717150739.scm.azurewebsites.net:443 + CreateExcel20240717150739 + + true + WMSVC + true + true + $CreateExcel20240717150739 + <_SavePWD>true + <_DestinationType>AzureWebSite + false + + \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml.user b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml.user new file mode 100644 index 00000000..6b0442c7 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/PublishProfiles/CreateExcel20240717150739 - Web Deploy1.pubxml.user @@ -0,0 +1,13 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAjeBIP9TRokGwlBDE4aW+rwAAAAACAAAAAAAQZgAAAAEAACAAAABLz8sLE7JsUdZXeYZUauMfwm6wNYnvbIU8urtpz7OxEAAAAAAOgAAAAAIAACAAAAD9By4hoGuRUx7RyDTzb2hF29bDrPd5CTJnodxpsXD3IIAAAAAkq8i4uJaRbZmFGDfZZu+3onKlfImkPY9Pqkt4icA7JPdFIUCTEEm1fUO8VHHKTDM/l52qPZa9LQYkssr7BY00H1cor1FDeduRYtq8hHRubpfUCwtKQ4A+6xMTrHSSSkh6EOEm4Ul5870ETWwNkSQbE7fwhh1XCbJmXBentB5vjkAAAAAysx+a2BvZB5b87MZaB859iWN2GfubJiCZdF3mEcAm2uCLXsyDbQ3sK6iDFyYRtXbLzkzkWMsuzCtwVxMHmZv5 + True|2024-07-18T06:23:00.4475029Z; + + + \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy/profile.arm.json b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy/profile.arm.json new file mode 100644 index 00000000..ad05dfb4 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy/profile.arm.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_dependencyType": "compute.appService.windows" + }, + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "CreateExcel20240717150739", + "metadata": { + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "eastus", + "metadata": { + "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support." + } + }, + "resourceName": { + "type": "string", + "defaultValue": "CreateExcel20240717150739", + "metadata": { + "description": "Name of the main resource to be created by this template." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "variables": { + "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]" + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('resourceLocation')]", + "name": "[parameters('resourceName')]", + "type": "Microsoft.Web/sites", + "apiVersion": "2015-08-01", + "tags": { + "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty" + }, + "dependsOn": [ + "[variables('appServicePlan_ResourceId')]" + ], + "kind": "app", + "properties": { + "name": "[parameters('resourceName')]", + "kind": "app", + "httpsOnly": true, + "reserved": false, + "serverFarmId": "[variables('appServicePlan_ResourceId')]", + "siteConfig": { + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "dotnetcore" + } + ] + } + }, + "identity": { + "type": "SystemAssigned" + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServicePlan_name')]", + "type": "Microsoft.Web/serverFarms", + "apiVersion": "2015-08-01", + "sku": { + "name": "S1", + "tier": "Standard", + "family": "S", + "size": "S1" + }, + "properties": { + "name": "[variables('appServicePlan_name')]" + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy1/profile.arm.json b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy1/profile.arm.json new file mode 100644 index 00000000..ad05dfb4 --- /dev/null +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/ServiceDependencies/CreateExcel20240717150739 - Web Deploy1/profile.arm.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_dependencyType": "compute.appService.windows" + }, + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "CreateExcel20240717150739", + "metadata": { + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "eastus", + "metadata": { + "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support." + } + }, + "resourceName": { + "type": "string", + "defaultValue": "CreateExcel20240717150739", + "metadata": { + "description": "Name of the main resource to be created by this template." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "variables": { + "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]" + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('resourceLocation')]", + "name": "[parameters('resourceName')]", + "type": "Microsoft.Web/sites", + "apiVersion": "2015-08-01", + "tags": { + "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty" + }, + "dependsOn": [ + "[variables('appServicePlan_ResourceId')]" + ], + "kind": "app", + "properties": { + "name": "[parameters('resourceName')]", + "kind": "app", + "httpsOnly": true, + "reserved": false, + "serverFarmId": "[variables('appServicePlan_ResourceId')]", + "siteConfig": { + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "dotnetcore" + } + ] + } + }, + "identity": { + "type": "SystemAssigned" + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServicePlan_name')]", + "type": "Microsoft.Web/serverFarms", + "apiVersion": "2015-08-01", + "sku": { + "name": "S1", + "tier": "Standard", + "family": "S", + "size": "S1" + }, + "properties": { + "name": "[variables('appServicePlan_name')]" + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/launchSettings.json b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/launchSettings.json index 4798d7e9..f4355cbf 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/launchSettings.json +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Properties/launchSettings.json @@ -1,24 +1,35 @@ { + "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:24676", - "sslPort": 44336 + "applicationUrl": "http://localhost:42452", + "sslPort": 44338 } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "http": { + "commandName": "Project", + "dotnetRunMessages": true, "launchBrowser": true, + "applicationUrl": "http://localhost:5069", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, - "Create_Excel": { + "https": { "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7117;http://localhost:5069", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Startup.cs b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Startup.cs deleted file mode 100644 index d11c9319..00000000 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Startup.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Create_Excel -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddControllersWithViews(); - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseExceptionHandler("/Home/Error"); - // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. - app.UseHsts(); - } - app.UseHttpsRedirection(); - app.UseStaticFiles(); - - app.UseRouting(); - - app.UseAuthorization(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllerRoute( - name: "default", - pattern: "{controller=Home}/{action=Index}/{id?}"); - }); - } - } -} diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Home/Index.cshtml b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Home/Index.cshtml index 4edf9b52..3e015407 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Home/Index.cshtml +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Home/Index.cshtml @@ -1,12 +1,9 @@ @{ - ViewData["Title"] = "Home Page"; -} - -@{Html.BeginForm("CreateDocument", "Home", FormMethod.Get); + Html.BeginForm("CreateDocument", "Home", FormMethod.Get); { -
- -
+
+ +
} Html.EndForm(); -} +} \ No newline at end of file diff --git a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Shared/_Layout.cshtml b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Shared/_Layout.cshtml index 656206d4..c3ace4a0 100644 --- a/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Shared/_Layout.cshtml +++ b/Getting Started/ASP.NET Core/Create Excel/Create Excel/Views/Shared/_Layout.cshtml @@ -5,18 +5,19 @@ @ViewData["Title"] - Create_Excel - + +