创建 ASP.NET MVC 电子表格应用程序的步骤

以下是在 ASP.NET MVC 中创建基于 Web 的电子表格应用程序的步骤。

1、在 Visual Studio 中创建一个新的ASP.NET Core Web 应用程序(模型-视图-控制器)。

2、从 NuGet安装Aspose.Cells.GridJs。

3、将以下代码插入到HomeController.cs 中。

public class HomeController : Controller    {        public IActionResult Index()        {            return RedirectToRoute("default",          new { controller = "GridJs2", action = "List" });        }        public IActionResult Privacy()        {            return Redirect("https://about.aspose.app/legal/privacy-policy");        }        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]        public IActionResult Error()        {            return View(new ErrorViewModel { RequestId = Activity.CurrentId  HttpContext.TraceIdentifier });        }    }

4、在Models文件夹中新建一个名为TestConfig.cs 的类,并添加以下代码(根据您的环境更改文件夹路径)。

public class TestConfig{    ////// the directory which contains workbook files    ///internal static String ListDir = @"D:tmpdelstoragewb";    ////// temp directory to store files    ///internal static String TempDir = @"D:tmpdelstoragewbtmp";}

5、在Models文件夹中创建一个名为LocalFileCache.cs的新类并添加以下代码。

/* Add the following namespaces as well.using Aspose.Cells.GridJs;using System.IO;*/public class LocalFileCache : GridCacheForStream{    ////// Implement this method to savecache

                                                        

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年7月23日
下一篇 2021年7月24日

相关推荐

发表回复

登录后才能评论