diff --git a/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel.sln b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel.sln
new file mode 100644
index 00000000..d255569b
--- /dev/null
+++ b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33516.290
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Create Excel", "Create Excel\Create Excel.csproj", "{FB49114E-C61B-4E0D-A9B1-DFCF4E9CAB60}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FB49114E-C61B-4E0D-A9B1-DFCF4E9CAB60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FB49114E-C61B-4E0D-A9B1-DFCF4E9CAB60}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FB49114E-C61B-4E0D-A9B1-DFCF4E9CAB60}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FB49114E-C61B-4E0D-A9B1-DFCF4E9CAB60}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {9863BE21-A855-446B-9501-4E0966A35F9E}
+ EndGlobalSection
+EndGlobal
diff --git a/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Controllers/HomeController.cs b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Controllers/HomeController.cs
new file mode 100644
index 00000000..13eee9b5
--- /dev/null
+++ b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Controllers/HomeController.cs
@@ -0,0 +1,221 @@
+using Create_Excel.Models;
+using Microsoft.AspNetCore.Mvc;
+using Syncfusion.XlsIO;
+using System.Diagnostics;
+using Syncfusion.Drawing;
+
+namespace Create_Excel_file.Controllers
+{
+ public class HomeController : Controller
+ {
+ // Inject the IWebHostEnvironment service in your class or method
+ private readonly IWebHostEnvironment _hostingEnvironment;
+ public HomeController(IWebHostEnvironment hostingEnvironment)
+ {
+ _hostingEnvironment = hostingEnvironment;
+ }
+ 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
+
+ string imagePath = Path.Combine(_hostingEnvironment.WebRootPath, "Data/AdventureCycles-Logo.png");
+ FileStream imageStream = new FileStream(imagePath, 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 = "Output.xlsx";
+ return fileStreamResult;
+ }
+ }
+ public IActionResult Index()
+ {
+ return View();
+ }
+
+ public IActionResult Privacy()
+ {
+ return View();
+ }
+
+ [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
+ public IActionResult Error()
+ {
+ return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
+ }
+ }
+}
\ No newline at end of file
diff --git a/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Create Excel.csproj b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Create Excel.csproj
new file mode 100644
index 00000000..cc96c13f
--- /dev/null
+++ b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Create Excel.csproj
@@ -0,0 +1,24 @@
+
Use this page to detail your site's privacy policy.
diff --git a/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/Error.cshtml b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/Error.cshtml new file mode 100644 index 00000000..a1e04783 --- /dev/null +++ b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/Error.cshtml @@ -0,0 +1,25 @@ +@model ErrorViewModel +@{ + ViewData["Title"] = "Error"; +} + +
+ Request ID: @Model.RequestId
+
+ Swapping to Development environment will display more detailed information about the error that occurred. +
++ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +
diff --git a/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/_Layout.cshtml b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/_Layout.cshtml new file mode 100644 index 00000000..ca3671a5 --- /dev/null +++ b/Getting Started/Azure/Azure_App_Service/Create Excel/Create Excel/Views/Shared/_Layout.cshtml @@ -0,0 +1,49 @@ + + + + + +`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\n\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n\n// Abbreviations\n//\n// 1. Duplicate behavior to the data-bs-* attribute for our tooltip plugin\n// 2. Add the correct text decoration in Chrome, Edge, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Prevent the text-decoration to be skipped.\n\nabbr[title],\nabbr[data-bs-original-title] { // 1\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n text-decoration-skip-ink: none; // 4\n}\n\n\n// Address\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\n\n// Lists\n\nol,\nul {\n padding-left: 2rem;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\n// 1. Undo browser default\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // 1\n}\n\n\n// Blockquote\n\nblockquote {\n margin: 0 0 1rem;\n}\n\n\n// Strong\n//\n// Add the correct font weight in Chrome, Edge, and Safari\n\nb,\nstrong {\n font-weight: $font-weight-bolder;\n}\n\n\n// Small\n//\n// Add the correct font size in all browsers\n\nsmall {\n @include font-size($small-font-size);\n}\n\n\n// Mark\n\nmark {\n padding: $mark-padding;\n background-color: $mark-bg;\n}\n\n\n// Sub and Sup\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n\nsub,\nsup {\n position: relative;\n @include font-size($sub-sup-font-size);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n// Links\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n\n &:hover {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([class]) {\n &,\n &:hover {\n color: inherit;\n text-decoration: none;\n }\n}\n\n\n// Code\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-code;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n direction: ltr #{\"/* rtl:ignore */\"};\n unicode-bidi: bidi-override;\n}\n\n// 1. Remove browser default top margin\n// 2. Reset browser default of `1em` to use `rem`s\n// 3. Don't allow content to break outside\n\npre {\n display: block;\n margin-top: 0; // 1\n margin-bottom: 1rem; // 2\n overflow: auto; // 3\n @include font-size($code-font-size);\n color: $pre-color;\n\n // Account for some code outputs that place code tags in pre tags\n code {\n @include font-size(inherit);\n color: inherit;\n word-break: normal;\n }\n}\n\ncode {\n @include font-size($code-font-size);\n color: $code-color;\n word-wrap: break-word;\n\n // Streamline the style when inside anchors to avoid broken underline and more\n a > & {\n color: inherit;\n }\n}\n\nkbd {\n padding: $kbd-padding-y $kbd-padding-x;\n @include font-size($kbd-font-size);\n color: $kbd-color;\n background-color: $kbd-bg;\n @include border-radius($border-radius-sm);\n\n kbd {\n padding: 0;\n @include font-size(1em);\n font-weight: $nested-kbd-font-weight;\n }\n}\n\n\n// Figures\n//\n// Apply a consistent margin strategy (matches our type styles).\n\nfigure {\n margin: 0 0 1rem;\n}\n\n\n// Images and content\n\nimg,\nsvg {\n vertical-align: middle;\n}\n\n\n// Tables\n//\n// Prevent double borders\n\ntable {\n caption-side: bottom;\n border-collapse: collapse;\n}\n\ncaption {\n padding-top: $table-cell-padding-y;\n padding-bottom: $table-cell-padding-y;\n color: $table-caption-color;\n text-align: left;\n}\n\n// 1. Removes font-weight bold by inheriting\n// 2. Matches default `