Làm cách nào để đọc dữ liệu từ tệp Excel trong góc?

Tôi muốn đọc Dữ liệu Excel có định dạng bên dưới. Dữ liệu thực tế sẽ bắt đầu từ hàng số 7, hàng số 6 sẽ có tiêu đề. Tôi muốn bắt đầu đọc dữ liệu từ hàng 7

SL. STT Tên nhân viên Ngày làm việc Thời gian bắt đầu Thời gian kết thúc Số giờ làm việc
1 AAAA 21-01-2021 10. 00 16. 00 6
2 BBBB 21-01-2021 11. 00 16. 00 5
. . . .
1000 XXXX 21-01-2021 08. 00 17. 00 9

Những gì tôi đã thử


Thêm giải pháp của bạn ở đây

 B   I   U   S  small BIG code var  <   >   &  link [^] encode untab case indent outdent

Xem trước 0

thành viên hiện có

hoặc tham gia với chúng tôi

Tải xuống, Bình chọn, Nhận xét, Xuất bản

Email của bạn

Email này đang được sử dụng. Bạn có cần mật khẩu của bạn?

Mật khẩu tùy chọn

Khi trả lời một câu hỏi xin vui lòng

  1. Đọc kỹ câu hỏi
  2. Hiểu rằng tiếng Anh không phải là ngôn ngữ đầu tiên của mọi người, vì vậy hãy khoan dung với lỗi chính tả và ngữ pháp
  3. Nếu một câu hỏi được diễn đạt kém thì hãy yêu cầu làm rõ, bỏ qua nó hoặc chỉnh sửa câu hỏi và khắc phục sự cố. Xúc phạm không được chào đón
  4. Đừng bảo ai đó đọc hướng dẫn. Rất có thể họ có và không nhận được. Đưa ra câu trả lời hoặc chuyển sang câu hỏi tiếp theo
Hãy làm việc để giúp các nhà phát triển, không làm họ cảm thấy ngu ngốc


Nội dung này, cùng với bất kỳ tệp và mã nguồn liên quan nào, được cấp phép theo Giấy phép Mở Dự án Code (CPOL)

Khi nhập tệp excel, nó cần được đọc và chuyển đổi sang mô hình Bảng tính phía máy khách. Mô hình Bảng tính phía máy khách đã chuyển đổi được gửi dưới dạng JSON được sử dụng để hiển thị Bảng tính. Tương tự, khi bạn lưu Bảng tính, mô hình Bảng tính của máy khách sẽ được gửi đến máy chủ dưới dạng JSON để xử lý và lưu lại. Cấu hình máy chủ được sử dụng cho quá trình này

Mở ra

Điều khiển Bảng tính sẽ mở một tài liệu Excel với dữ liệu, kiểu, định dạng của nó, v.v. Để bật tính năng này, hãy đặt thành

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
8 và chỉ định url dịch vụ cho thuộc tính

Giao diện người dùng

Trong giao diện người dùng, bạn có thể mở một tài liệu Excel bằng cách nhấp vào mục menu

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
0 trong dải băng

Mẫu sau đây hiển thị tùy chọn

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
1 bằng cách sử dụng thuộc tính trong điều khiển Bảng tính. Bạn cũng có thể sử dụng sự kiện để kích hoạt trước khi mở tệp Excel

  • ứng dụng. thành phần. ts
  • ứng dụng. mô-đun. ts
  • chủ yếu. ts

import { Component } from '@angular/core';
import { SpreadsheetComponent, BeforeSaveEventArgs } from '@syncfusion/ej2-angular-spreadsheet';

@Component({
    selector: 'app-container',
    template: " "
})
export class AppComponent {
     beforeOpen (args: BeforeOpenEventArgs) {
        // your code snippets here
    }
}

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Xem trước mẫu

Vui lòng tìm bảng bên dưới cho các đối số sự kiện beforeOpen

Tham sốType Mô tả tệp FileList hoặc chuỗi hoặc Tệp Để nhận luồng tệp.
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
4 - chứa độ dài và chỉ mục mục
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
5 - chỉ định tệp được sửa đổi lần cuối và tên tệp. cancelbooleanĐể ngăn thao tác mở. requestDataobjectĐể cung cấp dữ liệu Biểu mẫu
  • Sử dụng phím tắt
    import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
    import { enableProdMode } from '@angular/core';
    import { AppModule } from './app.module';
    
    enableProdMode();
    platformBrowserDynamic().bootstrapModule(AppModule);
    6 để mở tài liệu Excel
  • Giá trị mặc định của thuộc tính là
    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
    import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
    import { AppComponent } from './app.component';
    
    /**
     * Module
     */
    @NgModule({
        imports: [
            BrowserModule,
            DropDownButtonModule,
            SpreadsheetAllModule
        ],
        declarations: [AppComponent],
        bootstrap: [AppComponent]
    })
    export class AppModule { }
    8. Đối với mục đích trình diễn, chúng tôi đã giới thiệu thuộc tính trong đoạn mã trước đó

Mở tệp excel URL bên ngoài trong khi tải lần đầu

Bạn có thể đạt được để truy cập tệp excel từ xa bằng cách sử dụng sự kiện. Trong trường hợp này, bạn có thể tìm nạp tệp excel và chuyển đổi nó thành blob. Chuyển đổi đốm màu này thành một tệp và tệp này bằng cách sử dụng phương pháp mở thành phần Bảng tính

  • ứng dụng. thành phần. ts
  • ứng dụng. mô-đun. ts
  • chủ yếu. ts

import { Component, ViewChild } from '@angular/core';
import { SpreadsheetComponent } from '@syncfusion/ej2-angular-spreadsheet';

@Component({
    selector: 'app-container',
    template: " "
})
export class AppComponent {
    @ViewChild('spreadsheet') public spreadsheetObj: SpreadsheetComponent;
     created () {
        fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url
          .then((response) => {
            response.blob().then((fileBlob) => { // convert the excel file to blob
            let file = new File([fileBlob], "Sample.xlsx"); //convert the blob into file
            this.spreadsheetObj.open({ file: file }); // open the file into Spreadsheet
            })
          })
    }
}

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Xem trước mẫu

Tiết kiệm

Điều khiển Bảng tính lưu dữ liệu, kiểu, định dạng và hơn thế nữa dưới dạng tài liệu tệp Excel. Để bật tính năng này, hãy đặt thành

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
8 và chỉ định url dịch vụ cho thuộc tính

Giao diện người dùng

Trong giao diện người dùng, bạn có thể lưu dữ liệu Bảng tính dưới dạng tài liệu Excel bằng cách nhấp vào mục menu

import { Component, ViewChild } from '@angular/core';
import { SpreadsheetComponent } from '@syncfusion/ej2-angular-spreadsheet';

@Component({
    selector: 'app-container',
    template: " "
})
export class AppComponent {
    @ViewChild('spreadsheet') public spreadsheetObj: SpreadsheetComponent;
     created () {
        fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url
          .then((response) => {
            response.blob().then((fileBlob) => { // convert the excel file to blob
            let file = new File([fileBlob], "Sample.xlsx"); //convert the blob into file
            this.spreadsheetObj.open({ file: file }); // open the file into Spreadsheet
            })
          })
    }
}
3 trong dải băng

Mẫu sau đây hiển thị tùy chọn

import { Component, ViewChild } from '@angular/core';
import { SpreadsheetComponent } from '@syncfusion/ej2-angular-spreadsheet';

@Component({
    selector: 'app-container',
    template: " "
})
export class AppComponent {
    @ViewChild('spreadsheet') public spreadsheetObj: SpreadsheetComponent;
     created () {
        fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url
          .then((response) => {
            response.blob().then((fileBlob) => { // convert the excel file to blob
            let file = new File([fileBlob], "Sample.xlsx"); //convert the blob into file
            this.spreadsheetObj.open({ file: file }); // open the file into Spreadsheet
            })
          })
    }
}
4 bằng cách sử dụng thuộc tính trong điều khiển Bảng tính. Bạn cũng có thể sử dụng sự kiện để kích hoạt trước khi lưu Bảng tính dưới dạng tệp Excel

  • ứng dụng. thành phần. ts
  • ứng dụng. mô-đun. ts
  • chủ yếu. ts

import { Component } from '@angular/core';
import { SpreadsheetComponent, BeforeSaveEventArgs } from '@syncfusion/ej2-angular-spreadsheet';

@Component({
    selector: 'app-container',
    template: " "
})
export class AppComponent {
     beforeSave (args: BeforeSaveEventArgs) {
        // your code snippets here
    }
 }

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Xem trước mẫu

Vui lòng tìm bảng bên dưới để biết các đối số sự kiện beforeSave

ParameterTypeDescriptionurlstringChỉ định url lưu. fileNamestringChỉ định tên tệp. saveTypeSaveTypeChỉ định saveType như Xlsx, Xls, Csv và Pdf. customParamsobjectTruyền tham số tùy chỉnh từ máy khách đến máy chủ trong khi thực hiện thao tác lưu. isFullPostbooleanNó gửi dữ liệu biểu mẫu từ máy khách đến máy chủ, khi được đặt thành đúng. Nó tìm nạp dữ liệu từ máy khách đến máy chủ và trả lại dữ liệu từ máy chủ đến máy khách, khi được đặt thành false. NeedBlobDatabooleanBạn có thể lấy dữ liệu blob nếu được đặt thành true. cancelbooleanĐể ngăn các thao tác lưu
  • Sử dụng phím tắt
    import { Component, ViewChild } from '@angular/core';
    import { SpreadsheetComponent } from '@syncfusion/ej2-angular-spreadsheet';
    
    @Component({
        selector: 'app-container',
        template: " "
    })
    export class AppComponent {
        @ViewChild('spreadsheet') public spreadsheetObj: SpreadsheetComponent;
         created () {
            fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url
              .then((response) => {
                response.blob().then((fileBlob) => { // convert the excel file to blob
                let file = new File([fileBlob], "Sample.xlsx"); //convert the blob into file
                this.spreadsheetObj.open({ file: file }); // open the file into Spreadsheet
                })
              })
        }
    }
    7 để lưu dữ liệu Bảng tính dưới dạng tệp Excel
  • Giá trị mặc định của thuộc tính là
    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
    import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
    import { AppComponent } from './app.component';
    
    /**
     * Module
     */
    @NgModule({
        imports: [
            BrowserModule,
            DropDownButtonModule,
            SpreadsheetAllModule
        ],
        declarations: [AppComponent],
        bootstrap: [AppComponent]
    })
    export class AppModule { }
    8. Đối với mục đích trình diễn, chúng tôi đã giới thiệu thuộc tính trong đoạn mã trước đó
  • Chỉ nhằm mục đích demo, chúng tôi đã sử dụng liên kết url dịch vụ web trực tuyến

Để gửi và nhận thông số tùy chỉnh từ máy khách đến máy chủ

Truyền tham số tùy chỉnh từ máy khách sang máy chủ bằng cách sử dụng sự kiện

  • ứng dụng. thành phần. ts
  • ứng dụng. mô-đun. ts
  • chủ yếu. ts

import { Component } from '@angular/core';
import { SpreadsheetComponent, BeforeSaveEventArgs } from '@syncfusion/ej2-angular-spreadsheet';
import { data } from './datasource';

@Component({
    selector: 'app-container',
    template: "    "
})
export class AppComponent implements OnInit {
    public data: object[];
    ngOnInit(): void {
        this.data = data;
    }
    beforeSave (args: BeforeSaveEventArgs) {
        args.customParams = { customParams: 'you can pass custom params in server side'}; // you can pass the custom params
    }
 }

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Xem trước mẫu

Đoạn mã phía máy chủ

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
2

phương pháp

Để lưu tài liệu Bảng tính dưới dạng tệp

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
0, bằng cách sử dụng phương thức nên được gọi với các tham số
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
1,
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
2 và
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
3. Ví dụ mã sau đây hiển thị để lưu tệp bảng tính dưới dạng
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
0 trong sự kiện nhấp vào nút

  • ứng dụng. thành phần. ts
  • ứng dụng. mô-đun. ts
  • chủ yếu. ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
3

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Xem trước mẫu

Cấu hình máy chủ

Trong Kiểm soát bảng tính, hỗ trợ nhập và xuất Excel được xử lý trong

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
5, để sử dụng nhập và xuất trong các dự án của bạn, bạn cần phải tạo một máy chủ với bất kỳ dịch vụ web nào sau đây

  • WebAPI
  • Dịch vụ WCF
  • ASP. Hành động của bộ điều khiển NET MVC

Đoạn mã sau hiển thị cấu hình máy chủ sử dụng dịch vụ

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
6,

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
6

Phụ thuộc máy chủ

Các chức năng của trình trợ giúp mở và lưu được vận chuyển trong Syncfusion. EJ2. Gói bảng tính, có sẵn trong Essential Studio và

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DropDownButtonModule } from '@syncfusion/ej2-angular-splitbuttons';
import { SpreadsheetAllModule } from '@syncfusion/ej2-angular-spreadsheet';
import { AppComponent } from './app.component';

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        DropDownButtonModule,
        SpreadsheetAllModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
7. Dưới đây là danh sách các phụ thuộc cần thiết cho các thao tác mở và lưu Bảng tính

  • đồng bộ hóa. EJ2
  • đồng bộ hóa. EJ2. bảng tính
  • đồng bộ hóa. Nén. Cơ sở
  • đồng bộ hóa. XlsIO. Cơ sở

Và cũng tham khảo thêm thông tin

Định dạng tệp được hỗ trợ

Danh sách các định dạng tệp Excel sau đây được hỗ trợ trong Bảng tính

  • MS Excel (. xlsx)
  • Excel 97-2003 (. xls)
  • Giá trị được phân tách bằng dấu phẩy (. csv)

Ghi chú

Bạn có thể tham khảo trang tham quan tính năng Bảng tính góc của chúng tôi để biết các biểu diễn tính năng đột phá của nó. Bạn cũng có thể khám phá của chúng tôi để biết cách trình bày và thao tác dữ liệu

Làm cách nào để nhập dữ liệu Excel vào Lưới góc?

. . sách bài tập. Tên trang tính. forEach((function(sheetName) {
// Đây là đối tượng của bạn. var XL_row_object = XLSX. đồ dùng. sheet_to_json(sổ làm việc. Trang tính [tên trang tính]);
var json_object = JSON. stringify(XL_row_object); . nhật ký (json_object)
cái này. lướiObj. nguồn dữ liệu = JSON. phân tích cú pháp (json_object);.
}). ràng buộc (cái này), cái này);.

SQL có thể lấy dữ liệu từ Excel không?

Nhập dữ liệu trực tiếp từ các tệp Excel bằng cách sử dụng Trình hướng dẫn Nhập và Xuất SQL Server . Bạn cũng có tùy chọn lưu cài đặt dưới dạng gói Dịch vụ tích hợp máy chủ SQL (SSIS) mà bạn có thể tùy chỉnh và sử dụng lại sau này. Trong SQL Server Management Studio, hãy kết nối với một phiên bản của Công cụ cơ sở dữ liệu máy chủ SQL.

Làm cách nào để đọc tệp Excel JavaScript?

Cách nhập và xuất Excel XLSX bằng JavaScript .
Thiết lập dự án bảng tính JavaScript
Thêm mã nhập Excel
Thêm dữ liệu vào tệp Excel đã nhập
Thêm một biểu đồ thu nhỏ
Thêm mã xuất Excel

Làm cách nào để tạo tệp Excel trong góc?

Cài đặt thành phần SpreadJS trong ứng dụng của bạn
Khởi tạo một thành phần SpreadJS
Tạo một phần tử đầu vào chấp nhận tệp XLSX
Thêm mã nhập khẩu
Thêm mã xuất khẩu