Add sheet viewer on my angular project

93 views
Skip to first unread message

Nicolas Dumont

unread,
Nov 9, 2022, 7:21:40 AM11/9/22
to Luckysheet
Hello everyone,
I'm looking for a tool to display backend-saved excel files on my front-end angular application.
I believe this Luckysheet library is the answer to my needs.
Can someone help me with the integration?
I added the npm Luckysheet and LuckyExcel dependencies
I created a component for my application
But I'm blocked with the rest... How to start ??

I really appreciate any help you can provide.
Nico

Nicolas Dumont

unread,
Nov 9, 2022, 9:21:42 AM11/9/22
to Luckysheet
I imported the style like this:
@Component({
selector: 'excel-viewer',
templateUrl: 'excel-viewer.component.html',
styleUrls: [
'../../../../node_modules/luckysheet/dist/css/luckysheet.css',
'../../../../node_modules/luckysheet/dist/plugins/css/pluginsCss.css',
'../../../../node_modules/luckysheet/dist/plugins/plugins.css',
'../../../../node_modules/luckysheet/dist/assets/iconfont/iconfont.css'


],
...

Is there a better way to do this?


And also the script files like this:
import { luckysheet } from '../../../../node_modules/luckysheet/dist/luckysheet.umd.js'
import { luckysheetPlugin } from '../../../../node_modules/luckysheet/dist/plugins/js/plugin.js'
import { LuckyExcelCjs } from '../../../../node_modules/luckyexcel/dist/luckyexcel.cjs.js'
import { LuckyExcelEsm } from '../../../../node_modules/luckyexcel/dist/luckyexcel.esm.js'
import { LuckyExcel } from '../../../../node_modules/luckyexcel/dist/luckyexcel.umd.js'
(I do not know how to run the script instead of just importing them like this)


And now I have these errors:
ERROR in src/app/viewer/excel/excel-viewer.component.ts(82,20): error TS2339: Property 'luckysheet' does not exist on type 'Window'.
src/app/viewer/excel/excel-viewer.component.ts(84,20): error TS2339: Property 'luckysheet' does not exist on type 'Window'.
src/app/viewer/excel/excel-viewer.component.ts(96,27): error TS2339: Property 'selectedIndex' does not exist on type 'HTMLElement'.
src/app/viewer/excel/excel-viewer.component.ts(97,27): error TS2339: Property 'options' does not exist on type 'HTMLElement'.
src/app/viewer/excel/excel-viewer.component.ts(98,26): error TS2339: Property 'options' does not exist on type 'HTMLElement'.
src/app/viewer/excel/excel-viewer.component.ts(111,20): error TS2339: Property 'luckysheet' does not exist on type 'Window'.
src/app/viewer/excel/excel-viewer.component.ts(113,20): error TS2339: Property 'luckysheet' does not exist on type 'Window'.
src/app/viewer/excel/excel-viewer.component.ts(125,27): error TS2339: Property 'selectedIndex' does not exist on type 'HTMLElement'.
src/app/viewer/excel/excel-viewer.component.ts(126,27): error TS2339: Property 'options' does not exist on type 'HTMLElement'.
src/app/viewer/excel/excel-viewer.component.ts(140,18): error TS2339: Property 'src' does not exist on type 'HTMLElement'.


Can you help me?
Reply all
Reply to author
Forward
0 new messages