Take advantage of GrapeCity Documents for Excel and work with Excel documents with full feature support on Azure. Here are the steps needed to create a basic Documents for Excel web app and deploy it to Azure.
In Visual Studio, go to File > New > Project, and select ASP.NET Core Web Application
In the wizard that opens, select .NET Core – ASP.NET Core 2.0 – Web Application (Model-View-Controller) then click OK.
Go to Dependencies > Manage NuGet Packages, and install the GrapeCity.Documents.Excel package.
Clean up the Index.cshtml page (under Views\Home), so that it contains just this (this step is optional, as our controller will send XLSX content for this page):
Index.cshtml
@{
ViewData["Title"] = "Home Page";
}
<div class="row">
</div>
Modify HomeController.cs (under Controllers) to generate the 'Hello, World!' Excel document.
And the following usings:
using System.IO;
using GrapeCity.Documents.Excel;
Modify the Index() method like so:
public IActionResult Index()
{
// Create the 'Hello, World!' Excel document:
var workbook = new Workbook();
var worksheet = workbook.ActiveSheet;
worksheet.Range["B2"].Value = "Hello, World!";
// Save it to a memory stream:
MemoryStream ms = new MemoryStream();
workbook.Save(ms, SaveFileFormat.Xlsx);
ms.Seek(0, SeekOrigin.Begin);
// Send it back to the web page:
Response.Headers["Content-Disposition"] = "inline; filename=\"HelloWorld.xlsx\"";
return new FileStreamResult(ms, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
}
From Visual Studio, run your app locally to make sure everything works. You should see the "Hello, World!" PDF opening in your default web browser.
Go to to Build > Publish, create a new 'Microsoft Azure App Service' publish profile, select appropriate name, subscription details etc. The defaults should work just fine.