Skip to content

Commit cc5c834

Browse files
Merge pull request #1 from Sridhar-Karunakaran/master
Updating the samples for exporting customization
2 parents 07e3d69 + 0661abb commit cc5c834

File tree

84 files changed

+5862
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+5862
-2
lines changed

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
# export-angular-pivot-table-to-pdf-document-with-advanced-customization
2-
Export angular pivot-table to pdf document with advanced customization
1+
# Export-angular-pivot-table-to-pdf-document-with-advanced-customization
2+
This Angular project shows you how to export pivot table as PDF document with advanced customization.
3+
4+
# Project pre-requisites
5+
Make sure that you have the latest versions of NodeJS and Visual Studio Code in your machine before starting to work on this project.
6+
7+
8+
### How to run this samples?
9+
10+
open this sample in Visual Studio Code. Then, simply install all the necessary angular packages into your current project using the `npm install` command and run your project using the `ng serve` command.

angular.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"my-app": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/my-app",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
"src/favicon.ico",
25+
"src/assets"
26+
],
27+
"styles": [
28+
"src/styles.css"
29+
],
30+
"scripts": []
31+
},
32+
"configurations": {
33+
"production": {
34+
"budgets": [
35+
{
36+
"type": "initial",
37+
"maximumWarning": "500kb",
38+
"maximumError": "1mb"
39+
},
40+
{
41+
"type": "anyComponentStyle",
42+
"maximumWarning": "2kb",
43+
"maximumError": "4kb"
44+
}
45+
],
46+
"outputHashing": "all"
47+
},
48+
"development": {
49+
"buildOptimizer": false,
50+
"optimization": false,
51+
"vendorChunk": true,
52+
"extractLicenses": false,
53+
"sourceMap": true,
54+
"namedChunks": true
55+
}
56+
},
57+
"defaultConfiguration": "production"
58+
},
59+
"serve": {
60+
"builder": "@angular-devkit/build-angular:dev-server",
61+
"configurations": {
62+
"production": {
63+
"browserTarget": "my-app:build:production"
64+
},
65+
"development": {
66+
"browserTarget": "my-app:build:development"
67+
}
68+
},
69+
"defaultConfiguration": "development"
70+
},
71+
"extract-i18n": {
72+
"builder": "@angular-devkit/build-angular:extract-i18n",
73+
"options": {
74+
"browserTarget": "my-app:build"
75+
}
76+
},
77+
"test": {
78+
"builder": "@angular-devkit/build-angular:karma",
79+
"options": {
80+
"polyfills": [
81+
"zone.js",
82+
"zone.js/testing"
83+
],
84+
"tsConfig": "tsconfig.spec.json",
85+
"assets": [
86+
"src/favicon.ico",
87+
"src/assets"
88+
],
89+
"styles": [
90+
"src/styles.css"
91+
],
92+
"scripts": []
93+
}
94+
}
95+
}
96+
}
97+
},
98+
"cli": {
99+
"analytics": "320c5406-bac1-4c09-8b25-ac75fd0ed1db"
100+
}
101+
}

package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "my-app",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^15.1.0",
14+
"@angular/common": "^15.1.0",
15+
"@angular/compiler": "^15.1.0",
16+
"@angular/core": "^15.1.0",
17+
"@angular/forms": "^15.1.0",
18+
"@angular/platform-browser": "^15.1.0",
19+
"@angular/platform-browser-dynamic": "^15.1.0",
20+
"@angular/router": "^15.1.0",
21+
"@syncfusion/ej2-angular-pivotview": "*",
22+
"@syncfusion/ej2-grids": "*",
23+
"@syncfusion/ej2-buttons": "*",
24+
"@syncfusion/ej2-base": "*",
25+
"rxjs": "~7.8.0",
26+
"tslib": "^2.3.0",
27+
"zone.js": "~0.12.0",
28+
"@syncfusion/ej2-pivotview": "*"
29+
},
30+
"devDependencies": {
31+
"@angular-devkit/build-angular": "^15.1.3",
32+
"@angular/cli": "~15.1.3",
33+
"@angular/compiler-cli": "^15.1.0",
34+
"@types/jasmine": "~4.3.0",
35+
"jasmine-core": "~4.5.0",
36+
"karma": "~6.4.0",
37+
"karma-chrome-launcher": "~3.1.0",
38+
"karma-coverage": "~2.2.0",
39+
"karma-jasmine": "~5.1.0",
40+
"karma-jasmine-html-reporter": "~2.0.0",
41+
"typescript": "~4.9.4"
42+
}
43+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/* csslint ignore:start */
2+
#PivotViewFieldList {
3+
float: left;
4+
width: 58% !important;
5+
height: 100%;
6+
}
7+
8+
#PivotFieldList {
9+
float: right;
10+
width: 42%;
11+
height: 100%;
12+
}
13+
14+
#PivotFieldList .e-static {
15+
width: 100% !important;
16+
}
17+
/* csslint ignore:end */
18+
19+
20+
.e-pivotview .e-columnsheader .tempwrap {
21+
display: none;
22+
}
23+
.e-pivotview .e-rowsheader .tempwrap {
24+
display: none;
25+
}
26+
27+
/* csslint ignore:start */
28+
@font-face {
29+
font-family: 'e-pivot';
30+
src:
31+
url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMjhUSmAAAAEoAAAAVmNtYXCs3q0zAAABkAAAAEpnbHlmdaItOwAAAegAAAE0aGVhZBRYEz0AAADQAAAANmhoZWEHmQNtAAAArAAAACRobXR4D7gAAAAAAYAAAAAQbG9jYQDAAHIAAAHcAAAACm1heHABDwBBAAABCAAAACBuYW1lc0cOBgAAAxwAAAIlcG9zdK9TctUAAAVEAAAARwABAAADUv9qAFoEAAAA//4D6gABAAAAAAAAAAAAAAAAAAAABAABAAAAAQAAT8kba18PPPUACwPoAAAAANin5zgAAAAA2KfnOAAAAAAD6gPoAAAACAACAAAAAAAAAAEAAAAEADUAAQAAAAAAAgAAAAoACgAAAP8AAAAAAAAAAQPuAZAABQAAAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUGZFZABA4jToTQNS/2oAWgPoAJYAAAABAAAAAAAABAAAAAPoAAAD6AAAA+gAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQANgAAAAgACAACAADiNOI56E3//wAA4jTiOehN//8AAAAAAAAAAQAIAAgACA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IABTAHQAdQBkAGkAbwB3AHcAdwAuAHMAeQBuAGMAZgB1AHMAaQBvAG4ALgBjAG8AbQAAAAACAAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQBAgEDAQQBBQADVXAxC2Fycm93LXJpZ2h0CURvd25fU29ydAAAAA==) format('truetype');
32+
font-weight: normal;
33+
font-style: normal;
34+
}
35+
36+
.e-pivotview .e-tool-expand::before {
37+
content: '\e702';
38+
}
39+
40+
.fileUpload {
41+
position: relative;
42+
overflow: hidden;
43+
margin: 10px;
44+
}
45+
46+
.fileUpload input.upload {
47+
position: absolute;
48+
top: 0;
49+
right: 0;
50+
margin: 0;
51+
padding: 0;
52+
font-size: 20px;
53+
cursor: pointer;
54+
opacity: 0;
55+
filter: alpha(opacity=0);
56+
}
57+
58+
/* csslint ignore:end */
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h4>Add header and footer</h4>
2+
<div class="col-md-2"><button ej-button id='export'>Export</button></div>
3+
<div class="col-md-8">
4+
<ejs-pivotview #pivotview id='PivotView' height='350' [dataSourceSettings]=dataSourceSettings allowPdfExport='true'
5+
width=width></ejs-pivotview>
6+
</div>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { AddHeaderAndFooterComponent } from './add-header-and-footer.component';
4+
5+
describe('AddHeaderAndFooterComponent', () => {
6+
let component: AddHeaderAndFooterComponent;
7+
let fixture: ComponentFixture<AddHeaderAndFooterComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ AddHeaderAndFooterComponent ]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(AddHeaderAndFooterComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { Component, OnInit, ViewChild } from '@angular/core';
2+
import { IDataOptions, IDataSet, PivotView } from '@syncfusion/ej2-angular-pivotview';
3+
import { Button } from '@syncfusion/ej2-buttons';
4+
import { PdfExportProperties } from '@syncfusion/ej2-grids';
5+
import { pivot_Data } from '../data';
6+
7+
@Component({
8+
selector: 'app-container',
9+
templateUrl: `./add-header-and-footer.component.html`
10+
})
11+
export class AddHeaderAndFooterComponent implements OnInit {
12+
public width: string;
13+
public dataSourceSettings: IDataOptions;
14+
public button: Button;
15+
public pdfExportProperties: PdfExportProperties;
16+
17+
@ViewChild('pivotview', {static: false})
18+
public pivotGridObj: PivotView;
19+
20+
ngOnInit(): void {
21+
22+
this.width = "100%";
23+
24+
this.dataSourceSettings = {
25+
dataSource: pivot_Data as IDataSet[],
26+
expandAll: false,
27+
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
28+
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
29+
rows: [{ name: 'Country' }, { name: 'Products' }],
30+
formatSettings: [{ name: 'Amount', format: 'C0' }],
31+
filters: [],
32+
valueSortSettings: { headerText: 'FY 2015##Q1##Amount', headerDelimiter: '##', sortOrder: 'Descending' }
33+
};
34+
35+
this.button = new Button({ isPrimary: true });
36+
this.button.appendTo('#export');
37+
38+
this.button.element.onclick = (): void => {
39+
this.pdfExportProperties = {
40+
header: {
41+
fromTop: 0,
42+
height: 130,
43+
contents: [
44+
{
45+
type: 'Text',
46+
value: "Pivot Table",
47+
position: { x: 0, y: 50 },
48+
style: { textBrushColor: '#000000', fontSize: 13, dashStyle:'Solid',hAlign:'Center' }
49+
}
50+
]
51+
},
52+
footer: {
53+
fromBottom: 160,
54+
height: 150,
55+
contents: [
56+
{
57+
type: 'PageNumber',
58+
pageNumberType: 'Arabic',
59+
format: 'Page {$current} of {$total}',
60+
position: { x: 0, y: 25 },
61+
style: { textBrushColor: '#02007a', fontSize: 15 }
62+
}
63+
]
64+
}
65+
};
66+
this.pivotGridObj.pdfExport(this.pdfExportProperties);
67+
};
68+
}
69+
}

0 commit comments

Comments
 (0)