Features

Server Load

Server Load

FlexSheet allows you to load an xlsx file or a Workbook instance on the server side.

Features

Server Load

FlexSheet allows you to load an xlsx file or a Workbook instance on the server side.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FlexSheetExplorer.Models;

namespace FlexSheetExplorer.Controllers
{
    public partial class FlexSheetController : Controller
    {
        public ActionResult ServerLoad(string loadType)
        {
            ViewBag.loadTypes = new string[] { "Xlsx", "Workbook" };
            object model;

            if (loadType == "Workbook")
            {
                model = WorkbookOM.GetWorkbook();
            }
            else
            {
                loadType = "Xlsx";
                model = "~/Content/xlsxFile/example1.xlsx";
            }
            ViewBag.LoadType = loadType;

            return View(model);
        }
    }
}
<div>
    <div class="copy">
        <h3>
            @Html.Raw(Resources.FlexSheet.ServerLoad_Text3)
        </h3>
        <p>
            @Html.Raw(Resources.FlexSheet.ServerLoad_Text2)
        </p>
        <p>
            @using (Html.BeginForm())
            {
                @(Html.C1().ComboBox().Name("loadType").Bind((string[])ViewBag.loadTypes)
                    .SelectedValue((String)ViewBag.LoadType))
                <button type="submit" class="btn btn-default">@Html.Raw(Resources.FlexSheet.ServerLoad_Text4)</button>
            }
        </p>
    </div>
    <div>
        @(Html.C1().FlexSheet().CssClass("flexSheet").Load(Model))
    </div>
</div>
@section Summary{
    <p>
       @Html.Raw(Resources.FlexSheet.ServerLoad_Text0)
    </p>
}