@syncfusion/ej2-pdf-export 20.2.45 → 20.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ej2-pdf-export.min.js +10 -0
- package/dist/ej2-pdf-export.umd.min.js +1 -1
- package/dist/global/ej2-pdf-export.min.js +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/implementation/actions/action.ts +76 -0
- package/dist/ts/implementation/actions/uri-action.ts +52 -0
- package/dist/ts/implementation/annotations/action-link-annotation.ts +43 -0
- package/dist/ts/implementation/annotations/annotation-collection.ts +159 -0
- package/dist/ts/implementation/annotations/annotation.ts +241 -0
- package/dist/ts/implementation/annotations/document-link-annotation.ts +118 -0
- package/dist/ts/implementation/annotations/link-annotation.ts +32 -0
- package/dist/ts/implementation/annotations/pdf-text-web-link.ts +265 -0
- package/dist/ts/implementation/annotations/uri-annotation.ts +86 -0
- package/dist/ts/implementation/collections/dictionary.ts +150 -0
- package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +125 -0
- package/dist/ts/implementation/collections/utils.ts +38 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +39 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +108 -0
- package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +127 -0
- package/dist/ts/implementation/document/automatic-fields/composite-field.ts +76 -0
- package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +37 -0
- package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +75 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +157 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +82 -0
- package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +60 -0
- package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +48 -0
- package/dist/ts/implementation/document/pdf-catalog.ts +52 -0
- package/dist/ts/implementation/document/pdf-document-base.ts +166 -0
- package/dist/ts/implementation/document/pdf-document-template.ts +310 -0
- package/dist/ts/implementation/document/pdf-document.ts +342 -0
- package/dist/ts/implementation/drawing/pdf-drawing.ts +218 -0
- package/dist/ts/implementation/general/enum.ts +21 -0
- package/dist/ts/implementation/general/functions/pdf-function.ts +66 -0
- package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +62 -0
- package/dist/ts/implementation/general/pdf-cache-collection.ts +97 -0
- package/dist/ts/implementation/general/pdf-collection.ts +41 -0
- package/dist/ts/implementation/general/pdf-destination.ts +170 -0
- package/dist/ts/implementation/graphics/brushes/enum.ts +237 -0
- package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +294 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +68 -0
- package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +2438 -0
- package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +295 -0
- package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +311 -0
- package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +406 -0
- package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +290 -0
- package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +107 -0
- package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +304 -0
- package/dist/ts/implementation/graphics/constants.ts +31 -0
- package/dist/ts/implementation/graphics/enum.ts +413 -0
- package/dist/ts/implementation/graphics/figures/arc.ts +133 -0
- package/dist/ts/implementation/graphics/figures/base/draw-element.ts +59 -0
- package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +260 -0
- package/dist/ts/implementation/graphics/figures/base/fill-element.ts +72 -0
- package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +34 -0
- package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +69 -0
- package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +276 -0
- package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +205 -0
- package/dist/ts/implementation/graphics/figures/ellipse-part.ts +76 -0
- package/dist/ts/implementation/graphics/figures/enum.ts +80 -0
- package/dist/ts/implementation/graphics/figures/layout-element.ts +132 -0
- package/dist/ts/implementation/graphics/figures/path.ts +646 -0
- package/dist/ts/implementation/graphics/figures/pdf-template.ts +205 -0
- package/dist/ts/implementation/graphics/figures/rectangle-area.ts +108 -0
- package/dist/ts/implementation/graphics/figures/text-element.ts +445 -0
- package/dist/ts/implementation/graphics/fonts/enum.ts +385 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +248 -0
- package/dist/ts/implementation/graphics/fonts/pdf-font.ts +316 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +606 -0
- package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +243 -0
- package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +474 -0
- package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +165 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +958 -0
- package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +374 -0
- package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +255 -0
- package/dist/ts/implementation/graphics/fonts/string-layouter.ts +617 -0
- package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +275 -0
- package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +206 -0
- package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +18 -0
- package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +35 -0
- package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +94 -0
- package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +56 -0
- package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +10 -0
- package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +14 -0
- package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +106 -0
- package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +58 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +33 -0
- package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +22 -0
- package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +42 -0
- package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +1254 -0
- package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +26 -0
- package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +577 -0
- package/dist/ts/implementation/graphics/images/byte-array.ts +137 -0
- package/dist/ts/implementation/graphics/images/image-decoder.ts +437 -0
- package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +110 -0
- package/dist/ts/implementation/graphics/images/pdf-image.ts +132 -0
- package/dist/ts/implementation/graphics/pdf-color.ts +478 -0
- package/dist/ts/implementation/graphics/pdf-graphics.ts +2424 -0
- package/dist/ts/implementation/graphics/pdf-margins.ts +124 -0
- package/dist/ts/implementation/graphics/pdf-pen.ts +370 -0
- package/dist/ts/implementation/graphics/pdf-resources.ts +300 -0
- package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +246 -0
- package/dist/ts/implementation/graphics/pdf-transparency.ts +93 -0
- package/dist/ts/implementation/graphics/unit-convertor.ts +96 -0
- package/dist/ts/implementation/input-output/big-endian-writer.ts +121 -0
- package/dist/ts/implementation/input-output/cross-table.ts +21 -0
- package/dist/ts/implementation/input-output/enum.ts +16 -0
- package/dist/ts/implementation/input-output/pdf-cross-table.ts +524 -0
- package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +515 -0
- package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +194 -0
- package/dist/ts/implementation/input-output/pdf-operators.ts +363 -0
- package/dist/ts/implementation/input-output/pdf-stream-writer.ts +681 -0
- package/dist/ts/implementation/input-output/pdf-writer.ts +88 -0
- package/dist/ts/implementation/pages/enum.ts +201 -0
- package/dist/ts/implementation/pages/page-added-event-arguments.ts +39 -0
- package/dist/ts/implementation/pages/pdf-document-page-collection.ts +180 -0
- package/dist/ts/implementation/pages/pdf-page-base.ts +181 -0
- package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +348 -0
- package/dist/ts/implementation/pages/pdf-page-layer.ts +271 -0
- package/dist/ts/implementation/pages/pdf-page-settings.ts +192 -0
- package/dist/ts/implementation/pages/pdf-page-size.ts +162 -0
- package/dist/ts/implementation/pages/pdf-page-template-element.ts +659 -0
- package/dist/ts/implementation/pages/pdf-page.ts +235 -0
- package/dist/ts/implementation/pages/pdf-section-collection.ts +187 -0
- package/dist/ts/implementation/pages/pdf-section-page-collection.ts +61 -0
- package/dist/ts/implementation/pages/pdf-section-templates.ts +96 -0
- package/dist/ts/implementation/pages/pdf-section.ts +644 -0
- package/dist/ts/implementation/primitives/pdf-array.ts +386 -0
- package/dist/ts/implementation/primitives/pdf-boolean.ts +119 -0
- package/dist/ts/implementation/primitives/pdf-dictionary.ts +513 -0
- package/dist/ts/implementation/primitives/pdf-name.ts +218 -0
- package/dist/ts/implementation/primitives/pdf-number.ts +165 -0
- package/dist/ts/implementation/primitives/pdf-reference.ts +430 -0
- package/dist/ts/implementation/primitives/pdf-stream.ts +336 -0
- package/dist/ts/implementation/primitives/pdf-string.ts +397 -0
- package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +2027 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +1189 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +206 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +470 -0
- package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +853 -0
- package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +240 -0
- package/dist/ts/implementation/structured-elements/grid/styles/style.ts +424 -0
- package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +16 -0
- package/dist/ts/interfaces/i-pdf-cache.ts +23 -0
- package/dist/ts/interfaces/i-pdf-changable.ts +17 -0
- package/dist/ts/interfaces/i-pdf-clonable.ts +12 -0
- package/dist/ts/interfaces/i-pdf-primitives.ts +45 -0
- package/dist/ts/interfaces/i-pdf-true-type-font.ts +48 -0
- package/dist/ts/interfaces/i-pdf-wrapper.ts +13 -0
- package/dist/ts/interfaces/i-pdf-writer.ts +29 -0
- package/package.json +8 -7
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PdfGrid.ts class for EJ2-PDF
|
|
3
|
+
*/
|
|
4
|
+
import { PdfGridColumnCollection } from './pdf-grid-column';
|
|
5
|
+
import { PdfGridRow } from './pdf-grid-row';
|
|
6
|
+
import { PdfGridCell } from './pdf-grid-cell';
|
|
7
|
+
import { PdfGridRowCollection, PdfGridHeaderCollection } from './pdf-grid-row';
|
|
8
|
+
import { RectangleF, SizeF, PointF } from './../../drawing/pdf-drawing';
|
|
9
|
+
import { PdfPage } from './../../pages/pdf-page';
|
|
10
|
+
import { PdfLayoutElement } from './../../graphics/figures/layout-element';
|
|
11
|
+
import { PdfLayoutResult, PdfLayoutParams, PdfLayoutFormat } from './../../graphics/figures/base/element-layouter';
|
|
12
|
+
import { PdfGridStyle , PdfGridCellStyle} from './styles/style';
|
|
13
|
+
import { PdfBorders} from './styles/pdf-borders';
|
|
14
|
+
import { PdfGraphics } from './../../graphics/pdf-graphics';
|
|
15
|
+
import { PdfGridLayouter, PdfGridLayoutResult } from './../../structured-elements/grid/layout/grid-layouter';
|
|
16
|
+
import { PdfGridBeginCellDrawEventArgs, PdfGridEndCellDrawEventArgs} from '../../structured-elements/grid/layout/grid-layouter';
|
|
17
|
+
export class PdfGrid extends PdfLayoutElement {
|
|
18
|
+
//Fields
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
private gridColumns : PdfGridColumnCollection;
|
|
24
|
+
/**
|
|
25
|
+
* @hidden
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private gridRows : PdfGridRowCollection;
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private gridHeaders : PdfGridHeaderCollection;
|
|
34
|
+
/**
|
|
35
|
+
* @hidden
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private gridInitialWidth : number ;
|
|
39
|
+
/**
|
|
40
|
+
* @hidden
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
public isComplete : boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private gridSize : SizeF = new SizeF(0, 0);
|
|
49
|
+
/**
|
|
50
|
+
* @hidden
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private layoutFormat : PdfLayoutFormat;
|
|
54
|
+
/**
|
|
55
|
+
* @hidden
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private gridLocation : RectangleF;
|
|
59
|
+
/**
|
|
60
|
+
* @hidden
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private gridStyle : PdfGridStyle;
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
private ispageWidth : boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Check weather it is `child grid or not`.
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private ischildGrid : boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Check the child grid is ' split or not'
|
|
76
|
+
*/
|
|
77
|
+
public isGridSplit : boolean = false;
|
|
78
|
+
/**
|
|
79
|
+
* @hidden
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
public rowLayoutBoundsWidth : number;
|
|
83
|
+
/**
|
|
84
|
+
* @hidden
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
public isRearranged : boolean = false;
|
|
88
|
+
/**
|
|
89
|
+
* @hidden
|
|
90
|
+
* @private
|
|
91
|
+
*/
|
|
92
|
+
private bRepeatHeader : boolean;
|
|
93
|
+
/**
|
|
94
|
+
* @hidden
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private pageBounds : RectangleF = new RectangleF();
|
|
98
|
+
|
|
99
|
+
//GridLayouter-Fields
|
|
100
|
+
/**
|
|
101
|
+
* @hidden
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private currentPage : PdfPage;
|
|
105
|
+
/**
|
|
106
|
+
* @hidden
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private currentPageBounds : SizeF;
|
|
110
|
+
/**
|
|
111
|
+
* @hidden
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
private currentBounds : RectangleF;
|
|
115
|
+
/**
|
|
116
|
+
* @hidden
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
private currentGraphics : PdfGraphics;
|
|
120
|
+
/**
|
|
121
|
+
* @hidden
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
public listOfNavigatePages : number[] = [];
|
|
125
|
+
/**
|
|
126
|
+
* @hidden
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
private startLocation : PointF;
|
|
130
|
+
/**
|
|
131
|
+
* @hidden
|
|
132
|
+
* @private
|
|
133
|
+
*/
|
|
134
|
+
public parentCellIndex : number = 0 ;
|
|
135
|
+
public tempWidth : number = 0;
|
|
136
|
+
/**
|
|
137
|
+
* @hidden
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
private breakRow : boolean = true;
|
|
141
|
+
public splitChildRowIndex : number = -1;
|
|
142
|
+
private rowBreakPageHeightCellIndex : number;
|
|
143
|
+
//Events
|
|
144
|
+
/**
|
|
145
|
+
* The event raised on `starting cell drawing`.
|
|
146
|
+
* @event
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
public beginCellDraw : Function;
|
|
150
|
+
/**
|
|
151
|
+
* The event raised on `ending cell drawing`.
|
|
152
|
+
* @event
|
|
153
|
+
* @private
|
|
154
|
+
*/
|
|
155
|
+
public endCellDraw : Function;
|
|
156
|
+
/**
|
|
157
|
+
* The event raised on `begin cell lay outing`.
|
|
158
|
+
* @event
|
|
159
|
+
* @private
|
|
160
|
+
*/
|
|
161
|
+
//public beginPageLayout : Function;
|
|
162
|
+
/**
|
|
163
|
+
* The event raised on `end cell lay outing`.
|
|
164
|
+
* @event
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
//public endPageLayout : Function;
|
|
168
|
+
public hasRowSpanSpan : boolean = false;
|
|
169
|
+
public hasColumnSpan : boolean = false;
|
|
170
|
+
public isSingleGrid : boolean = true;
|
|
171
|
+
private parentCell : PdfGridCell;
|
|
172
|
+
//constructor
|
|
173
|
+
/**
|
|
174
|
+
* Initialize a new instance for `PdfGrid` class.
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
public constructor() {
|
|
178
|
+
super();
|
|
179
|
+
}
|
|
180
|
+
//Properties
|
|
181
|
+
/**
|
|
182
|
+
* Gets a value indicating whether the `start cell layout event` should be raised.
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
public get raiseBeginCellDraw() : boolean {
|
|
186
|
+
return (typeof this.beginCellDraw !== 'undefined' && typeof this.beginCellDraw !== null);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Gets a value indicating whether the `end cell layout event` should be raised.
|
|
190
|
+
* @private
|
|
191
|
+
*/
|
|
192
|
+
public get raiseEndCellDraw() : boolean {
|
|
193
|
+
return (typeof this.endCellDraw !== 'undefined' && typeof this.endCellDraw !== null);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Gets or sets a value indicating whether to `repeat header`.
|
|
197
|
+
* @private
|
|
198
|
+
*/
|
|
199
|
+
public get repeatHeader() : boolean {
|
|
200
|
+
if (this.bRepeatHeader == null || typeof this.bRepeatHeader === 'undefined') {
|
|
201
|
+
this.bRepeatHeader = false;
|
|
202
|
+
}
|
|
203
|
+
return this.bRepeatHeader;
|
|
204
|
+
}
|
|
205
|
+
public set repeatHeader(value : boolean) {
|
|
206
|
+
this.bRepeatHeader = value;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Gets or sets a value indicating whether to split or cut rows that `overflow a page`.
|
|
210
|
+
* @private
|
|
211
|
+
*/
|
|
212
|
+
public get allowRowBreakAcrossPages() : boolean {
|
|
213
|
+
return this.breakRow;
|
|
214
|
+
}
|
|
215
|
+
public set allowRowBreakAcrossPages(value : boolean) {
|
|
216
|
+
this.breakRow = value;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Gets the `column` collection of the PdfGrid.[Read-Only]
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
public get columns() : PdfGridColumnCollection {
|
|
223
|
+
if (this.gridColumns == null || typeof this.gridColumns === 'undefined') {
|
|
224
|
+
this.gridColumns = new PdfGridColumnCollection(this);
|
|
225
|
+
}
|
|
226
|
+
return this.gridColumns;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Gets the `row` collection from the PdfGrid.[Read-Only]
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
public get rows() : PdfGridRowCollection {
|
|
233
|
+
if (this.gridRows == null) {
|
|
234
|
+
this.gridRows = new PdfGridRowCollection(this);
|
|
235
|
+
}
|
|
236
|
+
return (this.gridRows as PdfGridRowCollection);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Gets the `headers` collection from the PdfGrid.[Read-Only]
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
public get headers() : PdfGridHeaderCollection {
|
|
243
|
+
if (this.gridHeaders == null || typeof this.gridHeaders === 'undefined') {
|
|
244
|
+
this.gridHeaders = new PdfGridHeaderCollection(this);
|
|
245
|
+
}
|
|
246
|
+
return this.gridHeaders;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Indicating `initial width` of the page.
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
public get initialWidth() : number {
|
|
253
|
+
return this.gridInitialWidth;
|
|
254
|
+
}
|
|
255
|
+
public set initialWidth(value : number) {
|
|
256
|
+
this.gridInitialWidth = value;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Gets or sets the `grid style`.
|
|
260
|
+
* @private
|
|
261
|
+
*/
|
|
262
|
+
public get style() : PdfGridStyle {
|
|
263
|
+
if (this.gridStyle == null) {
|
|
264
|
+
this.gridStyle = new PdfGridStyle();
|
|
265
|
+
}
|
|
266
|
+
return this.gridStyle;
|
|
267
|
+
}
|
|
268
|
+
public set style(value : PdfGridStyle) {
|
|
269
|
+
if (this.gridStyle == null) {
|
|
270
|
+
this.gridStyle = value;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Gets a value indicating whether the grid column width is considered to be `page width`.
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
public get isPageWidth() : boolean {
|
|
278
|
+
return this.ispageWidth;
|
|
279
|
+
}
|
|
280
|
+
public set isPageWidth(value : boolean) {
|
|
281
|
+
this.ispageWidth = value;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Gets or set if grid `is nested grid`.
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
public get isChildGrid() : boolean {
|
|
288
|
+
return this.ischildGrid;
|
|
289
|
+
}
|
|
290
|
+
public set isChildGrid(value : boolean) {
|
|
291
|
+
this.ischildGrid = value;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Gets or set if grid ' is split or not'
|
|
295
|
+
* @public
|
|
296
|
+
*/
|
|
297
|
+
// public get isGridSplit() : boolean {
|
|
298
|
+
// return this.isgridSplit;
|
|
299
|
+
// }
|
|
300
|
+
// public set isGridSplit(value : boolean) {
|
|
301
|
+
// this.isgridSplit = value;
|
|
302
|
+
// }public get isGridSplit() : boolean {
|
|
303
|
+
// return this.isgridSplit;
|
|
304
|
+
// }
|
|
305
|
+
// public set isGridSplit(value : boolean) {
|
|
306
|
+
// this.isgridSplit = value;
|
|
307
|
+
// }
|
|
308
|
+
/**
|
|
309
|
+
* Gets the `size`.
|
|
310
|
+
* @private
|
|
311
|
+
*/
|
|
312
|
+
public get size() : SizeF {
|
|
313
|
+
if ((this.gridSize.width === 0 || typeof this.gridSize.width === 'undefined') && this.gridSize.height === 0) {
|
|
314
|
+
this.gridSize = this.measure();
|
|
315
|
+
}
|
|
316
|
+
return this.gridSize;
|
|
317
|
+
// } else {
|
|
318
|
+
// return this.gridSize;
|
|
319
|
+
// }
|
|
320
|
+
}
|
|
321
|
+
public set size(value : SizeF) {
|
|
322
|
+
this.gridSize = value;
|
|
323
|
+
}
|
|
324
|
+
public get ParentCell() : PdfGridCell{
|
|
325
|
+
return this.parentCell;
|
|
326
|
+
}
|
|
327
|
+
public set ParentCell(value : PdfGridCell) {
|
|
328
|
+
this.parentCell = value;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
public get LayoutFormat() : PdfLayoutFormat {
|
|
332
|
+
return this.layoutFormat;
|
|
333
|
+
}
|
|
334
|
+
//Implementation
|
|
335
|
+
/**
|
|
336
|
+
* `Draws` the element on the page with the specified page and 'PointF' class
|
|
337
|
+
* @private
|
|
338
|
+
*/
|
|
339
|
+
public draw(page : PdfPage, location : PointF) : PdfLayoutResult
|
|
340
|
+
/**
|
|
341
|
+
* `Draws` the element on the page with the specified page and pair of coordinates
|
|
342
|
+
* @private
|
|
343
|
+
*/
|
|
344
|
+
public draw(page : PdfPage, x : number, y : number) : PdfLayoutResult
|
|
345
|
+
/**
|
|
346
|
+
* `Draws` the element on the page with the specified page and 'RectangleF' class
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
public draw(page : PdfPage, layoutRectangle : RectangleF) : PdfLayoutResult
|
|
350
|
+
/**
|
|
351
|
+
* `Draws` the element on the page with the specified page, 'PointF' class and layout format
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
public draw(page : PdfPage, location : PointF, format : PdfLayoutFormat) : PdfLayoutResult
|
|
355
|
+
/**
|
|
356
|
+
* `Draws` the element on the page with the specified page, pair of coordinates and layout format
|
|
357
|
+
* @private
|
|
358
|
+
*/
|
|
359
|
+
public draw(page : PdfPage, x : number, y : number, format : PdfLayoutFormat) : PdfLayoutResult
|
|
360
|
+
/**
|
|
361
|
+
* `Draws` the element on the page.
|
|
362
|
+
* @private
|
|
363
|
+
*/
|
|
364
|
+
public draw(page : PdfPage, layoutRectangle : RectangleF, embedFonts : boolean) : PdfLayoutResult
|
|
365
|
+
/**
|
|
366
|
+
* `Draws` the element on the page with the specified page, 'RectangleF' class and layout format
|
|
367
|
+
* @private
|
|
368
|
+
*/
|
|
369
|
+
public draw(page : PdfPage, layoutRectangle : RectangleF, format : PdfLayoutFormat) : PdfLayoutResult
|
|
370
|
+
public draw(arg1 : PdfPage, arg2 : RectangleF|PointF|number, arg3 ?: PdfLayoutFormat|number|boolean,
|
|
371
|
+
arg4 ?: PdfLayoutFormat) : PdfLayoutResult {
|
|
372
|
+
if (arg2 instanceof PointF && typeof (arg2 as RectangleF).width === 'undefined' && typeof arg3 === 'undefined') {
|
|
373
|
+
return this.drawHelper(arg1, arg2.x, arg2.y);
|
|
374
|
+
} else if (typeof arg2 === 'number' && typeof arg3 === 'number' && typeof arg4 === 'undefined') {
|
|
375
|
+
return this.drawHelper(arg1, arg2, arg3, null);
|
|
376
|
+
} else if (arg2 instanceof RectangleF && typeof (arg2 as RectangleF).width !== 'undefined' && typeof arg3 === 'undefined') {
|
|
377
|
+
return this.drawHelper(arg1, arg2, null);
|
|
378
|
+
} else if (arg2 instanceof PointF && typeof (arg2 as RectangleF).width === 'undefined' && arg3 instanceof PdfLayoutFormat) {
|
|
379
|
+
return this.drawHelper(arg1, arg2.x, arg2.y, arg3);
|
|
380
|
+
} else if (typeof arg2 === 'number' && typeof arg3 === 'number' && (arg4 instanceof PdfLayoutFormat || arg4 == null)) {
|
|
381
|
+
let width : number = (arg1.graphics.clientSize.width - arg2);
|
|
382
|
+
let layoutRectangle : RectangleF = new RectangleF(arg2, arg3, width, 0);
|
|
383
|
+
return this.drawHelper(arg1, layoutRectangle, arg4);
|
|
384
|
+
} else if (arg2 instanceof RectangleF && typeof (arg2 as RectangleF).width !== 'undefined' && typeof arg3 === 'boolean') {
|
|
385
|
+
return this.drawHelper(arg1, arg2, null);
|
|
386
|
+
} else {
|
|
387
|
+
return this.drawHelper(arg1, (arg2 as RectangleF), arg3 as PdfLayoutFormat);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* `measures` this instance.
|
|
392
|
+
* @private
|
|
393
|
+
*/
|
|
394
|
+
private measure() : SizeF {
|
|
395
|
+
let height : number = 0;
|
|
396
|
+
let width : number = this.columns.width;
|
|
397
|
+
for (let i : number = 0; i < this.headers.count; i++) {
|
|
398
|
+
let row : PdfGridRow = this.headers.getHeader(i);
|
|
399
|
+
height += row.height;
|
|
400
|
+
}
|
|
401
|
+
for (let i : number = 0; i < this.rows.count; i++) {
|
|
402
|
+
let row : PdfGridRow = this.rows.getRow(i);
|
|
403
|
+
height += row.height;
|
|
404
|
+
}
|
|
405
|
+
return new SizeF(width, height);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
public onBeginCellDraw(args : PdfGridBeginCellDrawEventArgs ): void {
|
|
409
|
+
if (this.raiseBeginCellDraw) {
|
|
410
|
+
this.beginCellDraw(this, args);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
public onEndCellDraw(args : PdfGridEndCellDrawEventArgs ): void {
|
|
414
|
+
if (this.raiseEndCellDraw) {
|
|
415
|
+
this.endCellDraw(this, args);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* `Layouts` the specified graphics.
|
|
420
|
+
* @private
|
|
421
|
+
*/
|
|
422
|
+
protected layout(param : PdfLayoutParams) : PdfLayoutResult {
|
|
423
|
+
let width: number = param.bounds.width;
|
|
424
|
+
let height: number = param.bounds.height;
|
|
425
|
+
let hasChanged: boolean = false;
|
|
426
|
+
if (typeof param.bounds.width === 'undefined' || param.bounds.width === 0) {
|
|
427
|
+
width = param.page.getClientSize().width - param.bounds.x;
|
|
428
|
+
hasChanged = true;
|
|
429
|
+
}
|
|
430
|
+
if (typeof param.bounds.height === 'undefined' || param.bounds.height === 0) {
|
|
431
|
+
height = param.page.getClientSize().height - param.bounds.y;
|
|
432
|
+
hasChanged = true;
|
|
433
|
+
}
|
|
434
|
+
if (hasChanged) {
|
|
435
|
+
param.bounds = new RectangleF(param.bounds.x, param.bounds.y, width, height);
|
|
436
|
+
}
|
|
437
|
+
if (this.rows.count !== 0) {
|
|
438
|
+
let currentRow : PdfGridCellStyle = this.rows.getRow(0).cells.getCell(0).style;
|
|
439
|
+
if (currentRow.borders != null && (( currentRow.borders.left != null && currentRow.borders.left.width !== 1) ||
|
|
440
|
+
(currentRow.borders.top != null && currentRow.borders.top.width !== 1))) {
|
|
441
|
+
let x : number = currentRow.borders.left.width / 2;
|
|
442
|
+
let y : number = currentRow.borders.top.width / 2;
|
|
443
|
+
if (param.bounds.x === PdfBorders.default.right.width / 2 && param.bounds.y === PdfBorders.default.right.width / 2) {
|
|
444
|
+
let newBound : RectangleF = new RectangleF(x, y, this.gridSize.width, this.gridSize.height);
|
|
445
|
+
param.bounds = newBound;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
this.setSpan();
|
|
450
|
+
this.checkSpan();
|
|
451
|
+
this.layoutFormat = param.format;
|
|
452
|
+
this.gridLocation = param.bounds;
|
|
453
|
+
let layouter : PdfGridLayouter = new PdfGridLayouter(this);
|
|
454
|
+
let result : PdfGridLayoutResult = (layouter.Layouter(param)) as PdfGridLayoutResult;
|
|
455
|
+
|
|
456
|
+
return result;
|
|
457
|
+
}
|
|
458
|
+
public setSpan() : void {
|
|
459
|
+
let colSpan : number = 1;
|
|
460
|
+
let rowSpan : number = 1;
|
|
461
|
+
let currentCellIndex : number = 0;
|
|
462
|
+
let currentRowIndex : number = 0;
|
|
463
|
+
let maxSpan : number = 0;
|
|
464
|
+
let rowCount : number = this.headers.count;
|
|
465
|
+
for (let i : number = 0; i < rowCount; i++) {
|
|
466
|
+
let row : PdfGridRow = this.headers.getHeader(i);
|
|
467
|
+
maxSpan = 0;
|
|
468
|
+
let colCount : number = row.cells.count;
|
|
469
|
+
for (let j : number = 0; j < colCount; j++) {
|
|
470
|
+
let cell : PdfGridCell = row.cells.getCell(j);
|
|
471
|
+
maxSpan = Math.max(maxSpan, cell.rowSpan);
|
|
472
|
+
//Skip setting span map for already coverted rows/columns.
|
|
473
|
+
if (!cell.isCellMergeContinue && !cell.isRowMergeContinue && (cell.columnSpan > 1 || cell.rowSpan > 1)) {
|
|
474
|
+
if (cell.columnSpan + j > row.cells.count) {
|
|
475
|
+
throw new Error('Invalid span specified at row ' + j.toString() + ' column ' + i.toString());
|
|
476
|
+
}
|
|
477
|
+
if (cell.rowSpan + i > this.headers.count) {
|
|
478
|
+
throw new Error('Invalid span specified at Header ' + j.toString() + ' column ' + i.toString());
|
|
479
|
+
}
|
|
480
|
+
// if (this.rows.count !== 0 && cell.rowSpan + i > this.rows.count) {
|
|
481
|
+
// throw new Error('Invalid span specified at row ' + j.toString() + ' column ' + i.toString());
|
|
482
|
+
// }
|
|
483
|
+
if (cell.columnSpan > 1 && cell.rowSpan > 1) {
|
|
484
|
+
colSpan = cell.columnSpan;
|
|
485
|
+
rowSpan = cell.rowSpan;
|
|
486
|
+
currentCellIndex = j;
|
|
487
|
+
currentRowIndex = i;
|
|
488
|
+
cell.isCellMergeStart = true;
|
|
489
|
+
cell.isRowMergeStart = true;
|
|
490
|
+
//Set Column merges for first row
|
|
491
|
+
while (colSpan > 1) {
|
|
492
|
+
currentCellIndex++;
|
|
493
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
494
|
+
row.cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
495
|
+
row.cells.getCell(currentCellIndex).rowSpan = rowSpan;
|
|
496
|
+
colSpan--;
|
|
497
|
+
}
|
|
498
|
+
currentCellIndex = j;
|
|
499
|
+
colSpan = cell.columnSpan;
|
|
500
|
+
//Set Row Merges and column merges foreach subsequent rows.
|
|
501
|
+
while (rowSpan > 1) {
|
|
502
|
+
currentRowIndex++;
|
|
503
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
504
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
505
|
+
rowSpan--;
|
|
506
|
+
while (colSpan > 1) {
|
|
507
|
+
currentCellIndex++;
|
|
508
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
509
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
510
|
+
colSpan--;
|
|
511
|
+
}
|
|
512
|
+
colSpan = cell.columnSpan;
|
|
513
|
+
currentCellIndex = j;
|
|
514
|
+
}
|
|
515
|
+
} else if (cell.columnSpan > 1 && cell.rowSpan === 1) {
|
|
516
|
+
colSpan = cell.columnSpan;
|
|
517
|
+
currentCellIndex = j;
|
|
518
|
+
cell.isCellMergeStart = true;
|
|
519
|
+
//Set Column merges.
|
|
520
|
+
while (colSpan > 1) {
|
|
521
|
+
currentCellIndex++;
|
|
522
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
523
|
+
colSpan--;
|
|
524
|
+
}
|
|
525
|
+
} else if (cell.columnSpan === 1 && cell.rowSpan > 1) {
|
|
526
|
+
rowSpan = cell.rowSpan;
|
|
527
|
+
currentRowIndex = i;
|
|
528
|
+
//Set row Merges.
|
|
529
|
+
while (rowSpan > 1) {
|
|
530
|
+
currentRowIndex++;
|
|
531
|
+
this.headers.getHeader(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
532
|
+
rowSpan--;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
row.maximumRowSpan = maxSpan;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
public checkSpan() : void {
|
|
541
|
+
let cellcolSpan : number;
|
|
542
|
+
let cellrowSpan : number = 1;
|
|
543
|
+
let cellmaxSpan : number = 0;
|
|
544
|
+
let currentCellIndex : number;
|
|
545
|
+
let currentRowIndex : number = 0;
|
|
546
|
+
cellcolSpan = cellrowSpan = 1;
|
|
547
|
+
currentCellIndex = currentRowIndex = 0;
|
|
548
|
+
if (this.hasRowSpanSpan || this.hasColumnSpan) {
|
|
549
|
+
let rowCount : number = this.rows.count;
|
|
550
|
+
for (let i : number = 0; i < rowCount; i++) {
|
|
551
|
+
let row : PdfGridRow = this.rows.getRow(i);
|
|
552
|
+
cellmaxSpan = 0;
|
|
553
|
+
let colCount : number = row.cells.count;
|
|
554
|
+
for (let j : number = 0; j < colCount; j++) {
|
|
555
|
+
let cell : PdfGridCell = row.cells.getCell(j);
|
|
556
|
+
cellmaxSpan = Math.max(cellmaxSpan, cell.rowSpan);
|
|
557
|
+
//Skip setting span map for already coverted rows/columns.
|
|
558
|
+
if (!cell.isCellMergeContinue && !cell.isRowMergeContinue
|
|
559
|
+
&& (cell.columnSpan > 1 || cell.rowSpan > 1)) {
|
|
560
|
+
if (cell.columnSpan + j > row.cells.count) {
|
|
561
|
+
throw new Error('Invalid span specified at row ' + j.toString() + ' column ' + i.toString());
|
|
562
|
+
}
|
|
563
|
+
if (cell.rowSpan + i > this.rows.count) {
|
|
564
|
+
throw new Error('Invalid span specified at row ' + j.toString() + ' column ' + i.toString());
|
|
565
|
+
}
|
|
566
|
+
if (cell.columnSpan > 1 && cell.rowSpan > 1) {
|
|
567
|
+
cellcolSpan = cell.columnSpan;
|
|
568
|
+
cellrowSpan = cell.rowSpan;
|
|
569
|
+
|
|
570
|
+
currentCellIndex = j;
|
|
571
|
+
currentRowIndex = i;
|
|
572
|
+
|
|
573
|
+
cell.isCellMergeStart = true;
|
|
574
|
+
cell.isRowMergeStart = true;
|
|
575
|
+
|
|
576
|
+
//Set Column merges for first row
|
|
577
|
+
while (cellcolSpan > 1) {
|
|
578
|
+
currentCellIndex++;
|
|
579
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
580
|
+
row.cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
581
|
+
cellcolSpan--;
|
|
582
|
+
}
|
|
583
|
+
currentCellIndex = j;
|
|
584
|
+
cellcolSpan = cell.columnSpan;
|
|
585
|
+
|
|
586
|
+
//Set Row Merges and column merges foreach subsequent rows.
|
|
587
|
+
while (cellrowSpan > 1) {
|
|
588
|
+
currentRowIndex++;
|
|
589
|
+
this.rows.getRow(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
590
|
+
this.rows.getRow(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
591
|
+
cellrowSpan--;
|
|
592
|
+
|
|
593
|
+
while (cellcolSpan > 1) {
|
|
594
|
+
currentCellIndex++;
|
|
595
|
+
this.rows.getRow(currentRowIndex).cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
596
|
+
this.rows.getRow(currentRowIndex).cells.getCell(currentCellIndex).isRowMergeContinue = true;
|
|
597
|
+
cellcolSpan--;
|
|
598
|
+
}
|
|
599
|
+
cellcolSpan = cell.columnSpan;
|
|
600
|
+
currentCellIndex = j;
|
|
601
|
+
}
|
|
602
|
+
} else if (cell.columnSpan > 1 && cell.rowSpan === 1) {
|
|
603
|
+
cellcolSpan = cell.columnSpan;
|
|
604
|
+
currentCellIndex = j;
|
|
605
|
+
cell.isCellMergeStart = true;
|
|
606
|
+
|
|
607
|
+
//Set Column merges.
|
|
608
|
+
while (cellcolSpan > 1) {
|
|
609
|
+
currentCellIndex++;
|
|
610
|
+
row.cells.getCell(currentCellIndex).isCellMergeContinue = true;
|
|
611
|
+
cellcolSpan--;
|
|
612
|
+
}
|
|
613
|
+
} else if (cell.columnSpan === 1 && cell.rowSpan > 1) {
|
|
614
|
+
cellrowSpan = cell.rowSpan;
|
|
615
|
+
currentRowIndex = i;
|
|
616
|
+
|
|
617
|
+
//Set row Merges.
|
|
618
|
+
while (cellrowSpan > 1) {
|
|
619
|
+
currentRowIndex++;
|
|
620
|
+
this.rows.getRow(currentRowIndex).cells.getCell(j).isRowMergeContinue = true;
|
|
621
|
+
cellrowSpan--;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
row.maximumRowSpan = cellmaxSpan;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
/* tslint:disable */
|
|
631
|
+
/**
|
|
632
|
+
* Calculates the `width` of the columns.
|
|
633
|
+
* @private
|
|
634
|
+
*/
|
|
635
|
+
public measureColumnsWidth() : void
|
|
636
|
+
/**
|
|
637
|
+
* Calculates the `width` of the columns.
|
|
638
|
+
* @private
|
|
639
|
+
*/
|
|
640
|
+
public measureColumnsWidth(bounds : RectangleF) : void
|
|
641
|
+
public measureColumnsWidth(bounds ?: RectangleF) : void {
|
|
642
|
+
if (typeof bounds !== 'undefined') {
|
|
643
|
+
this.isPageWidth = false;
|
|
644
|
+
let widths : number[] = this.columns.getDefaultWidths(bounds.width - bounds.x);
|
|
645
|
+
//let tempWidth : number = this.columns.getColumn(0).width;
|
|
646
|
+
for (let i : number = 0, count : number = this.columns.count; i < count; i++) {
|
|
647
|
+
// if (this.columns.getColumn(i).width < 0)
|
|
648
|
+
// this.columns.getColumn(i).columnWidth = widths[i];
|
|
649
|
+
// else if (this.columns.getColumn(i).width > 0 && !this.columns.getColumn(i).isCustomWidth && widths[i]>0 && this.isComplete)
|
|
650
|
+
this.columns.getColumn(i).columnWidth = widths[i];
|
|
651
|
+
this.tempWidth = widths[i];
|
|
652
|
+
}
|
|
653
|
+
if (this.ParentCell != null && this.style.allowHorizontalOverflow == false && this.ParentCell.row.grid.style.allowHorizontalOverflow == false)
|
|
654
|
+
{
|
|
655
|
+
let padding : number = 0;
|
|
656
|
+
let columnWidth : number = 0;
|
|
657
|
+
let columnCount : number = this.columns.count;
|
|
658
|
+
let childGridColumnWidth : number = 0;
|
|
659
|
+
if (this.ParentCell.style.cellPadding != null || typeof this.ParentCell.style.cellPadding !== 'undefined') {
|
|
660
|
+
if(typeof this.ParentCell.style.cellPadding.left != 'undefined' && this.ParentCell.style.cellPadding.hasLeftPad){
|
|
661
|
+
padding += this.ParentCell.style.cellPadding.left;
|
|
662
|
+
}
|
|
663
|
+
if(typeof this.ParentCell.style.cellPadding.right != 'undefined' && this.ParentCell.style.cellPadding.hasRightPad){
|
|
664
|
+
padding += this.ParentCell.style.cellPadding.right;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
}
|
|
668
|
+
for (let i : number = 0; i < this.ParentCell.columnSpan; i++)
|
|
669
|
+
{
|
|
670
|
+
columnWidth += this.ParentCell.row.grid.columns.getColumn(this.parentCellIndex + i).width;
|
|
671
|
+
}
|
|
672
|
+
for (let j : number = 0; j < this.columns.count; j++)
|
|
673
|
+
{
|
|
674
|
+
if (this.gridColumns.getColumn(j).width > 0 && this.gridColumns.getColumn(j).isCustomWidth)
|
|
675
|
+
{
|
|
676
|
+
columnWidth -= this.gridColumns.getColumn(j).width;
|
|
677
|
+
columnCount--;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if((this.ParentCell.row.grid.style.cellPadding != null || typeof this.ParentCell.row.grid.style.cellPadding != 'undefined'))
|
|
681
|
+
{
|
|
682
|
+
if(typeof this.ParentCell.row.grid.style.cellPadding.top != 'undefined' && this.ParentCell.row.grid.style.cellPadding.hasTopPad){
|
|
683
|
+
padding += this.ParentCell.row.grid.style.cellPadding.top;
|
|
684
|
+
}
|
|
685
|
+
if(typeof this.ParentCell.row.grid.style.cellPadding.bottom != 'undefined' && this.ParentCell.row.grid.style.cellPadding.hasBottomPad){
|
|
686
|
+
padding += this.ParentCell.row.grid.style.cellPadding.bottom;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
if (this.ParentCell.row.grid.style.cellSpacing != 0){
|
|
690
|
+
columnWidth -= this.ParentCell.row.grid.style.cellSpacing * 2;
|
|
691
|
+
}
|
|
692
|
+
if (columnWidth > padding)
|
|
693
|
+
{
|
|
694
|
+
childGridColumnWidth = (columnWidth - padding) / columnCount;
|
|
695
|
+
this.tempWidth=childGridColumnWidth;
|
|
696
|
+
if (this.ParentCell != null )
|
|
697
|
+
{
|
|
698
|
+
for (let j : number = 0; j < this.columns.count; j++)
|
|
699
|
+
{
|
|
700
|
+
if (!this.columns.getColumn(j).isCustomWidth)
|
|
701
|
+
this.columns.getColumn(j).columnWidth = childGridColumnWidth;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
// if (this.ParentCell != null && this.ParentCell.row.width > 0)
|
|
707
|
+
// {
|
|
708
|
+
// if (this.isChildGrid && this.gridSize.width > this.ParentCell.row.width)
|
|
709
|
+
// {
|
|
710
|
+
// widths = this.columns.getDefaultWidths(bounds.width);
|
|
711
|
+
// for (let i : number = 0; i < this.columns.count; i++)
|
|
712
|
+
// {
|
|
713
|
+
// this.columns.getColumn(i).width = widths[i];
|
|
714
|
+
// }
|
|
715
|
+
// }
|
|
716
|
+
// }
|
|
717
|
+
} else {
|
|
718
|
+
let widths : number[] = [this.columns.count];
|
|
719
|
+
for(let n : number = 0; n < this.columns.count;n++)
|
|
720
|
+
{
|
|
721
|
+
widths[n] = 0;
|
|
722
|
+
}
|
|
723
|
+
let cellWidth : number = 0;
|
|
724
|
+
let cellWidths : number = 0;
|
|
725
|
+
if((typeof this.isChildGrid === 'undefined' && typeof this.gridLocation !== 'undefined' ) || (this.isChildGrid === null && typeof this.gridLocation !== 'undefined')){
|
|
726
|
+
this.initialWidth = this.gridLocation.width;
|
|
727
|
+
}
|
|
728
|
+
if (this.headers.count > 0) {
|
|
729
|
+
let colCount : number = this.headers.getHeader(0).cells.count;
|
|
730
|
+
let rowCount : number = this.headers.count;
|
|
731
|
+
for (let i : number = 0; i < colCount; i++) {
|
|
732
|
+
cellWidth = 0;
|
|
733
|
+
for (let j : number = 0; j < rowCount; j++) {
|
|
734
|
+
let rowWidth : number = Math.min(this.initialWidth, this.headers.getHeader(j).cells.getCell(i).width);
|
|
735
|
+
cellWidth = Math.max(cellWidth, rowWidth);
|
|
736
|
+
}
|
|
737
|
+
widths[i] = cellWidth;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
// else {
|
|
741
|
+
// let colCount : number = this.rows.getRow(0).cells.count;
|
|
742
|
+
// let rowCount : number = this.rows.count;
|
|
743
|
+
// for (let i : number = 0; i < colCount; i++) {
|
|
744
|
+
// cellWidth = 0;
|
|
745
|
+
// for (let j : number = 0; j < rowCount; j++) {
|
|
746
|
+
// let rowWidth : number = Math.min(this.initialWidth, this.rows.getRow(j).cells.getCell(i).width);
|
|
747
|
+
// cellWidth = Math.max(cellWidth, rowWidth);
|
|
748
|
+
// }
|
|
749
|
+
// widths[i] = cellWidth;
|
|
750
|
+
// }
|
|
751
|
+
// }
|
|
752
|
+
cellWidth = 0;
|
|
753
|
+
for (let i : number = 0, colCount : number = this.columns.count; i < colCount; i++) {
|
|
754
|
+
for (let j : number = 0, rowCount : number = this.rows.count; j < rowCount; j++) {
|
|
755
|
+
if ((this.rows.getRow(j).cells.getCell(i).columnSpan == 1 && !this.rows.getRow(j).cells.getCell(i).isCellMergeContinue) || (this.rows.getRow(j).cells.getCell(i).value as PdfGrid) != null ) {
|
|
756
|
+
if ((this.rows.getRow(j).cells.getCell(i).value as PdfGrid) != null && !this.rows.getRow(j).grid.style.allowHorizontalOverflow) {
|
|
757
|
+
let value : number = this.rows.getRow(j).grid.style.cellPadding.right +
|
|
758
|
+
this.rows.getRow(j).grid.style.cellPadding.left
|
|
759
|
+
+ this.rows.getRow(j).cells.getCell(i).style.borders.left.width / 2 ;
|
|
760
|
+
// if (this.initialWidth != 0 )
|
|
761
|
+
// (this.rows.getRow(j).cells.getCell(i).value as PdfGrid).initialWidth = this.initialWidth - value;
|
|
762
|
+
}
|
|
763
|
+
let rowWidth : number = 0;
|
|
764
|
+
rowWidth = this.initialWidth > 0.0 ? Math.min(this.initialWidth, this.rows.getRow(j).cells.getCell(i).width) : this.rows.getRow(j).cells.getCell(i).width;
|
|
765
|
+
// let internalWidth : number = this.rows.getRow(j).cells.getCell(i).width;
|
|
766
|
+
// internalWidth += this.rows.getRow(j).cells.getCell(i).style.borders.left.width;
|
|
767
|
+
// internalWidth += this.rows.getRow(j).cells.getCell(i).style.borders.right.width;
|
|
768
|
+
// let internalHeight : number = this.rows.getRow(j).cells.getCell(i).height;
|
|
769
|
+
// internalHeight += (this.rows.getRow(j).cells.getCell(i).style.borders.top.width);
|
|
770
|
+
// internalHeight += (this.rows.getRow(j).cells.getCell(i).style.borders.bottom.width);
|
|
771
|
+
// let isCorrectWidth : boolean = (internalWidth + this.gridLocation.x) > this.currentGraphics.clientSize.width;
|
|
772
|
+
// let isCorrectHeight : boolean = (internalHeight + this.gridLocation.y) > this.currentGraphics.clientSize.height;
|
|
773
|
+
// if (isCorrectWidth || isCorrectHeight) {
|
|
774
|
+
// throw Error('Image size exceeds client size of the page. Can not insert this image');
|
|
775
|
+
// }
|
|
776
|
+
// rowWidth = Math.min(this.initialWidth, this.rows.getRow(j).cells.getCell(i).width);
|
|
777
|
+
cellWidth = Math.max(widths[i], Math.max(cellWidth, rowWidth));
|
|
778
|
+
cellWidth = Math.max(this.columns.getColumn(i).width, cellWidth);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
if(this.rows.count != 0)
|
|
782
|
+
widths[i] = cellWidth;
|
|
783
|
+
cellWidth = 0;
|
|
784
|
+
}
|
|
785
|
+
for (let i : number = 0, RowCount = this.rows.count; i < RowCount; i++)
|
|
786
|
+
{
|
|
787
|
+
for (let j : number = 0, ColCount = this.columns.count; j < ColCount; j++)
|
|
788
|
+
{
|
|
789
|
+
if (this.rows.getRow(i).cells.getCell(j).columnSpan > 1)
|
|
790
|
+
{
|
|
791
|
+
let total : number = widths[j];
|
|
792
|
+
for (let k : number = 1; k < this.rows.getRow(i).cells.getCell(j).columnSpan; k++)
|
|
793
|
+
{
|
|
794
|
+
total += widths[j + k];
|
|
795
|
+
}
|
|
796
|
+
// if (this.rows.getRow(i).cells.getCell(j).width > total)
|
|
797
|
+
// {
|
|
798
|
+
// let extendedWidth : number = this.rows.getRow(i).cells.getCell(j).width - total;
|
|
799
|
+
// extendedWidth = extendedWidth / this.rows.getRow(i).cells.getCell(j).columnSpan;
|
|
800
|
+
|
|
801
|
+
// for (let k : number = j; k < j + this.rows.getRow(i).cells.getCell(j).columnSpan; k++)
|
|
802
|
+
// widths[k] += extendedWidth;
|
|
803
|
+
// }
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
// if (this.isChildGrid && this.initialWidth != 0)
|
|
808
|
+
// {
|
|
809
|
+
// widths = this.columns.getDefaultWidths(this.initialWidth);
|
|
810
|
+
// }
|
|
811
|
+
for (let i : number = 0, count : number = this.columns.count; i < count; i++) {
|
|
812
|
+
if (this.columns.getColumn(i).width <= 0)
|
|
813
|
+
this.columns.getColumn(i).columnWidth = widths[i];
|
|
814
|
+
else if (this.columns.getColumn(i).width > 0 && !this.columns.getColumn(i).isCustomWidth)
|
|
815
|
+
this.columns.getColumn(i).columnWidth = widths[i];
|
|
816
|
+
}
|
|
817
|
+
let padding : number = 0;
|
|
818
|
+
let colWidth : number = 0;
|
|
819
|
+
let colCount : number = this.columns.count;
|
|
820
|
+
let childGridColWidth : number = 0;
|
|
821
|
+
colWidth = this.tempWidth;
|
|
822
|
+
for (let j : number = 0; j < this.columns.count; j++)
|
|
823
|
+
{
|
|
824
|
+
if (this.gridColumns.getColumn(j).width > 0 && this.gridColumns.getColumn(j).isCustomWidth)
|
|
825
|
+
{
|
|
826
|
+
colWidth -= this.gridColumns.getColumn(j).width;
|
|
827
|
+
colCount--;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
// if (this.style.cellSpacing != 0){
|
|
831
|
+
// colWidth -= this.style.cellSpacing * 2;
|
|
832
|
+
// }
|
|
833
|
+
if (colWidth > 0) {
|
|
834
|
+
if (this.ParentCell.row.grid.style.cellSpacing != 0){
|
|
835
|
+
colWidth -= this.ParentCell.row.grid.style.cellSpacing * 2;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (colWidth > padding)
|
|
839
|
+
{
|
|
840
|
+
childGridColWidth = (colWidth) / colCount;
|
|
841
|
+
if (this.ParentCell != null)
|
|
842
|
+
{
|
|
843
|
+
for (let j : number = 0; j < this.columns.count; j++)
|
|
844
|
+
{
|
|
845
|
+
if (!this.columns.getColumn(j).isCustomWidth)
|
|
846
|
+
this.columns.getColumn(j).columnWidth = childGridColWidth;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
}
|