コード例 #1
0
        internal async void LoadExcel(StorageFile file)
        {
            tabcontrol.Items.Clear();
            Gridcollection.Clear();
            var       engine = new ExcelEngine();
            IWorkbook book   = await engine.Excel.Workbooks.OpenAsync(file);

            for (int i = 0; i < book.Worksheets.Count; i++)
            {
                SfCellGrid cellgrid = new SfCellGrid();
                cellgrid.RowCount                  = 1000;
                cellgrid.ColumnCount               = 1000;
                cellgrid.DefaultColumnWidth        = 64;
                cellgrid.DefaultRowHeight          = 20;
                cellgrid.Model.TableStyle.CellType = "FormulaCell";
                ExcelImportExtension.ImportFromExcel(cellgrid, book.Worksheets[i], null);
                cellgrid.RowCount    = cellgrid.RowCount < 100 ? 100 : cellgrid.RowCount;
                cellgrid.ColumnCount = cellgrid.ColumnCount < 100 ? 100 : cellgrid.ColumnCount;
                SfTabItem item = new SfTabItem();
                item.Content    = cellgrid;
                item.Header     = book.Worksheets[i].Name;
                item.Foreground = new SolidColorBrush(Colors.Black);
                item.FontSize   = 16;
                item.Height     = 40;
                tabcontrol.Items.Add(item);
                Gridcollection.Add(cellgrid);
            }
            tabcontrol.SelectedIndex = 0;
        }
コード例 #2
0
ファイル: Formula.xaml.cs プロジェクト: WangHengXu/uwp-demos
 private void LoadExcel(IWorkbook book)
 {
     ExcelImportExtension.ImportFromExcel(cellgrid, book.ActiveSheet, null);
     cellgrid.RowCount    = cellgrid.RowCount < 100 ? 100 : cellgrid.RowCount;
     cellgrid.ColumnCount = cellgrid.ColumnCount < 100 ? 100 : cellgrid.ColumnCount;
 }