在GridWeb中呈现交互滚动条
Contents
[
Hide
]
可能的使用场景
Aspose.Cells for GridWeb可以在GridWeb工作表内渲染交互式滚动条控件。用户可以像在Microsoft Excel中一样与滚动条交互。为了创建交互式滚动条,您必须添加jQuery和jQuery UI库的链接,如下所示。
<head runat="server">
<link rel="stylesheet" href="/Scripts/jquery-ui.css">
<script src="/Scripts/jquery-2.1.1.js"></script>
<script src="/Scripts/jquery-ui.js"></script>
</head>
在GridWeb中渲染交互式滚动条
以下示例代码加载包含滚动条的示例Excel文件,如下截图所示。其他截图显示GridWeb如何渲染交互式滚动条,并显示滚动条值在单元格B3中。每当您滚动滚动条时,单元格B3的值会显示结果值。
示例代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestGridWeb.aspx.cs" Inherits="TestGridWeb" %>
<%@ Register TagPrefix="acw" Namespace="Aspose.Cells.GridWeb" Assembly="Aspose.Cells.GridWeb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link rel="stylesheet" href="/Scripts/jquery-ui.css">
<script src="/Scripts/jquery-2.1.1.js"></script>
<script src="/Scripts/jquery-ui.js"></script>
<title>Test GridWeb</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div>
<b>GridWeb Version:  </b>
<asp:Label ID="lblVersion" runat="server" Text="Label"></asp:Label>
<br />
</div>
<acw:GridWeb ID="GridWeb1" runat="server" XhtmlMode="True" Height="504px" Width="1119px">
</acw:GridWeb>
</div>
</form>
</body>
</html>
\--------------------------------------------
\--------------------------------------------
\--------------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using Aspose.Cells;
using Aspose.Cells.GridWeb.Data;
using Aspose.Cells.GridWeb;
using System.Globalization;
using System.Threading;
using System.Collections.Generic;
public partial class TestGridWeb : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false && this.GridWeb1.IsPostBack == false)
{
lblVersion.Text = GridWeb.GetVersion();
string fileName = "sampleRenderScrollbarInGridWeb.xlsx";
string filePath = Server.MapPath("~/ExcelFile/" + fileName);
GridWeb1.ImportExcelFile(filePath);
}
}
}