1金币
本帖最后由 tianshun2021 于 2022-10-27 21:14 编辑
- <html style="height:100%;font-size:14px;">
- <head>
- <meta name="spreadjs culture" content="zh-cn" />
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <script src="js/123.js" type="text/javascript"></script>
- <script src="js/gc.spread.sheets.all.15.1.1.min.js"></script>
- <script src="js/plugins/gc.spread.sheets.charts.15.1.1.min.js"></script>
- <script src="js/plugins/gc.spread.sheets.shapes.15.1.1.min.js" type="text/javascript"></script>
- <script src="js/plugins/gc.spread.sheets.print.15.1.1.min.js" type="text/javascript"></script>
- <script src="js/plugins/gc.spread.sheets.barcode.15.1.1.min.js" type="text/javascript"></script>
- <script src="js/plugins/gc.spread.sheets.pdf.15.1.1.min.js" type="text/javascript"></script>
- <script src="js/interop/gc.spread.excelio.15.1.1.min.js" type="text/javascript"></script>
- <script src="js/gc.spread.sheets.designer.resource.cn.15.1.1.min.js"></script>
- <script src="js/gc.spread.sheets.designer.all.15.1.1.min.js"></script>
- <link rel="stylesheet" type="text/css" href="css/gc.spread.sheets.15.1.1.css">
- <link rel="stylesheet" type="text/css" href="css/gc.spread.sheets.designer.15.1.1.min.css">
- <style>
- .sample-spreadsheets {
- height: 800px;
- }
- </style>
- </head>
- <body>
- <div class="sample-tutorial">
- <div id="designerHost"></div>
- <div id="ss" class="sample-spreadsheets"></div>
- </div>
- <script>
- window.onload = function () {
- // 初始化SpreadJS组件
- var spread = new GC.Spread.Sheets.Workbook(
- document.getElementById( "ss" ),
- { sheetCount: 1, tabEditable: false, newTabVisible: false }
- )
- spread.suspendPaint()
- spread.fromJSON(tt);
- spread.resumePaint()
- let sheet = spread.getSheetFromName("批量数据")
- let { colCount } = sheet.getUsedRange(GC.Spread.Sheets.UsedRangeType.axis)
- console.log(colCount);
- };
-
- </script>
- </body>
- </html>
复制代码
代码如上,在获取sheet有效列数的时候,返回的列数不对。总共23列,返回21列不知道是什么问题。excel的js文件我也上传了
|
最佳答案
查看完整内容
使用GC.Spread.Sheets.UsedRangeType.all 即可满足您的需求,您可以实际测试下。
有疑问可以继续跟帖交流。
|