Angular Spreadsheet document editor's core component of the GroupDocs.Editor.UI library.
npm install @groupdocs/groupdocs.editor.angular.ui-spreadsheetgroupdocs.editor.angular.ui-core
groupdocs.editor.angular.ui-spreadsheet packages with the npm or yarn package managers:
bash
npm i @groupdocs/groupdocs.editor.angular.ui-core
npm i @groupdocs/groupdocs.editor.angular.ui-email
`
Or, with yarn:
`bash
yarn add @groupdocs/groupdocs.editor.angular.ui-core
yarn add @groupdocs/groupdocs.editor.angular.ui-email
`
$3
Once the package is installed, you need to integrate it into your Angular application. Here are the necessary steps:
#### 1. Modify the tailwind.config.js file
In your Angular project, add the following content paths to your tailwind.config.js file:
`javascript
content: [
"./src/*/.{html,ts}",
"node_modules/@groupdocs/groupdocs.editor.angular.ui-core///*.mjs",
"node_modules/@groupdocs/groupdocs.editor.angular.ui-spreadsheet///*.mjs",
]
`
This step is crucial to ensure that the Spreadsheet Document Editor operates correctly.
#### 2. Add SpreadsheetEditorModule to AppModule
In your Angular AppModule, make sure to import and add the SpreadsheetEditorModule as follows:
`javascript
SpreadsheetEditorModule.forRoot({rootUrl: environment.apiUrl})
`
This configuration connects the Spreadsheet Document Editor to your application and provides the necessary settings.
#### 3. Configure the Router
Include a route in your Angular router to navigate to the Spreadsheet. This step is crucial for enabling
document editing.
`javascript
{
path: 'spreadsheet/:folderName/:page/:pages', component
:
SpreadsheetComponent
}
`
Using the Spreadsheet Document Editor
Now that you've configured the component, you can start using it to edit Word documents. Here's a brief example of how
to upload a file and navigate to the SpreadsheetComponent:
`javascript
upload()
{
if (this.file) {
const observer = {
next: (data: SpreadsheetStorageInfo) => {
if (data) {
this.documentCode = data.documentCode;
this.showLoading = false;
this.allowAccept = true;
}
},
error: (error: any) => {
console.error(error)
},
};
this.spreadsheetHttpService.uploadPost$Json({
body: {
File: this.file,
"LoadOptions.Password": ''
}
}).subscribe(observer);
} else {
alert("Please select a file first");
}
}
goToLink()
:
void {
let url = spreadsheet/${this.documentCode}/${this.currentPage}/${this.totalPages};
window.open(url, '_blank');
}
``