製品版のみの機能
スプレッドシート - 概要
igSpreadsheet コントロールでは、Infragistics JavaScript Excel Library でサポートされるデータ モデルによって表されるスプレッドシート データの表示ができます。データ モデルには、ワークブック、ワークシート、セル、数式などが含まれます。
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
コード ビュー
クリップボードへコピー
if ($("#spreadsheet1").length !== 0) { $("#spreadsheet1").igSpreadsheet({ height: "600", width: "100%", activeWorksheetChanged: function (evt, ui) { if (ui.newActiveWorksheetName == "Statistics") { $("#spreadsheet1").igSpreadsheet("option", "activeCell", "E7"); } else { $("#spreadsheet1").igSpreadsheet("option", "activeCell", "J15"); } } }); var workbook = null; var xhr = new XMLHttpRequest(); xhr.open('GET', '../../data-files/statistic.xlsx', true); xhr.responseType = 'arraybuffer'; xhr.onload = function (e) { // response is unsigned 8 bit integer var responseArray = new Uint8Array(this.response); $.ig.excel.Workbook.load(responseArray, function () { workbook = arguments[0]; setInitialSettings(); }, function () { console.log("fail"); }) }; xhr.send(); function setInitialSettings() { $("#spreadsheet1").igSpreadsheet("option", "workbook", workbook); var ws = workbook.worksheets("Table data"); $("#spreadsheet1").igSpreadsheet("option", "activeWorksheet", ws); $("#spreadsheet1").igSpreadsheet("option", "activeCell", "J15"); $("#spreadsheet1").igSpreadsheet("option", "zoomLevel", "95"); } }
<div id="spreadsheet1"></div>
.ui-igspreadsheet .ui-menu-item { white-space: nowrap; }
<!DOCTYPE html> <html> <head> <title>igSpreadsheet Overview</title> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.excel-bundled.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.spreadsheet-bundled.js"></script> <style> .ui-igspreadsheet .ui-menu-item { white-space: nowrap; } </style> </head> <body> <div id="spreadsheet1"></div> <script type="text/javascript"> $( function () { if ($("#spreadsheet1").length !== 0) { $("#spreadsheet1").igSpreadsheet({ height: "600", width: "100%", activeWorksheetChanged: function (evt, ui) { if (ui.newActiveWorksheetName == "Statistics") { $("#spreadsheet1").igSpreadsheet("option", "activeCell", "E7"); } else { $("#spreadsheet1").igSpreadsheet("option", "activeCell", "J15"); } } }); var workbook = null; var xhr = new XMLHttpRequest(); xhr.open('GET', '/data-files/statistic.xlsx', true); xhr.responseType = 'arraybuffer'; xhr.onload = function (e) { // response is unsigned 8 bit integer var responseArray = new Uint8Array(this.response); $.ig.excel.Workbook.load(responseArray, function () { workbook = arguments[0]; setInitialSettings(); }, function () { console.log("fail"); }) }; xhr.send(); function setInitialSettings() { $("#spreadsheet1").igSpreadsheet("option", "workbook", workbook); var ws = workbook.worksheets("Table data"); $("#spreadsheet1").igSpreadsheet("option", "activeWorksheet", ws); $("#spreadsheet1").igSpreadsheet("option", "activeCell", "J15"); $("#spreadsheet1").igSpreadsheet("option", "zoomLevel", "95"); } } }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="/igniteui/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="/igniteui/css/structure/infragistics.css" rel="stylesheet" /> <link href="/igniteui/css/structure/modules/infragistics.ui.spreadsheet.css" rel="stylesheet" /> <!-- 1. Load libraries --> <script src="/js/modernizr.min.js"></script> <script src="/js/jquery.min.js"></script> <script src="/js/jquery-ui.min.js"></script> <!-- ReactJS library --> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script> <!-- Ignite UI for jQuery Required Combined JavaScript Files --> <script src="/igniteui/js/infragistics.core.js"></script> <script src="/igniteui/js/infragistics.lob.js"></script> <script src="/igniteui/js/infragistics.excel-bundled.js"></script> <script src="/igniteui/js/infragistics.spreadsheet-bundled.js"></script> <!-- Ignite UI for jQuery ReactJS Files --> <script src="https://unpkg.com/igniteui-react@1.2.0/igniteui-react.js"></script> <script src="https://unpkg.com/igniteui-react@1.2.0/ui/igSpreadsheet.js"></script> </head> <body> <div id="app"> <script type="text/babel"> var App= React.createClass({ render: function() { var spreadsheet = { width: "75%", height: "600" }; return ( <IgSpreadsheet id="spreadsheet" width={spreadsheet.width} height={spreadsheet.height} /> ) } }); ReactDOM.render( <App />, document.getElementById("app") ); fetch('/data-files/statistic.xlsx', { method: 'GET' }) .then((response) => response.arrayBuffer()) .then((response) => { $.ig.excel.Workbook.load(new Uint8Array(response), function () { var workbook = arguments[0]; $("#spreadsheet").igSpreadsheet("option", "workbook", workbook); }, function () { console.log("fail"); }) }) </script> </div> </body> </html>