首页 > 解决方案 > How can I paste Excel and MS Word table and edit it on website in Angular

问题描述

Here is what I am trying to achieve:

A user can copy table from Excel/MS-Word and then paste it to my angular website which he/she can then save it to server as well.

How Can I achieve this? Any suggestions will be appreciated.

标签: htmlexcelangulartabular

解决方案


我正在使用ngx-editor因为它很容易实现并且它的 UI 更好

通过 npm 安装

npm install ngx-editor --save

导入ngx-editor模块

import { NgxEditorModule } from 'ngx-editor';
 
@NgModule({
  imports: [ NgxEditorModule ]
})

然后在html中

<app-ngx-editor [placeholder]="'Enter text here...'" [spellcheck]="true" [(ngModel)]="htmlContent"></app-ngx-editor>

默认情况下,它的高度未正确设置,但您可以像这样设置 min-heightminHeight="250px"

如果您遇到错误,请确保您已FormsModule 作为模块导入

确保HttpClientModule也安装并导入


推荐阅读