@syncfusion/ej2-pdf-export 22.1.34 → 22.1.39

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.
Files changed (169) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/ej2-pdf-export.min.js +2 -2
  3. package/dist/ej2-pdf-export.umd.min.js +2 -2
  4. package/dist/ej2-pdf-export.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-pdf-export.es2015.js +748 -93
  6. package/dist/es6/ej2-pdf-export.es2015.js.map +1 -1
  7. package/dist/es6/ej2-pdf-export.es5.js +933 -225
  8. package/dist/es6/ej2-pdf-export.es5.js.map +1 -1
  9. package/dist/global/ej2-pdf-export.min.js +2 -2
  10. package/dist/global/ej2-pdf-export.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +5 -5
  13. package/src/implementation/document/pdf-catalog.d.ts +7 -0
  14. package/src/implementation/document/pdf-catalog.js +16 -0
  15. package/src/implementation/document/pdf-document-base.d.ts +13 -0
  16. package/src/implementation/document/pdf-document-base.js +18 -0
  17. package/src/implementation/document/pdf-viewer-preferences.d.ts +467 -0
  18. package/src/implementation/document/pdf-viewer-preferences.js +624 -0
  19. package/src/implementation/input-output/pdf-dictionary-properties.d.ts +55 -0
  20. package/src/implementation/input-output/pdf-dictionary-properties.js +55 -0
  21. package/dist/ts/implementation/actions/action.ts +0 -76
  22. package/dist/ts/implementation/actions/uri-action.ts +0 -52
  23. package/dist/ts/implementation/annotations/action-link-annotation.ts +0 -43
  24. package/dist/ts/implementation/annotations/annotation-collection.ts +0 -159
  25. package/dist/ts/implementation/annotations/annotation.ts +0 -241
  26. package/dist/ts/implementation/annotations/document-link-annotation.ts +0 -118
  27. package/dist/ts/implementation/annotations/link-annotation.ts +0 -32
  28. package/dist/ts/implementation/annotations/pdf-text-web-link.ts +0 -265
  29. package/dist/ts/implementation/annotations/uri-annotation.ts +0 -86
  30. package/dist/ts/implementation/collections/dictionary.ts +0 -150
  31. package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +0 -125
  32. package/dist/ts/implementation/collections/utils.ts +0 -38
  33. package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +0 -39
  34. package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +0 -108
  35. package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +0 -127
  36. package/dist/ts/implementation/document/automatic-fields/composite-field.ts +0 -76
  37. package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +0 -37
  38. package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +0 -75
  39. package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +0 -157
  40. package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +0 -82
  41. package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +0 -60
  42. package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +0 -48
  43. package/dist/ts/implementation/document/pdf-catalog.ts +0 -52
  44. package/dist/ts/implementation/document/pdf-document-base.ts +0 -166
  45. package/dist/ts/implementation/document/pdf-document-template.ts +0 -310
  46. package/dist/ts/implementation/document/pdf-document.ts +0 -342
  47. package/dist/ts/implementation/drawing/pdf-drawing.ts +0 -218
  48. package/dist/ts/implementation/general/enum.ts +0 -21
  49. package/dist/ts/implementation/general/functions/pdf-function.ts +0 -66
  50. package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +0 -62
  51. package/dist/ts/implementation/general/pdf-cache-collection.ts +0 -97
  52. package/dist/ts/implementation/general/pdf-collection.ts +0 -41
  53. package/dist/ts/implementation/general/pdf-destination.ts +0 -170
  54. package/dist/ts/implementation/graphics/brushes/enum.ts +0 -237
  55. package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +0 -294
  56. package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +0 -68
  57. package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +0 -2438
  58. package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +0 -295
  59. package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +0 -311
  60. package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +0 -406
  61. package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +0 -290
  62. package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +0 -107
  63. package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +0 -304
  64. package/dist/ts/implementation/graphics/constants.ts +0 -31
  65. package/dist/ts/implementation/graphics/enum.ts +0 -413
  66. package/dist/ts/implementation/graphics/figures/arc.ts +0 -133
  67. package/dist/ts/implementation/graphics/figures/base/draw-element.ts +0 -59
  68. package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +0 -260
  69. package/dist/ts/implementation/graphics/figures/base/fill-element.ts +0 -72
  70. package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +0 -34
  71. package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +0 -69
  72. package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +0 -276
  73. package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +0 -205
  74. package/dist/ts/implementation/graphics/figures/ellipse-part.ts +0 -76
  75. package/dist/ts/implementation/graphics/figures/enum.ts +0 -80
  76. package/dist/ts/implementation/graphics/figures/layout-element.ts +0 -132
  77. package/dist/ts/implementation/graphics/figures/path.ts +0 -646
  78. package/dist/ts/implementation/graphics/figures/pdf-template.ts +0 -205
  79. package/dist/ts/implementation/graphics/figures/rectangle-area.ts +0 -108
  80. package/dist/ts/implementation/graphics/figures/text-element.ts +0 -445
  81. package/dist/ts/implementation/graphics/fonts/enum.ts +0 -385
  82. package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +0 -248
  83. package/dist/ts/implementation/graphics/fonts/pdf-font.ts +0 -316
  84. package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +0 -606
  85. package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +0 -243
  86. package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +0 -474
  87. package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +0 -165
  88. package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +0 -958
  89. package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +0 -374
  90. package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +0 -255
  91. package/dist/ts/implementation/graphics/fonts/string-layouter.ts +0 -617
  92. package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +0 -275
  93. package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +0 -206
  94. package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +0 -18
  95. package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +0 -18
  96. package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +0 -14
  97. package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +0 -26
  98. package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +0 -35
  99. package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +0 -94
  100. package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +0 -56
  101. package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +0 -10
  102. package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +0 -14
  103. package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +0 -106
  104. package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +0 -58
  105. package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +0 -33
  106. package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +0 -22
  107. package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +0 -42
  108. package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +0 -1254
  109. package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +0 -26
  110. package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +0 -26
  111. package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +0 -577
  112. package/dist/ts/implementation/graphics/images/byte-array.ts +0 -137
  113. package/dist/ts/implementation/graphics/images/image-decoder.ts +0 -439
  114. package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +0 -110
  115. package/dist/ts/implementation/graphics/images/pdf-image.ts +0 -132
  116. package/dist/ts/implementation/graphics/pdf-color.ts +0 -478
  117. package/dist/ts/implementation/graphics/pdf-graphics.ts +0 -2424
  118. package/dist/ts/implementation/graphics/pdf-margins.ts +0 -124
  119. package/dist/ts/implementation/graphics/pdf-pen.ts +0 -370
  120. package/dist/ts/implementation/graphics/pdf-resources.ts +0 -300
  121. package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +0 -246
  122. package/dist/ts/implementation/graphics/pdf-transparency.ts +0 -93
  123. package/dist/ts/implementation/graphics/unit-convertor.ts +0 -96
  124. package/dist/ts/implementation/input-output/big-endian-writer.ts +0 -121
  125. package/dist/ts/implementation/input-output/cross-table.ts +0 -21
  126. package/dist/ts/implementation/input-output/enum.ts +0 -16
  127. package/dist/ts/implementation/input-output/pdf-cross-table.ts +0 -524
  128. package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +0 -515
  129. package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +0 -194
  130. package/dist/ts/implementation/input-output/pdf-operators.ts +0 -363
  131. package/dist/ts/implementation/input-output/pdf-stream-writer.ts +0 -681
  132. package/dist/ts/implementation/input-output/pdf-writer.ts +0 -88
  133. package/dist/ts/implementation/pages/enum.ts +0 -201
  134. package/dist/ts/implementation/pages/page-added-event-arguments.ts +0 -39
  135. package/dist/ts/implementation/pages/pdf-document-page-collection.ts +0 -180
  136. package/dist/ts/implementation/pages/pdf-page-base.ts +0 -181
  137. package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +0 -348
  138. package/dist/ts/implementation/pages/pdf-page-layer.ts +0 -271
  139. package/dist/ts/implementation/pages/pdf-page-settings.ts +0 -192
  140. package/dist/ts/implementation/pages/pdf-page-size.ts +0 -162
  141. package/dist/ts/implementation/pages/pdf-page-template-element.ts +0 -659
  142. package/dist/ts/implementation/pages/pdf-page.ts +0 -235
  143. package/dist/ts/implementation/pages/pdf-section-collection.ts +0 -187
  144. package/dist/ts/implementation/pages/pdf-section-page-collection.ts +0 -61
  145. package/dist/ts/implementation/pages/pdf-section-templates.ts +0 -96
  146. package/dist/ts/implementation/pages/pdf-section.ts +0 -644
  147. package/dist/ts/implementation/primitives/pdf-array.ts +0 -386
  148. package/dist/ts/implementation/primitives/pdf-boolean.ts +0 -119
  149. package/dist/ts/implementation/primitives/pdf-dictionary.ts +0 -513
  150. package/dist/ts/implementation/primitives/pdf-name.ts +0 -218
  151. package/dist/ts/implementation/primitives/pdf-number.ts +0 -165
  152. package/dist/ts/implementation/primitives/pdf-reference.ts +0 -430
  153. package/dist/ts/implementation/primitives/pdf-stream.ts +0 -336
  154. package/dist/ts/implementation/primitives/pdf-string.ts +0 -397
  155. package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +0 -2027
  156. package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +0 -1193
  157. package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +0 -206
  158. package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +0 -470
  159. package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +0 -853
  160. package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +0 -240
  161. package/dist/ts/implementation/structured-elements/grid/styles/style.ts +0 -424
  162. package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +0 -16
  163. package/dist/ts/interfaces/i-pdf-cache.ts +0 -23
  164. package/dist/ts/interfaces/i-pdf-changable.ts +0 -17
  165. package/dist/ts/interfaces/i-pdf-clonable.ts +0 -12
  166. package/dist/ts/interfaces/i-pdf-primitives.ts +0 -45
  167. package/dist/ts/interfaces/i-pdf-true-type-font.ts +0 -48
  168. package/dist/ts/interfaces/i-pdf-wrapper.ts +0 -13
  169. package/dist/ts/interfaces/i-pdf-writer.ts +0 -29
@@ -1,2027 +0,0 @@
1
- /**
2
- * PdfGridLayouter.ts class for EJ2-PDF
3
- */
4
- import { PdfFont } from './../../../graphics/fonts/pdf-font';
5
- import { PdfGrid } from '../pdf-grid';
6
- import { PdfStringFormat } from './../../../graphics/fonts/pdf-string-format';
7
- import { SizeF, RectangleF, PointF } from './../../../drawing/pdf-drawing';
8
- import { PdfBorders } from '../styles/pdf-borders';
9
- import { PdfLayoutType, PdfLayoutBreakType } from './../../../graphics/figures/enum';
10
- import { PdfLayoutResult, PdfLayoutParams, PdfLayoutFormat, ElementLayouter } from './../../../graphics/figures/base/element-layouter';
11
- import { PdfGraphics } from './../../../graphics/pdf-graphics';
12
- import { PdfPage } from './../../../pages/pdf-page';
13
- import { PdfGridColumnCollection, PdfGridColumn } from '../pdf-grid-column';
14
- import { PdfGridCell } from '../pdf-grid-cell';
15
- import { PdfGridRow } from '../pdf-grid-row';
16
- import { PdfGridStyle, PdfGridCellStyle } from '../styles/style';
17
- import { PdfGridRowCollection, PdfGridHeaderCollection } from '../pdf-grid-row';
18
- import { PdfHorizontalOverflowType } from '../styles/style';
19
- import { TemporaryDictionary } from './../../../collections/object-object-pair/dictionary';
20
- import { PdfStringLayoutResult, PdfStringLayouter } from './../../../graphics/fonts/string-layouter';
21
- import { PdfDocument } from './../../../document/pdf-document';
22
- import { PdfSection } from './../../../pages/pdf-section';
23
- /**
24
- * Class `lay outing the text`.
25
- *
26
- */
27
- export class PdfGridLayouter extends ElementLayouter {
28
- // Fields
29
- /**
30
- * `Text` data.
31
- * @private
32
- */
33
- private text : string;
34
- // private layoutElement : PdfLayoutElement;
35
- /**
36
- * Pdf `font`.
37
- * @private
38
- */
39
- private font : PdfFont;
40
- /**
41
- * String `format`.
42
- * @private
43
- */
44
- private format : PdfStringFormat;
45
- /**
46
- * `Size` of the text.
47
- * @private
48
- */
49
- private gridColumns : PdfGridColumnCollection;
50
- /**
51
- * @hidden
52
- * @private
53
- */
54
- private gridRows : PdfGridRowCollection;
55
- /**
56
- * @hidden
57
- * @private
58
- */
59
- private gridHeaders : PdfGridHeaderCollection;
60
- /**
61
- * @hidden
62
- * @private
63
- */
64
- private gridInitialWidth : number = 0;
65
- /**
66
- * @hidden
67
- * @private
68
- */
69
- public isComplete : boolean;
70
- /**
71
- * @hidden
72
- * @private
73
- */
74
- private gridSize : SizeF = new SizeF(0, 0);
75
- private parentCell : PdfGridCell;
76
- private parentCellIndex : number = 0;
77
- public tempWidth : number = 0;
78
- private childheight : number = 0;
79
- /**
80
- * The event raised on `starting cell drawing`.
81
- * @event
82
- * @private
83
- */
84
- public beginCellDraw : Function;
85
- /**
86
- * The event raised on `ending cell drawing`.
87
- * @event
88
- * @private
89
- */
90
- public endCellDraw : Function;
91
- /**
92
- * The event raised on `begin cell lay outing`.
93
- * @event
94
- * @private
95
- */
96
- public beginPageLayout : Function;
97
- /**
98
- * The event raised on `end cell lay outing`.
99
- * @event
100
- * @private
101
- */
102
- public endPageLayout : Function;
103
-
104
- /**
105
- * @hidden
106
- * @private
107
- */
108
- /**
109
- * @hidden
110
- * @private
111
- */
112
- private gridLocation : RectangleF;
113
- /**
114
- * @hidden
115
- * @private
116
- */
117
- private gridStyle : PdfGridStyle;
118
- /**
119
- * @hidden
120
- * @private
121
- */
122
- private pageWidth : boolean;
123
- /**
124
- * Check weather it is `child grid or not`.
125
- * @private
126
- */
127
- private isChildGrid : boolean = false;
128
- /**
129
- * @hidden
130
- * @private
131
- */
132
- public rowLayoutBoundsWidth : number;
133
- /**
134
- * @hidden
135
- * @private
136
- */
137
- public hasRowSpanSpan : boolean = false;
138
- /**
139
- * @hidden
140
- * @private
141
- */
142
- public isRearranged : boolean = false;
143
- /**
144
- * @hidden
145
- * @private
146
- */
147
- private bRepeatHeader : boolean;
148
- /**
149
- * @hidden
150
- * @private
151
- */
152
- private pageBounds : RectangleF = new RectangleF();
153
- //GridLayouter-Fields
154
- /**
155
- * @hidden
156
- * @private
157
- */
158
- private currentPage : PdfPage;
159
- /**
160
- * @hidden
161
- * @private
162
- */
163
- private currentPageBounds : SizeF;
164
- /**
165
- * @hidden
166
- * @private
167
- */
168
- private currentBounds : RectangleF;
169
- /**
170
- * @hidden
171
- * @private
172
- */
173
- private listOfNavigatePages : number[] = [];
174
- /**
175
- * @hidden
176
- * @private
177
- */
178
- private startLocation : PointF;
179
- /**
180
- * @hidden
181
- * @private
182
- */
183
- private hType : PdfHorizontalOverflowType;
184
- /**
185
- * @hidden
186
- * @private
187
- */
188
- private flag : boolean = true;
189
- /**
190
- * @hidden
191
- * @private
192
- */
193
- private columnRanges : number[][] = [];
194
- /**
195
- * @hidden
196
- * @private
197
- */
198
- private cellStartIndex : number;
199
- /**
200
- * @hidden
201
- * @private
202
- */
203
- private cellEndIndex : number;
204
- /**
205
- * @hidden
206
- * @private
207
- */
208
- private currentRowIndex : number;
209
- /**
210
- * @hidden
211
- * @private
212
- */
213
- public static repeatRowIndex : number = -1;
214
- /**
215
- * @hidden
216
- * @private
217
- */
218
- private isChanged : boolean;
219
- /**
220
- * @hidden
221
- * @private
222
- */
223
- private currentLocation : PointF = new PointF(0, 0);
224
- /**
225
- * @hidden
226
- * @private
227
- */
228
- private breakRow : boolean = true;
229
- /**
230
- * @hidden
231
- * @private
232
- */
233
- private rowBreakPageHeightCellIndex : number;
234
- private slr: PdfStringLayoutResult = null;
235
- private remainderText: string = null;
236
- private isPaginate: boolean = false;
237
- //constructor
238
- /**
239
- * Initialize a new instance for `PdfGrid` class.
240
- * @private
241
- */
242
- public constructor(baseFormat : PdfGrid) {
243
- super(baseFormat);
244
- }
245
- //Properties
246
- public get Grid() : PdfGrid {
247
- return (this.elements as PdfGrid);
248
- }
249
- /**
250
- * `Bounds` of the text.
251
- * @private
252
- */
253
- private rectangle : RectangleF;
254
- /**
255
- * Pdf page `height`.
256
- * @private
257
- */
258
- private gridHeight : number;
259
- /**
260
- * Specifies if [`isTabReplaced`].
261
- * @private
262
- */
263
- private isTabReplaced : boolean;
264
- /**
265
- * `currentGraphics` of the text.
266
- * @private
267
- */
268
- private currentGraphics : PdfGraphics;
269
- /**
270
- * Count of tab `occurance`.
271
- * @private
272
- */
273
- private tabOccuranceCount : number;
274
- /**
275
- * Checks whether the x co-ordinate is need to set as client size or not.
276
- * @hidden
277
- * @private
278
- */
279
- private isOverloadWithPosition : boolean = false;
280
- /**
281
- * Stores client size of the page if the layout method invoked with `PointF` overload.
282
- * @hidden
283
- * @private
284
- */
285
- private clientSize : SizeF;
286
- private gridLayoutFormat : PdfGridLayoutFormat;
287
- private isHeader: boolean;
288
- // Constructors
289
- /**
290
- * Initializes a new instance of the `StringLayouter` class.
291
- * @private
292
- */
293
- //Public methods
294
- /**
295
- * `Layouts` the text.
296
- * @private
297
- */
298
- /**
299
- * `Layouts` the specified graphics.
300
- * @private
301
- */
302
- /**
303
- * `Layouts` the specified graphics.
304
- * @private
305
- */
306
- /*public layout(graphics : PdfLayoutParams) : PdfLayoutResult
307
- public layout(graphics : PdfGraphics, bounds : RectangleF) : void
308
- public layout(graphics : PdfGraphics, bounds : PointF) : void
309
- public layout(graphics ?: PdfGraphics | PdfLayoutParams, bounds ?: PointF | RectangleF) : void | PdfLayoutResult {
310
- if (graphics instanceof PdfGraphics) {
311
- if (bounds instanceof PointF) {
312
- if (bounds.x === 0) {
313
- bounds.x = PdfBorders.default.right.width / 2;
314
- }
315
- if (bounds.y === 0) {
316
- bounds.y = PdfBorders.default.top.width / 2;
317
- }
318
- let boundaries : RectangleF = new RectangleF(bounds, new SizeF(0, 0));
319
- this.layout(graphics, boundaries);
320
- } else {
321
- let width : number = graphics.clientSize.width;
322
- let parameter : PdfLayoutParams = new PdfLayoutParams();
323
- parameter.bounds = bounds;
324
- this.currentGraphics = graphics;
325
- if (graphics.layer != null) {
326
- let index : number = 0;
327
- if (this.currentGraphics.page instanceof PdfPage) {
328
- index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
329
- } else {
330
- index = (this.currentGraphics.page as PdfPageBase).defaultLayerIndex;
331
- }
332
- } else {
333
- this.layoutInternal(parameter);
334
- }
335
- }
336
- }
337
- }*/
338
- /**
339
- * Gets the `format`.
340
- * @private
341
- */
342
- private getFormat(format : PdfLayoutFormat) : PdfGridLayoutFormat {
343
- let f : PdfGridLayoutFormat = format as PdfGridLayoutFormat;
344
- return f;
345
- }
346
- /**
347
- * `Layouts` the element.
348
- * @private
349
- */
350
- protected layoutInternal(param : PdfLayoutParams) : PdfLayoutResult {
351
- let format : PdfGridLayoutFormat = this.getFormat(param.format);
352
- this.gridLayoutFormat = this.getFormat(param.format);
353
- this.currentPage = param.page;
354
- if (this.currentPage !== null) {
355
- let pageHeight : number = this.currentPage.getClientSize().height;
356
- let pageWidth : number = this.currentPage.getClientSize().width;
357
- this.currentPageBounds = this.currentPage.getClientSize();
358
- } else {
359
- throw Error('Can not set page as null');
360
- //this.currentPageBounds = this.currentGraphics.clientSize;
361
- }
362
- this.currentGraphics = this.currentPage.graphics;
363
- //this.currentGraphics = (this.currentPage != null ) ? this.currentPage.graphics : this.currentGraphics;
364
- // if (this.currentGraphics.layer !== null) {
365
- // let index : number = 0;
366
- // if (this.currentGraphics.page instanceof PdfPage) {
367
- // index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
368
- // } else {
369
- // index = (this.currentGraphics.page as PdfPageBase).defaultLayerIndex;
370
- // }
371
- // this.listOfNavigatePages.push(index);
372
- // }
373
- let index : number = 0;
374
- index = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
375
- this.listOfNavigatePages.push(index);
376
- if (format != null && format.break === PdfLayoutBreakType.FitColumnsToPage) {
377
- this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y),
378
- new SizeF(this.Grid.columns.width, this.currentGraphics.clientSize.height));
379
- } else {
380
- this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), this.currentGraphics.clientSize);
381
- }
382
- //this.currentBounds = new RectangleF(new PointF(param.bounds.x, param.bounds.y), this.currentGraphics.clientSize);
383
- if (this.Grid.rows.count !== 0 ) {
384
- this.currentBounds.width = (param.bounds.width > 0) ? param.bounds.width :
385
- (this.currentBounds.width - this.Grid.rows.getRow(0).cells.getCell(0).style.borders.left.width / 2);
386
- } else if (this.Grid.headers.count !== 0) {
387
- // this.currentBounds.width = (param.bounds.width > 0) ? param.bounds.width : (this.currentBounds.width -
388
- // this.Grid.headers.getHeader(0).cells.getCell(0).style.borders.left.width / 2);
389
- this.currentBounds.width = param.bounds.width;
390
- } else {
391
- throw Error('Please add row or header into grid');
392
- }
393
- this.startLocation = new PointF(param.bounds.x, param.bounds.y);
394
- // if (this.Grid.style.allowHorizontalOverflow && this.currentBounds.width > this.currentGraphics.clientSize.width) {
395
- // this.currentBounds.width = this.currentGraphics.clientSize.width;
396
- // this.currentBounds.width -= this.currentBounds.x;
397
- // }
398
- // if (this.Grid.isChildGrid) {
399
- // this.childheight = param.bounds.height;
400
- // }
401
- // if (param.format !== null && param.format.usePaginateBounds) {
402
- // if (param.format.paginateBounds.height > 0) {
403
- // this.currentBounds.height = param.format.paginateBounds.height;
404
- // }
405
- //} else
406
- if (param.bounds.height > 0 && !this.Grid.isChildGrid) {
407
- this.currentBounds.height = param.bounds.height;
408
- }
409
- if (!this.Grid.isChildGrid) {
410
- this.hType = this.Grid.style.horizontalOverflowType;
411
- }
412
- if (!this.Grid.style.allowHorizontalOverflow) {
413
- this.columnRanges = [];
414
- if (typeof this.Grid.isChildGrid !== 'undefined' && typeof this.Grid.isChildGrid) {
415
- this.Grid.measureColumnsWidth(this.currentBounds);
416
- } else {
417
- this.Grid.measureColumnsWidth(new RectangleF(this.currentBounds.x, this.currentBounds.y, this.currentBounds.x + this.currentBounds.width, this.currentBounds.height));
418
- }
419
- this.columnRanges.push([0, this.Grid.columns.count - 1]);
420
- } else {
421
- this.Grid.measureColumnsWidth();
422
- this.determineColumnDrawRanges();
423
- }
424
- if (this.Grid.hasRowSpanSpan) {
425
- for ( let i: number = 0; i < this.Grid.rows.count; i++) {
426
- if (this.Grid.rows.getRow(i).height !== -1 && !this.Grid.rows.getRow(i).isRowHeightSet) {
427
- this.Grid.rows.getRow(i).isRowHeightSet = true;
428
- }
429
- }
430
- }
431
- let result : PdfGridLayoutResult = this.layoutOnPage(param);
432
- return result;
433
- }
434
- // /* tslint:enable */
435
- /**
436
- * `Determines the column draw ranges`.
437
- * @private
438
- */
439
- private determineColumnDrawRanges() : void {
440
- let startColumn : number = 0;
441
- let endColumn : number = 0;
442
- let cellWidths : number = 0;
443
- let availableWidth : number = this.currentGraphics.clientSize.width - this.currentBounds.x;
444
- for (let i : number = 0; i < this.Grid.columns.count; i++) {
445
- cellWidths += this.Grid.columns.getColumn(i).width;
446
- if (cellWidths >= availableWidth) {
447
- let subWidths : number = 0;
448
- for (let j : number = startColumn; j <= i; j++) {
449
- subWidths += this.Grid.columns.getColumn(j).width;
450
- if (subWidths > availableWidth) {
451
- break;
452
- }
453
- endColumn = j;
454
- }
455
- this.columnRanges.push([startColumn, endColumn]);
456
- startColumn = endColumn + 1;
457
- endColumn = startColumn;
458
- cellWidths = (endColumn <= i) ? this.Grid.columns.getColumn(i).width : 0;
459
- }
460
- }
461
- // if (startColumn !== this.columns.Count) {
462
- this.columnRanges.push([startColumn, this.Grid.columns.count - 1 ]);
463
- // }
464
- }
465
- /**
466
- * `Layouts the on page`.
467
- * @private
468
- */
469
- private layoutOnPage(param : PdfLayoutParams) : PdfGridLayoutResult {
470
- /* tslint:disable */
471
- this.pageBounds.x = param.bounds.x;
472
- this.pageBounds.y = param.bounds.y;
473
- this.pageBounds.height = param.bounds.height;
474
- let format : PdfGridLayoutFormat = this.getFormat(param.format);
475
- let endArgs : PdfGridEndPageLayoutEventArgs = null;
476
- let result : PdfGridLayoutResult = null;
477
- let layoutedPages : TemporaryDictionary<PdfPage, number[]> = new TemporaryDictionary<PdfPage, number[]>();
478
- let startPage : PdfPage = param.page;
479
- let isParentCell : boolean = false;
480
- let cellBounds : number[] = [];
481
- for (let index : number = 0; index < this.columnRanges.length; index++) {
482
- let range : number[] = this.columnRanges[index];
483
- this.cellStartIndex = range[0];
484
- this.cellEndIndex = range[1];
485
- let returnObject : {returnValue : boolean, currentBounds : RectangleF, currentRowIndex : number }
486
- = this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex);
487
- this.currentBounds = returnObject.currentBounds;
488
- this.currentRowIndex = returnObject.currentRowIndex;
489
- // if (returnObject.returnValue) {
490
- // result = new PdfGridLayoutResult(this.currentPage, this.currentBounds);
491
- // break;
492
- // }
493
- //Draw Headers.
494
- let drawHeader : boolean;
495
- for (let i : number = 0; i < this.Grid.headers.count; i++) {
496
- let row : PdfGridRow = this.Grid.headers.getHeader(i);
497
- let headerHeight : number = this.currentBounds.y;
498
- this.isHeader = true;
499
- if (startPage != this.currentPage) {
500
- for (let k: number = this.cellStartIndex; k <= this.cellEndIndex; k++) {
501
- if (row.cells.getCell(k).isCellMergeContinue) {
502
- row.cells.getCell(k).isCellMergeContinue = false;
503
- row.cells.getCell(k).value = "";
504
- }
505
- }
506
- }
507
- // RowLayoutResult
508
- let headerResult: RowLayoutResult = this.drawRow(row);
509
- if (headerHeight === this.currentBounds.y) {
510
- drawHeader = true;
511
- if (PdfGridLayouter.repeatRowIndex === -1) {
512
- PdfGridLayouter.repeatRowIndex = i;
513
- }
514
- } else {
515
- drawHeader = false;
516
- }
517
- if (!headerResult.isFinish && startPage !== null
518
- && format.layout !== PdfLayoutType.OnePage && drawHeader) {
519
- this.startLocation.x = this.currentBounds.x;
520
- this.currentPage = this.getNextPageformat(format);
521
- this.startLocation.y = this.currentBounds.y;
522
- if (typeof format.paginateBounds !== 'undefined' && format.paginateBounds.x === 0 && format.paginateBounds.y === 0 && format.paginateBounds.width === 0 && format.paginateBounds.height === 0)
523
- this.currentBounds.x += this.startLocation.x;
524
-
525
- this.drawRow(row);
526
- }
527
- this.isHeader = false;
528
- }
529
- let i : number = 0;
530
- let length : number = this.Grid.rows.count;
531
- let repeatRow : boolean;
532
- let startingHeight : number = 0;
533
- let flag : boolean = true;
534
- //Here is to draw parent Grid and Cells
535
- cellBounds = [];
536
- //Draw row by row with the specified cell range.
537
- for (let j : number = 0; j < this.Grid.rows.count; j++) {
538
- let row : PdfGridRow = this.Grid.rows.getRow(j);
539
- i++;
540
- this.currentRowIndex = i - 1;
541
- let originalHeight : number = this.currentBounds.y;
542
- startPage = this.currentPage;
543
- PdfGridLayouter.repeatRowIndex = -1;
544
- if(flag && row.grid.isChildGrid)
545
- {
546
- startingHeight = originalHeight;
547
- flag = false;
548
- }
549
- let rowResult : RowLayoutResult = null;
550
- ///rowResult = this.drawRow(row);
551
- /*if(!row.isrowFinish) {
552
- if(!row.grid.isgridSplit){
553
- rowResult = this.drawRow(row);
554
- row.isrowFinish = true;
555
- row.isrowDraw = true;
556
- } else {
557
- if(!row.isrowDraw){
558
- rowResult = this.drawRow(row);
559
- row.isrowFinish = true;
560
- row.isrowDraw = true;
561
- row.grid.isgridSplit = false;
562
- } else {
563
- rowResult = null;
564
- break;
565
- }
566
- }
567
- }
568
- else {
569
- //row.isrowFinish = false;
570
- //rowResult = this.drawRow(row);
571
- rowResult = null;
572
- break;
573
-
574
- } */
575
- if(this.Grid.splitChildRowIndex == -1){
576
- rowResult = this.drawRow(row);
577
- row.isrowFinish = true;
578
- }
579
- else {
580
- if(row.grid.ParentCell.row.grid.isGridSplit && this.Grid.splitChildRowIndex <= row.rowIndex){
581
- rowResult = this.drawRow(row);
582
- row.isrowFinish = true;
583
- } else if(row.isrowFinish) {
584
- continue;
585
- }else{
586
- break;
587
- }
588
-
589
- }
590
- //rowResult = this.drawRow(row);
591
- cellBounds.push(rowResult.bounds.width);
592
- /*if (row.isRowBreaksNextPage)
593
- {
594
- let x : number = 0;
595
- for (let l : number = 0; l < row.cells.count; l++)
596
- {
597
- let isNestedRowBreak : boolean = false;
598
- if (row.height == row.cells.getCell(l).height)
599
- {
600
- let n : number;
601
- let grid : PdfGrid = row.cells.getCell(l).value as PdfGrid;
602
- for (let m : number = grid.rows.count; 0 < m; m--)
603
- {
604
- if ((grid.rows.getRow(m - 1).rowBreakHeight > 0))
605
- {
606
- isNestedRowBreak = true;
607
- break;
608
- }
609
- if (grid.rows.getRow(m - 1).isRowBreaksNextPage)
610
- {
611
- row.rowBreakHeightValue = grid.rows.getRow(m - 1).rowBreakHeightValue;
612
- break;
613
- }
614
- row.rowBreakHeightValue += grid.rows.getRow(m - 1).height;
615
- }
616
- }
617
- if (isNestedRowBreak)
618
- break;
619
- }
620
- for (let j : number = 0; j < row.cells.count; j++)
621
- {
622
-
623
- if (row.height > row.cells.getCell(j).height)
624
- {
625
- row.cells.getCell(j).value = " ";
626
- let rect : RectangleF ;
627
- let page : PdfPage = this.getNextPage(this.currentPage);
628
- let section : PdfSection = this.currentPage.section;
629
- let index : number = section.indexOf(page);
630
- for (let k : number = 0; k < (section.count - 1) - index; k++)
631
- {
632
- rect = new RectangleF(x, 0, row.grid.columns.getColumn(j).width, page.getClientSize().height);
633
- PdfGridLayouter.repeatRowIndex = -1;
634
- row.cells.getCell(j).draw(page.graphics, rect, false);
635
- page = this.getNextPage(page);
636
- }
637
- rect = new RectangleF(x, 0, row.grid.columns.getColumn(j).width, row.rowBreakHeightValue);
638
-
639
- row.cells.getCell(j).draw(page.graphics, rect, false);
640
- }
641
- x += row.grid.columns.getColumn(j).width;
642
- }
643
- }*/
644
- //if height remains same, it is understood that row is not drawn in the page
645
- if (originalHeight === this.currentBounds.y) {
646
- repeatRow = true;
647
- PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
648
- } else {
649
- repeatRow = false;
650
- PdfGridLayouter.repeatRowIndex = -1;
651
- }
652
- while (!rowResult.isFinish && startPage != null)
653
- {
654
- let tempResult : PdfGridLayoutResult = this.getLayoutResult();
655
- /*if (startPage != this.currentPage)
656
- {
657
- if (row.grid.isChildGrid && row.grid.ParentCell != null)
658
- {
659
- let bounds : RectangleF= new RectangleF(new PointF(format.paginateBounds.x,format.paginateBounds.y), new SizeF(param.bounds.width, tempResult.bounds.height));
660
- bounds.x += param.bounds.x;
661
- if (row.grid.ParentCell.row.grid.style.cellPadding != null)
662
- {
663
- bounds.y += row.grid.ParentCell.row.grid.style.cellPadding.top;
664
- if (bounds.height > this.currentPageBounds.height)
665
- {
666
- bounds.height = this.currentPageBounds.height - bounds.y;
667
- bounds.height -= (row.grid.ParentCell.row.grid.style.cellPadding.bottom);
668
- }
669
- }
670
- // Draw border for cells in the nested grid cell's row.
671
- for (let c : number = 0; c < row.cells.count; c++)
672
- {
673
- let cell : PdfGridCell = row.cells.getCell(c);
674
- let cellWidth : number= 0;
675
- if (cell.columnSpan > 1)
676
- {
677
- for (; c < cell.columnSpan; c++)
678
- cellWidth += row.grid.columns.getColumn(c).width;
679
- }
680
- else
681
- cellWidth = Math.max(cell.width, row.grid.columns.getColumn(c).width);
682
- cell.drawCellBorders(this.currentGraphics, new RectangleF(new PointF(bounds.x,bounds.y), new SizeF(cellWidth, bounds.height)));
683
- bounds.x += cellWidth;
684
- c += (cell.columnSpan - 1);
685
- }
686
- }
687
- }
688
- */
689
- endArgs = this.raisePageLayouted(tempResult);
690
- if (endArgs.cancel || repeatRow)
691
- break;
692
- else if (this.Grid.allowRowBreakAcrossPages )
693
- {
694
- //If there is no space in the current page, add new page and then draw the remaining row.
695
- this.currentPage = this.getNextPageformat(format);
696
- originalHeight = this.currentBounds.y;
697
- let location : PointF = new PointF(PdfBorders.default.right.width / 2, PdfBorders.default.top.width / 2);
698
- if ((format.paginateBounds.x === 0 && format.paginateBounds.y === 0 && format.paginateBounds.width === 0 &&
699
- format.paginateBounds.height === 0 ) && (this.startLocation.x === location.x && this.startLocation.y === location.y)) {
700
- this.currentBounds.x += this.startLocation.x;
701
- this.currentBounds.y += this.startLocation.y;
702
- }
703
- if (this.isPaginate) {
704
- this.startLocation.y = this.currentBounds.y;
705
- this.isPaginate = false;
706
- }
707
- if (this.Grid.isChildGrid && row.grid.ParentCell != null)
708
- {
709
- if (this.Grid.ParentCell.row.grid.style.cellPadding != null)
710
- {
711
- if (row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top < this.currentBounds.height)
712
- {
713
- this.currentBounds.y = this.Grid.ParentCell.row.grid.style.cellPadding.top;
714
- }
715
- }
716
- }
717
-
718
- if (row.grid.ParentCell != null)
719
- {
720
- row.grid.ParentCell.row.isRowBreaksNextPage = true;
721
- row.grid.ParentCell.row.rowBreakHeightValue = row.rowBreakHeight + this.Grid.ParentCell.row.grid.style.cellPadding.top + this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
722
-
723
- for ( let i : number = row.rowIndex + 1; i<row.grid.rows.count;i++){
724
- row.grid.ParentCell.row.rowBreakHeightValue += row.grid.rows.getRow(i).height;
725
- }
726
- //row.rowBreakHeight = row.grid.ParentCell.row.rowBreakHeightValue;
727
- }
728
-
729
- /*if (row.noOfPageCount > 1)
730
- {
731
- let temp : number = row.rowBreakHeightValue;
732
- for (let j : number = 1; j < row.noOfPageCount; j++)
733
- {
734
- row.rowBreakHeightValue = 0;
735
- row.height = ((row.noOfPageCount - 1) * this.currentPage.getClientSize().height);
736
- this.drawRow(row);
737
- this.currentPage = this.getNextPageformat(format);
738
- startPage = this.currentPage;
739
- }
740
- row.rowBreakHeightValue = temp;
741
- row.noOfPageCount = 1;
742
- rowResult = this.drawRow(row);
743
- } else {
744
- rowResult = this.drawRow(row);
745
- }
746
- /*if(row.grid.isChildGrid){
747
- row.isrowFinish = false;
748
- row.isrowDraw = false;
749
- row.grid.isgridSplit = true;
750
- row.grid.ParentCell.row.grid.isgridSplit = true;
751
- //rowResult.isFinish = false;
752
- break;
753
- }*/
754
-
755
- if(row.grid.isChildGrid){
756
- //row.grid.isgridSplit = true;
757
- row.isrowFinish = false;
758
- //row.grid.ParentCell.row.grid.isgridSplit = true;
759
- row.grid.splitChildRowIndex = row.rowIndex;
760
- row.grid.ParentCell.row.grid.splitChildRowIndex = row.grid.ParentCell.row.rowIndex;
761
- if(row.grid.ParentCell.row.grid.isGridSplit)
762
- {
763
- row.grid.ParentCell.row.noOfPageCount+= 1;
764
- row.grid.ParentCell.row.grid.isGridSplit = false;
765
- }
766
- break;
767
- }
768
- if (row.noOfPageCount <1)
769
- {
770
- if(row.grid.splitChildRowIndex != -1){
771
- row.grid.isGridSplit = true;
772
- }
773
- if (row.style.border != null && ((row.style.border.left != null && row.style.border.left.width !== 1)
774
- || (row.style.border.top != null && row.style.border.top.width !== 1))) {
775
- let x : number = row.style.border.left.width / 2;
776
- let y : number = row.style.border.top.width / 2;
777
- if (this.currentBounds.x === PdfBorders.default.right.width / 2 && this.currentBounds.y === PdfBorders.default.right.width / 2) {
778
- let newBound : RectangleF = new RectangleF(x, y, this.currentBounds.width, this.currentBounds.height);
779
- this.currentBounds = newBound;
780
- }
781
- }
782
- if (this.Grid.repeatHeader) {
783
- for (let j : number = 0; j < this.Grid.headers.count; j++) {
784
- let headerRepeat : PdfGridRow = this.Grid.headers.getHeader(j);
785
- this.drawRow(headerRepeat);
786
- }
787
- }
788
- rowResult = this.drawRow(row);
789
- if(row.noOfPageCount >= 1){
790
- let temp : number = row.rowBreakHeightValue;
791
- for (let j : number = 0; j < row.noOfPageCount; j++)
792
- {
793
- //this.currentPage.section.add();
794
- let tempResult1 : PdfGridLayoutResult = this.getLayoutResult();
795
- endArgs = this.raisePageLayouted(tempResult1);
796
-
797
- this.currentPage = this.getNextPageformat(format);
798
- originalHeight = this.currentBounds.y;
799
- //row.rowBreakHeightValue = 0;
800
- if(row.grid.splitChildRowIndex != -1){
801
- row.grid.isGridSplit = true;
802
- }
803
- this.currentBounds.y = 0.5;
804
- if (this.Grid.repeatHeader) {
805
- for (let i : number = 0; i < this.Grid.headers.count; i++) {
806
- let header : PdfGridRow = this.Grid.headers.getHeader(i);
807
- this.drawRow(header);
808
- }
809
- }
810
- //row.height = ((row.noOfPageCount - 1) * this.currentPage.getClientSize().height);
811
- this.drawRow(row);
812
-
813
- }
814
- // row.rowBreakHeight = temp;
815
- // row.noOfPageCount = 1;
816
- // rowResult = this.drawRow(row);
817
- }
818
- row.grid.splitChildRowIndex = -1;
819
- row.grid.isGridSplit = false;
820
- rowResult.isFinish = this.checkIsFisished(row);
821
- //row.NestedGridLayoutResult.bounds.height = row.rowBreakHeightValue;
822
- //this.currentBounds.y = rowResult.bounds.y;
823
- for(let i : number = 0; i<row.cells.count;i++){
824
- if(row.cells.getCell(i).value instanceof PdfGrid){
825
- (row.cells.getCell(i).value as PdfGrid).splitChildRowIndex = -1; }
826
- }
827
- }
828
-
829
- }
830
- // else if (!this.Grid.allowRowBreakAcrossPages && i < length)
831
- // {
832
- // this.currentPage = this.getNextPageformat(format);
833
- // break;
834
- // }
835
- // else if (i >= length)
836
- // break;
837
- }
838
- if (!rowResult.isFinish && startPage !== null && format.layout !== PdfLayoutType.OnePage && repeatRow) {
839
- // During pagination, cell position is maintained here.
840
- this.startLocation.x = this.currentBounds.x;
841
- let isAddNextPage : boolean = false;
842
- this.currentPage = this.getNextPageformat(format);
843
- /*if (!this.Grid.isSingleGrid)
844
- {
845
- for ( let j : number= 0; j < this.Grid.rows.count; j++)
846
- {
847
- let isWidthGreaterthanParent : boolean = false;
848
- for (let k : number = 0; k < this.Grid.rows.getRow(j).cells.count; k++)
849
- {
850
- if (this.Grid.rows.getRow(j).cells.getCell(k).width > this.currentPageBounds.width)
851
- isWidthGreaterthanParent = true;
852
- }
853
- if (isWidthGreaterthanParent && this.Grid.rows.getRow(j).cells.getCell(this.rowBreakPageHeightCellIndex).pageCount > 0)
854
- {
855
- isAddNextPage = true;
856
- }
857
- }
858
- }
859
- if (!this.Grid.isRearranged && isAddNextPage)
860
- {
861
- let section : PdfSection = this.currentPage.section;
862
-
863
- //this.currentPage = section.add();
864
-
865
- this.currentGraphics = this.currentPage.graphics;
866
- this.currentBounds = new RectangleF(new PointF(0,0), this.currentPage.getClientSize());
867
-
868
- let pageindex : number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
869
- }
870
- else
871
- {
872
- this.currentPage = this.getNextPageformat(format);
873
- }
874
- if (format.paginateBounds.y == 0)
875
- this.currentBounds.y = PdfBorders.default.top.width/2;
876
- else
877
- {
878
- this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
879
-
880
- }*/
881
- if (this.raiseBeforePageLayout(this.currentPage, this.currentBounds, this.currentRowIndex).returnValue) {
882
- break;
883
- }
884
- if ((param.format !== null) && !param.format.usePaginateBounds && param.bounds !== null &&
885
- param.bounds.height > 0 && !this.Grid.isChildGrid) {
886
- this.currentBounds.height = param.bounds.height;
887
- }
888
- if (typeof param.format !== 'undefined' && param.format != null && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && !(param.format.paginateBounds.x === 0 && param.format.paginateBounds.y === 0 && param.format.paginateBounds.width === 0 && param.format.paginateBounds.height === 0) && param.format.paginateBounds.y === 0) {
889
- this.currentBounds.y = PdfBorders.default.top.width / 2;
890
- } else {
891
- this.currentBounds.y = format == null ? 0 : format.paginateBounds.y;
892
- if (format != null && (format.paginateBounds.x !== 0 || format.paginateBounds.y !== 0 || format.paginateBounds.height !== 0 || format.paginateBounds.width !== 0)) {
893
- this.currentBounds.x = format.paginateBounds.x;
894
- this.currentBounds.width = format.paginateBounds.width;
895
- this.currentBounds.height = format.paginateBounds.height;
896
- }
897
- }
898
- if (typeof param.format !== 'undefined' && (param.format !== null) && typeof param.format.usePaginateBounds !== 'undefined' && !param.format.usePaginateBounds && param.bounds !== null &&
899
- param.bounds.y > 0 && !this.Grid.isChildGrid) {
900
- this.currentBounds.y = param.bounds.y;
901
- }
902
- this.startLocation.y = this.currentBounds.y;
903
- if ((format.paginateBounds.x === format.paginateBounds.y) &&
904
- (format.paginateBounds.y === format.paginateBounds.height) &&
905
- (format.paginateBounds.height === format.paginateBounds.width) && (format.paginateBounds.width === 0)) {
906
- this.currentBounds.x += this.startLocation.x;
907
- }
908
- if (this.currentBounds.x === PdfBorders.default.left.width / 2 ) {
909
- this.currentBounds.y += this.startLocation.x;
910
- }
911
- if (this.Grid.repeatHeader) {
912
- for (let i : number = 0; i < this.Grid.headers.count; i++) {
913
- let header : PdfGridRow = this.Grid.headers.getHeader(i);
914
- this.drawRow(header);
915
- }
916
- }
917
- this.drawRow(row);
918
- if (this.currentPage !== null && !layoutedPages.containsKey(this.currentPage)) {
919
- layoutedPages.add(this.currentPage, range);
920
- }
921
- }
922
- if (row.NestedGridLayoutResult != null)
923
- {
924
- // Position for next row in the grid.
925
- this.currentPage = row.NestedGridLayoutResult.page;
926
- this.currentGraphics = this.currentPage.graphics; //If not, next row will not be drawn in the layouted page.
927
- this.startLocation = new PointF(row.NestedGridLayoutResult.bounds.x,row.NestedGridLayoutResult.bounds.y);
928
- let recalHeight : number = this.ReCalculateHeight(row,row.NestedGridLayoutResult.bounds.height);
929
- this.currentBounds.y = recalHeight;
930
- //this.currentBounds.y = row.NestedGridLayoutResult.bounds.height;
931
- if (startPage != this.currentPage)
932
- {
933
- let secion : PdfSection= this.currentPage.section;
934
- let startIndex : number = secion.indexOf(startPage) + 1;
935
- let endIndex : number = secion.indexOf(this.currentPage);
936
-
937
- for (let page : number = startIndex; page < endIndex + 1; page++)
938
- {
939
- let pageGraphics : PdfGraphics = this.currentPage.graphics;
940
- let location : PointF = new PointF(format.paginateBounds.x,format.paginateBounds.y);
941
-
942
- let height : number = page == endIndex ? (row.NestedGridLayoutResult.bounds.height-param.bounds.y) :
943
- (this.currentBounds.height - location.y);
944
- if (height <= pageGraphics.clientSize.height)
945
- height += param.bounds.y;
946
- // if (row.grid.isChildGrid && row.grid.ParentCell != null)
947
- // location.x += param.bounds.x;
948
- location.y = format == null ? 0.5 : format.paginateBounds.y;
949
-
950
- // Draw border for last paginated row containing nested grid.
951
- for (let c : number = 0; c < row.cells.count; c++)
952
- {
953
- let cell : PdfGridCell = row.cells.getCell(c);
954
- let cellWidth : number = 0;
955
- let totalwidth : number = 0;
956
- if (cell.value instanceof PdfGrid)
957
- {
958
- for(let i : number =0 ; i < cell.value.columns.count; i++)
959
- {
960
- totalwidth += cell.value.columns.getColumn(i).columnWidth;
961
- }
962
- } else {
963
- totalwidth = cell.width;
964
- }
965
- // if (cell.columnSpan > 1)
966
- // {
967
- // for (; c < cell.columnSpan; c++)
968
- // cellWidth += row.grid.columns.getColumn(c).width;
969
- // }
970
- // else
971
- cellWidth = Math.max(totalwidth, row.grid.columns.getColumn(c).width);
972
-
973
- cell.drawCellBorders(pageGraphics, new RectangleF(location, new SizeF(cellWidth, height)));
974
- location.x += cellWidth;
975
- c += (cell.columnSpan - 1);
976
- }
977
- }
978
-
979
- // So, nested grid drawing is completed for the current row. Update page.
980
- // Otherwise, the next nested grid of the parent will draw borders from start.
981
- startPage = this.currentPage;
982
- }
983
- }
984
- }
985
- let isPdfGrid : boolean = false;
986
- let maximumCellBoundsWidth : number = 0;
987
- if (cellBounds.length > 0) {
988
- maximumCellBoundsWidth = cellBounds[0];
989
- }
990
- let largeNavigatePage : number[][] = [[1, 2]];
991
- for ( let c:number = 0; c < this.Grid.rows.count; c++)
992
- {
993
-
994
- if (this.cellEndIndex != -1 && this.Grid.rows.getRow(c).cells.getCell(this.cellEndIndex).value instanceof PdfGrid)
995
- {
996
- let grid: PdfGrid = this.Grid.rows.getRow(c).cells.getCell(this.cellEndIndex).value as PdfGrid;
997
- this.rowLayoutBoundsWidth= grid.rowLayoutBoundsWidth;
998
- isPdfGrid = true;
999
- // if (largeNavigatePage[0][0] < grid.listOfNavigatePages.length)
1000
- // {
1001
- // largeNavigatePage[0][0] = grid.listOfNavigatePages.length;
1002
- // largeNavigatePage[0][1] = cellBounds[c];
1003
- // }
1004
- // else if ((largeNavigatePage[0][0] == grid.listOfNavigatePages.length) && (largeNavigatePage[0][1] < cellBounds[c]))
1005
- // {
1006
- // largeNavigatePage[0][1] = cellBounds[c];
1007
- // }
1008
-
1009
- }
1010
- }
1011
- if (!isPdfGrid && cellBounds.length > 0) {
1012
- for (let c : number = 0; c < i - 1; c++) {
1013
- if (maximumCellBoundsWidth < cellBounds[c]) {
1014
- maximumCellBoundsWidth = cellBounds[c];
1015
- }
1016
- }
1017
- this.rowLayoutBoundsWidth = maximumCellBoundsWidth;
1018
- } else {
1019
- this.rowLayoutBoundsWidth = largeNavigatePage[0][1];
1020
- }
1021
- if (this.columnRanges.indexOf(range) < this.columnRanges.length - 1
1022
- && startPage != null && format.layout != PdfLayoutType.OnePage) {
1023
- isParentCell = this.Grid.isChildGrid;
1024
-
1025
- if ((largeNavigatePage[0] [0] as Number )!= 0)
1026
- {
1027
- let section : PdfSection = this.currentPage.section;
1028
- let pageIndex : number = section.indexOf(this.currentPage);
1029
-
1030
- this.currentGraphics = this.currentPage.graphics;
1031
- this.currentBounds = new RectangleF(new PointF(0,0), this.currentPage.getClientSize());
1032
- let pageindex : Number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
1033
- }
1034
- else
1035
- {
1036
- this.currentPage = this.getNextPageformat(format);
1037
- }
1038
-
1039
- // let locationGrid : PointF= new PointF(PdfBorders.default.right.width / 2, PdfBorders.default.top.width / 2);
1040
- // if (format.paginateBounds == new RectangleF(0,0,0,0) && this.startLocation == locationGrid)
1041
- // {
1042
- // this.currentBounds.x += this.startLocation.x;
1043
- // this.currentBounds.y += this.startLocation.y;
1044
- // }
1045
- }
1046
- if (this.columnRanges.length-1 !== index && this.columnRanges.length > 1 && format.layout !== PdfLayoutType.OnePage) {
1047
- this.currentPage = this.getNextPageformat(format);
1048
- if ((format.paginateBounds.x === format.paginateBounds.y) && (format.paginateBounds.y === format.paginateBounds.height)
1049
- && (format.paginateBounds.height === format.paginateBounds.width) && (format.paginateBounds.width === 0)) {
1050
- this.currentBounds.x += this.startLocation.x;
1051
- this.currentBounds.y += this.startLocation.y;
1052
- //this.currentBounds.height = this.pageBounds.height;
1053
- }
1054
- }
1055
-
1056
- }
1057
- result = this.getLayoutResult();
1058
- if (this.Grid.style.allowHorizontalOverflow && this.Grid.style.horizontalOverflowType == PdfHorizontalOverflowType.NextPage) {
1059
- this.reArrangePages(layoutedPages);
1060
- }
1061
- this.raisePageLayouted(result);
1062
- return result;
1063
- }
1064
- private checkIsFisished(row: PdfGridRow): boolean {
1065
- let result: boolean = true;
1066
- for (let i: number = 0; i < row.cells.count; i++) {
1067
- if (!row.cells.getCell(i).FinishedDrawingCell) {
1068
- result = false;
1069
- }
1070
- }
1071
- return result;
1072
- }
1073
- /* tslint:enable */
1074
- /**
1075
- * Gets the `next page`.
1076
- * @private
1077
- */
1078
- public getNextPageformat(format : PdfLayoutFormat) : PdfPage {
1079
- let section : PdfSection = this.currentPage.section;
1080
- let nextPage : PdfPage = null;
1081
- let index : number = section.indexOf(this.currentPage);
1082
- this.flag = false;
1083
- if (index === section.count - 1) {
1084
- nextPage = (section.add() as PdfPage);
1085
- } else {
1086
- nextPage = (section.getPages()[index + 1] as PdfPage);
1087
- }
1088
- this.currentGraphics = nextPage.graphics;
1089
- let pageindex : number = (this.currentGraphics.page as PdfPage).section.indexOf(this.currentGraphics.page as PdfPage);
1090
- if (!(this.listOfNavigatePages.indexOf(pageindex) !== -1)) {
1091
- this.listOfNavigatePages.push(pageindex);
1092
- }
1093
- this.currentBounds = new RectangleF(new PointF(0, 0), nextPage.getClientSize());
1094
- if ((typeof format !== 'undefined') && format != null && format.usePaginateBounds && (typeof format.paginateBounds !== 'undefined') && format.paginateBounds != null && (format.paginateBounds.x !== format.paginateBounds.y) && (format.paginateBounds.y !== format.paginateBounds.height)
1095
- && (format.paginateBounds.height !== format.paginateBounds.width) && (format.paginateBounds.width !== 0)) {
1096
- this.currentBounds.x = format.paginateBounds.x;
1097
- this.currentBounds.y = format.paginateBounds.y;
1098
- this.currentBounds.height = format.paginateBounds.height;
1099
- }
1100
- return nextPage;
1101
- }
1102
- private CheckIfDefaultFormat(format : PdfStringFormat) : boolean {
1103
- let defaultFormat : PdfStringFormat = new PdfStringFormat();
1104
- return (format.alignment === defaultFormat.alignment && format.characterSpacing === defaultFormat.characterSpacing &&
1105
- format.clipPath === defaultFormat.clipPath && format.firstLineIndent === defaultFormat.firstLineIndent &&
1106
- format.horizontalScalingFactor === defaultFormat.horizontalScalingFactor &&
1107
- format.lineAlignment === defaultFormat.lineAlignment
1108
- && format.lineLimit === defaultFormat.lineLimit && format.lineSpacing === defaultFormat.lineSpacing &&
1109
- format.measureTrailingSpaces === defaultFormat.measureTrailingSpaces && format.noClip === defaultFormat.noClip &&
1110
- format.paragraphIndent === defaultFormat.paragraphIndent && format.rightToLeft === defaultFormat.rightToLeft &&
1111
- format.subSuperScript === defaultFormat.subSuperScript && format.wordSpacing === defaultFormat.wordSpacing &&
1112
- format.wordWrap === defaultFormat.wordWrap);
1113
- }
1114
- /**
1115
- * `Raises BeforeCellDraw event`.
1116
- * @private
1117
- */
1118
- private RaiseBeforeCellDraw(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1119
- value : string, style : PdfGridCellStyle ) : PdfGridCellStyle {
1120
- let args : PdfGridBeginCellDrawEventArgs = null;
1121
- if (this.Grid.raiseBeginCellDraw) {
1122
- args = new PdfGridBeginCellDrawEventArgs(graphics, rowIndex, cellIndex, bounds, value, style);
1123
- this.Grid.onBeginCellDraw(args);
1124
- style = args.style;
1125
- }
1126
- return style;
1127
- }
1128
- /**
1129
- * `Raises AfterCellDraw event`.
1130
- * @private
1131
- */
1132
- private raiseAfterCellDraw(graphics : PdfGraphics, rowIndex : number, cellIndex : number,
1133
- bounds : RectangleF, value : string, cellstyle : PdfGridCellStyle) : void {
1134
- let args : PdfGridEndCellDrawEventArgs = null;
1135
- if (this.Grid.raiseEndCellDraw) {
1136
- args = new PdfGridEndCellDrawEventArgs(graphics, rowIndex, cellIndex, bounds, value, cellstyle);
1137
- this.Grid.onEndCellDraw(args);
1138
- }
1139
- }
1140
- private reArrangePages(layoutedPages : TemporaryDictionary<PdfPage, number[]>) : void {
1141
- let document : PdfDocument = this.currentPage.document;
1142
- let pages : PdfPage[] = [];
1143
- let keys : PdfPage[] = layoutedPages.keys();
1144
- let values : number[][] = layoutedPages.values();
1145
- for (let i : number = 0; i < keys.length; i++) {
1146
- let page : PdfPage = keys[i] as PdfPage;
1147
- page.section = null;
1148
- pages.push(page);
1149
- document.pages.remove(page);
1150
- }
1151
- /* tslint:disable */
1152
- for (let i : number = 0; i < layoutedPages.size(); i++) {
1153
- let count : number = 0;
1154
- for (let j : number = i, count = (layoutedPages.size() / this.columnRanges.length); j < layoutedPages.size(); j += count) {
1155
- let page : PdfPage = pages[j];
1156
- if (typeof page !== 'undefined' && document.pages.indexOf(page) === -1) {
1157
- document.pages.add(page);
1158
- }
1159
- }
1160
- }
1161
- /* tslint:enable */
1162
- }
1163
- /**
1164
- * Gets the `layout result`.
1165
- * @private
1166
- */
1167
- private getLayoutResult() : PdfGridLayoutResult {
1168
- if (this.Grid.isChildGrid && this.Grid.allowRowBreakAcrossPages) {
1169
- for (let i : number = 0; i < this.Grid.rows.count; i++) {
1170
- let row : PdfGridRow = this.Grid.rows.getRow(i);
1171
- if (row.rowBreakHeight > 0 && row.repeatFlag) {
1172
- this.startLocation.y = this.currentPage.origin.y;
1173
- }
1174
- }
1175
- }
1176
- let bounds : RectangleF;
1177
- if (!this.isChanged) {
1178
- bounds = new RectangleF(this.startLocation, new SizeF(this.currentBounds.width, this.currentBounds.y -
1179
- this.startLocation.y));
1180
- }
1181
- // else {
1182
- // bounds = new RectangleF(this.currentLocation, new SizeF(this.currentBounds.width, this.currentBounds.y -
1183
- // this.currentLocation.y));
1184
- // }
1185
- /* tslint:enable */
1186
- return new PdfGridLayoutResult(this.currentPage, bounds);
1187
- }
1188
- /**
1189
- * `Recalculate row height` for the split cell to be drawn.
1190
- * @private
1191
- */
1192
- public ReCalculateHeight(row : PdfGridRow, height : number) : number {
1193
- let newHeight : number = 0.0;
1194
- for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1195
- if (!(row.cells.getCell(i).remainingString === null || row.cells.getCell(i).remainingString === '' ||
1196
- typeof row.cells.getCell(i).remainingString === 'undefined')) {
1197
- newHeight = Math.max(newHeight, row.cells.getCell(i).measureHeight());
1198
- }
1199
- }
1200
- return Math.max(height, newHeight);
1201
- }
1202
- /**
1203
- * `Raises BeforePageLayout event`.
1204
- * @private
1205
- */
1206
- private raiseBeforePageLayout(currentPage : PdfPage, currentBounds : RectangleF,
1207
- currentRow : number) : { returnValue : boolean, currentBounds : RectangleF,
1208
- currentRowIndex : number } {
1209
- let cancel : boolean = false;
1210
- if (this.Grid.raiseBeginPageLayout) {
1211
- let args : PdfGridBeginPageLayoutEventArgs = new PdfGridBeginPageLayoutEventArgs( currentBounds, currentPage, currentRow);
1212
- this.Grid.onBeginPageLayout(args);
1213
- // if (currentBounds !== args.Bounds) {
1214
- // this.isChanged = true;
1215
- // this.currentLocation = new PointF(args.Bounds.x, args.Bounds.y);
1216
- // this.measureColumnsWidth(new RectangleF(new PointF(args.Bounds.x, args.Bounds.y) ,
1217
- // new SizeF(args.Bounds.width + args.Bounds.x ,
1218
- // args.Bounds.height)));
1219
- // }
1220
- cancel = (typeof args.cancel === 'undefined' ? false : args.cancel);
1221
- currentBounds = args.bounds;
1222
- currentRow = args.startRowIndex;
1223
- }
1224
- return {returnValue : cancel, currentBounds : currentBounds, currentRowIndex : currentRow };
1225
- }
1226
- /**
1227
- * `Raises PageLayout event` if needed.
1228
- * @private
1229
- */
1230
- private raisePageLayouted(result : PdfLayoutResult) : PdfGridEndPageLayoutEventArgs {
1231
- let args : PdfGridEndPageLayoutEventArgs = new PdfGridEndPageLayoutEventArgs(result);
1232
- if (this.Grid.raiseEndPageLayout) {
1233
- this.Grid.onEndPageLayout(args);
1234
- }
1235
- return args;
1236
- }
1237
- private drawRow(row : PdfGridRow) : RowLayoutResult
1238
- /**
1239
- * `Draws row`
1240
- * @private
1241
- */
1242
- private drawRow(row : PdfGridRow, result : RowLayoutResult, height : number) : void
1243
- private drawRow(row : PdfGridRow, result ?: RowLayoutResult, height ?: number) : RowLayoutResult|void {
1244
- if (typeof result === 'undefined') {
1245
- //.. Check if required space available.
1246
- //.....If the row conains spans which falls through more than one page, then draw the row to next page.
1247
- let result : RowLayoutResult = new RowLayoutResult();
1248
- let rowHeightWithSpan : number = 0;
1249
- let location : PointF = new PointF(0, 0);
1250
- let size : SizeF = new SizeF(0, 0);
1251
- let isHeader : boolean = false;
1252
- if (row.rowSpanExists) {
1253
- let maxSpan : number = 0;
1254
- let currRowIndex : number = this.Grid.rows.rowCollection.indexOf(row);
1255
- if (currRowIndex === -1) {
1256
- currRowIndex = this.Grid.headers.indexOf(row);
1257
- if (currRowIndex !== -1) {
1258
- isHeader = true;
1259
- }
1260
- }
1261
- for (let i : number = 0; i < row.cells.count; i++) {
1262
- let cell : PdfGridCell = row.cells.getCell(i);
1263
- maxSpan = Math.max(maxSpan, cell.rowSpan);
1264
- }
1265
- for (let i : number = currRowIndex; i < currRowIndex + maxSpan; i++) {
1266
- rowHeightWithSpan += (isHeader ? this.Grid.headers.getHeader(i).height : this.Grid.rows.getRow(i).height);
1267
- }
1268
- // let rowMaxHeight : number = rowHeightWithSpan;
1269
- // for (let i : number = 0; i < row.cells.count; i++ ) {
1270
- // rowMaxHeight = rowMaxHeight > row.cells.getCell(i).height ? rowMaxHeight : row.cells.getCell(i).height;
1271
- // }
1272
- // let flag : boolean = true;
1273
- // let nextRow : PdfGridRow = this.Grid.headers.getHeader(this.Grid.headers.indexOf(row) + 1);
1274
- // for (let i : number = 0; i < nextRow.cells.count; i++ ) {
1275
- // if (nextRow.cells.getCell(i).value !== '' && nextRow.cells.getCell(i).value !== undefined) {
1276
- // flag = false;
1277
- // break;
1278
- // }
1279
- // }
1280
- // if ((rowMaxHeight > rowHeightWithSpan) && flag) {
1281
- // row.height += (rowMaxHeight - rowHeightWithSpan);
1282
- // }
1283
- }
1284
- let calculatedHeight : number = row.rowBreakHeight > 0.0 ? row.rowBreakHeight : row.height;
1285
- if (typeof this.Grid.isChildGrid !== 'undefined' && this.Grid.isChildGrid && typeof this.Grid.ParentCell !== 'undefined' && this.Grid.ParentCell != null) {
1286
- //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
1287
- // if (calculatedHeight + this.Grid.ParentCell.row.grid.style.cellPadding.bottom +
1288
- // this.Grid.ParentCell.row.grid.style.cellPadding.top > this.currentPageBounds.height) {
1289
- // if (this.Grid.allowRowBreakAcrossPages) {
1290
- // result.isFinish = true;
1291
- // if ( this.Grid.isChildGrid && row.rowBreakHeight > 0 ) {
1292
- // if (this.Grid.ParentCell.row.grid.style.cellPadding !== null) {
1293
- // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1294
- // }
1295
- // this.currentBounds.x = this.startLocation.x;
1296
- // }
1297
- // result.bounds = this.currentBounds ;
1298
- // this.drawRowWithBreak(result, row, calculatedHeight);
1299
- // } else {
1300
- // //If AllowRowBreakAcrossPages is not true, draw the row till it fits the page.
1301
-
1302
- // if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1303
- // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1304
- // calculatedHeight = this.currentBounds.height - this.currentBounds.y -
1305
- // this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
1306
- // }
1307
- // result.isFinish = false;
1308
- // this.drawRow( row, result, calculatedHeight);
1309
- // }
1310
- // } else
1311
- if (this.currentBounds.y + this.Grid.ParentCell.row.grid.style.cellPadding.bottom + calculatedHeight >
1312
- this.currentPageBounds.height || this.currentBounds.y + this.Grid.ParentCell.row.grid.style.cellPadding.bottom
1313
- + calculatedHeight > this.currentBounds.height || this.currentBounds.y +
1314
- this.Grid.ParentCell.row.grid.style.cellPadding.bottom + rowHeightWithSpan > this.currentPageBounds.height) {
1315
- //If a row is repeated and still cannot fit in page, proceed draw.
1316
- if (typeof this.Grid.ParentCell.row.grid.LayoutFormat !== 'undefined' && this.Grid.ParentCell.row.grid.LayoutFormat.break === PdfLayoutBreakType.FitPage ) {
1317
- PdfGridLayouter.repeatRowIndex = this.Grid.rows.rowCollection.indexOf(row);
1318
- this.Grid.splitChildRowIndex = this.Grid.rows.rowCollection.indexOf(row);
1319
- }
1320
- if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex) {
1321
- if (this.Grid.allowRowBreakAcrossPages) {
1322
- result.isFinish = true;
1323
- // if (this.Grid.isChildGrid && row.rowBreakHeightValue > 0) {
1324
- // // if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1325
- // // this.currentBounds.y += this.Grid.ParentCell.row.grid.style.cellPadding.top;
1326
- // // }
1327
- // this.currentBounds.x = this.startLocation.x;
1328
- // }
1329
- result.bounds = this.currentBounds;
1330
- this.drawRowWithBreak(result, row, calculatedHeight);
1331
- row.repeatFlag = true;
1332
- row.repeatRowNumber = PdfGridLayouter.repeatRowIndex;
1333
- }
1334
- // else {
1335
- // result.isFinish = false;
1336
- // row.repeatFlag = false;
1337
- // this.drawRow( row, result, calculatedHeight);
1338
- // }
1339
- }
1340
- // else {
1341
- // result.isFinish = false;
1342
- // }
1343
- } else {
1344
- result.isFinish = true;
1345
- if (row.grid.ParentCell.row.rowBreakHeightValue > 0 ) {
1346
- row.repeatFlag = true;
1347
- } else {
1348
- row.repeatFlag = false;
1349
- calculatedHeight = row.height;
1350
- }
1351
- if (this.Grid.isChildGrid && row.rowBreakHeight > 0) {
1352
- if (this.Grid.ParentCell.row.grid.style.cellPadding != null) {
1353
- calculatedHeight += this.Grid.ParentCell.row.grid.style.cellPadding.bottom;
1354
- }
1355
- }
1356
- this.drawRow( row, result, calculatedHeight);
1357
- }
1358
- } else {
1359
- //Split row only if row height exceeds page height and AllowRowBreakAcrossPages is true.
1360
- if (calculatedHeight > this.currentPageBounds.height) {
1361
- if (this.Grid.allowRowBreakAcrossPages) {
1362
- result.isFinish = true;
1363
- //result.bounds = this.currentBounds;
1364
- this.drawRowWithBreak(result, row, calculatedHeight);
1365
- row.isrowFinish = true;
1366
- row.repeatFlag = true;
1367
- if (row.grid.splitChildRowIndex !== -1) {
1368
- result.isFinish = false;
1369
- }
1370
- }
1371
- // else {
1372
- // //If AllowRowBreakAcrossPages is not true, draw the row till it fits the page.
1373
- // result.isFinish = false;
1374
- // this.drawRow( row, result, calculatedHeight);
1375
- // }
1376
- } else if (this.currentBounds.y + calculatedHeight > this.currentPageBounds.height ||
1377
- this.currentBounds.y + calculatedHeight > (this.currentBounds.height + this.startLocation.y) ||
1378
- this.currentBounds.y + rowHeightWithSpan > this.currentPageBounds.height) {
1379
- // If a row is repeated and still cannot fit in page, proceed draw.
1380
- let isFit: boolean = false;
1381
- if ((this.Grid.allowRowBreakAcrossPages && !this.Grid.repeatHeader && !row.isRowHeightSet && !row.rowMergeComplete)) {
1382
- if (this.Grid.LayoutFormat !== null && this.Grid.LayoutFormat.paginateBounds.height > 0) {
1383
- isFit = this.isFitToCell((this.currentBounds.height + this.startLocation.y) - this.currentBounds.y, this.Grid, row);
1384
- }
1385
- else
1386
- isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1387
- if (isFit) {
1388
- this.isPaginate = true;
1389
- }
1390
- }
1391
- else if (this.Grid.allowRowBreakAcrossPages && this.Grid.LayoutFormat != null && this.Grid.LayoutFormat.layout == PdfLayoutType.Paginate && this.Grid.LayoutFormat.break != PdfLayoutBreakType.FitElement && row.isRowHeightSet && this.currentBounds.y + height > this.currentPageBounds.height) {
1392
- isFit = this.isFitToCell(this.currentPageBounds.height - this.currentBounds.y, this.Grid, row);
1393
- if (!isFit)
1394
- isFit = !(this.slr !== null && this.slr.actualSize.height == 0 && this.slr.remainder != null && this.slr.remainder.length > 0 && this.remainderText == this.slr.remainder);
1395
-
1396
- if (isFit && this.slr != null && this.slr.lineCount > 1) {
1397
- //It may text cutoff issue
1398
- isFit = false;
1399
- }
1400
- this.remainderText = null;
1401
- }
1402
- if (PdfGridLayouter.repeatRowIndex > -1 && PdfGridLayouter.repeatRowIndex === row.rowIndex || isFit) {
1403
- if (this.Grid.allowRowBreakAcrossPages) {
1404
- result.isFinish = true;
1405
- this.drawRowWithBreak(result, row, calculatedHeight);
1406
- row.repeatFlag = true;
1407
- row.repeatRowNumber = PdfGridLayouter.repeatRowIndex;
1408
- if (row.grid.splitChildRowIndex !== -1) {
1409
- result.isFinish = false;
1410
- }
1411
- }
1412
- else {
1413
- result.isFinish = false;
1414
- this.drawRow(row, result, calculatedHeight);
1415
- }
1416
- } else {
1417
- result.isFinish = false;
1418
- }
1419
- } else {
1420
- result.isFinish = true;
1421
- this.drawRow(row, result, calculatedHeight);
1422
- row.repeatFlag = false;
1423
- }
1424
- }
1425
- return result;
1426
- } else {
1427
- let skipcell : boolean = false;
1428
- let location : PointF = new PointF(this.currentBounds.x, this.currentBounds.y);
1429
- // if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x && row.width <
1430
- // this.currentPage.getClientSize().width) {
1431
- // location.x = this.startLocation.x;
1432
- // }
1433
- result.bounds = new RectangleF(location, new SizeF(0, 0));
1434
- height = this.ReCalculateHeight(row, height);
1435
- for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1436
- let cancelSpans : boolean = ((i > this.cellEndIndex + 1) && (row.cells.getCell(i).columnSpan > 1));
1437
- // let cancelSpans : boolean = false;
1438
- if (!cancelSpans) {
1439
- for (let j : number = 1; j < row.cells.getCell(i).columnSpan; j++) {
1440
- row.cells.getCell(i + j).isCellMergeContinue = true;
1441
- }
1442
- }
1443
- let size : SizeF = new SizeF(this.Grid.columns.getColumn(i).width, height);
1444
- // if (size.width > this.currentGraphics.clientSize.width) {
1445
- // size.width = this.currentGraphics.clientSize.width;
1446
- // }
1447
- // if (this.Grid.isChildGrid && this.Grid.style.allowHorizontalOverflow) {
1448
- // if (size.width >= this.currentGraphics.clientSize.width) {
1449
- // size.width -= 2 * this.currentBounds.x;
1450
- // }
1451
- // }
1452
- /* tslint:disable */
1453
- if (!this.CheckIfDefaultFormat(this.Grid.columns.getColumn(i).format) &&
1454
- this.CheckIfDefaultFormat(row.cells.getCell(i).stringFormat)) {
1455
- row.cells.getCell(i).stringFormat = this.Grid.columns.getColumn(i).format;
1456
- }
1457
- let cellstyle : PdfGridCellStyle = row.cells.getCell(i).style;
1458
- let tempValue : string = ((typeof row.cells.getCell(i).value === 'string' &&
1459
- row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1460
-
1461
- row.cells.getCell(i).style = this.RaiseBeforeCellDraw(this.currentGraphics, this.currentRowIndex, i,
1462
- new RectangleF(location, size), tempValue, cellstyle);
1463
- //row.cells.getCell(i).style = cellstyle;
1464
- if (!skipcell) {
1465
- if (row.cells.getCell(i).value instanceof PdfGrid)
1466
- {
1467
- let grid :PdfGrid = row.cells.getCell(i).value as PdfGrid;
1468
- grid.parentCellIndex = i;
1469
- }
1470
- let stringResult : PdfStringLayoutResult = row.cells.getCell(i).draw(this.currentGraphics,
1471
- new RectangleF(location, size), cancelSpans);
1472
- if (row.grid.style.allowHorizontalOverflow && (row.cells.getCell(i).columnSpan > this.cellEndIndex ||
1473
- i + row.cells.getCell(i).columnSpan > this.cellEndIndex + 1) && this.cellEndIndex < row.cells.count - 1) {
1474
- row.rowOverflowIndex = this.cellEndIndex;
1475
- }
1476
- if (row.grid.style.allowHorizontalOverflow && (row.rowOverflowIndex > 0 && (row.cells.getCell(i).columnSpan >
1477
- this.cellEndIndex || i + row.cells.getCell(i).columnSpan > this.cellEndIndex + 1)) &&
1478
- row.cells.getCell(i).columnSpan - this.cellEndIndex + i - 1 > 0) {
1479
- row.cells.getCell(row.rowOverflowIndex + 1).value = stringResult !== null ? (stringResult.remainder !== undefined) ?
1480
- stringResult.remainder : '' : '';
1481
- row.cells.getCell(row.rowOverflowIndex + 1).stringFormat = row.cells.getCell(i).stringFormat;
1482
- row.cells.getCell(row.rowOverflowIndex + 1).style = row.cells.getCell(i).style;
1483
- row.cells.getCell(row.rowOverflowIndex + 1).columnSpan = row.cells.getCell(i).columnSpan - this.cellEndIndex + i - 1;
1484
- }
1485
- }
1486
- /* tslint:enable */
1487
- tempValue = ((typeof row.cells.getCell(i).value === 'string' &&
1488
- row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1489
- if (!cancelSpans) {
1490
- this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i,
1491
- new RectangleF(location, size), tempValue, row.cells.getCell(i).style);
1492
- }
1493
- if (row.cells.getCell(i).value instanceof PdfGrid) {
1494
- let grid : PdfGrid = row.cells.getCell(i).value as PdfGrid;
1495
- if (this.Grid.columns.getColumn(i).width >= this.currentGraphics.clientSize.width) {
1496
- location.x = grid.rowLayoutBoundsWidth;
1497
- location.x += grid.style.cellSpacing;
1498
- } else {
1499
- location.x += this.Grid.columns.getColumn(i).width;
1500
- }
1501
- } else {
1502
- location.x += this.Grid.columns.getColumn(i).width;
1503
- }
1504
- }
1505
- if (!row.rowMergeComplete || row.isRowHeightSet) {
1506
- this.currentBounds.y += height;
1507
- }
1508
- result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location.x, location.y));
1509
- }
1510
- }
1511
-
1512
- private isFitToCell(currentHeight: number, grid: PdfGrid, gridRow: PdfGridRow): boolean {
1513
- let isFit: boolean = false;
1514
- let layouter: PdfStringLayouter = new PdfStringLayouter();
1515
- for (let i: number = 0; i < gridRow.cells.count; i++) {
1516
- let cell: PdfGridCell = gridRow.cells.getCell(i);
1517
- if (typeof cell.value !== 'undefined' && cell.value !== null && typeof cell.value === 'string') {
1518
- let font: PdfFont = null;
1519
- if (typeof cell.style.font !== 'undefined' && cell.style.font != null) {
1520
- font = cell.style.font;
1521
- } else if (typeof cell.row.style.font !== 'undefined' && cell.row.style.font != null) {
1522
- font = cell.row.style.font;
1523
- } else if (typeof cell.row.grid.style.font !== 'undefined' && cell.row.grid.style.font != null) {
1524
- font = cell.row.grid.style.font;
1525
- } else {
1526
- font = PdfDocument.defaultFont;
1527
- }
1528
- this.remainderText = cell.value as string;
1529
- let width: number = cell.width;
1530
- const column: PdfGridColumn = grid.columns.getColumn(i);
1531
- if (column.isCustomWidth && cell.width > column.width) {
1532
- width = column.width;
1533
- }
1534
- this.slr = layouter.layout(cell.value as string, font, cell.stringFormat, new SizeF(width, currentHeight), false, this.currentPageBounds);
1535
- let height: number = this.slr.actualSize.height;
1536
- if (cell.value !== '' && height === 0) {
1537
- isFit = false;
1538
- break;
1539
- }
1540
- if (cell.style !== null && cell.style.borders !== null && cell.style.borders.top !== null && cell.style.borders.bottom !== null) {
1541
- height += (cell.style.borders.top.width + cell.style.borders.bottom.width) * 2;
1542
- }
1543
- if (this.slr.lineCount > 1 && cell.stringFormat != null && cell.stringFormat.lineSpacing != 0) {
1544
- height += (this.slr.lineCount - 1) * (cell.style.stringFormat.lineSpacing);
1545
- }
1546
- if (cell.style.cellPadding === null) {
1547
- height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
1548
- } else {
1549
- height += (grid.style.cellPadding.top + grid.style.cellPadding.bottom);
1550
- }
1551
- height += grid.style.cellSpacing;
1552
- if (currentHeight > height || (typeof this.slr.remainder !== 'undefined' && this.slr.remainder !== null)) {
1553
- isFit = true;
1554
- break;
1555
- }
1556
- }
1557
- }
1558
- return isFit;
1559
- }
1560
- /**
1561
- * `Draws row`
1562
- * @private
1563
- */
1564
- private drawRowWithBreak(result : RowLayoutResult, row : PdfGridRow, calculateHeight : number) : void
1565
- private drawRowWithBreak(result ?: RowLayoutResult, row ?: PdfGridRow, calculateHeight ?: number) : RowLayoutResult|void {
1566
- let location : PointF = new PointF(this.currentBounds.x, this.currentBounds.y);
1567
- if (row.grid.isChildGrid && row.grid.allowRowBreakAcrossPages && this.startLocation.x !== this.currentBounds.x) {
1568
- location.x = this.startLocation.x;
1569
- }
1570
- result.bounds = new RectangleF(location, new SizeF(0, 0));
1571
- this.gridHeight = row.rowBreakHeight > 0 ? this.currentPageBounds.height : 0;
1572
- // Calculate the remaining height.
1573
- if (row.grid.style.cellPadding.top + this.currentBounds.y + row.grid.style.cellPadding.bottom < this.currentPageBounds.height) {
1574
- row.rowBreakHeight = this.currentBounds.y + calculateHeight - this.currentPageBounds.height;
1575
- }
1576
- // else {
1577
- // row.rowBreakHeight = calculateHeight;
1578
- // result.isFinish = false;
1579
- // return;
1580
- // }
1581
- // No need to explicit break if the row height is equal to grid height.
1582
- for (let i : number = 0; i < row.cells.count; i++) {
1583
- let cell : PdfGridCell = row.cells.getCell(i);
1584
- let cellHeight : number = cell.measureHeight();
1585
- if (cellHeight === calculateHeight && cell.value instanceof PdfGrid) {
1586
- row.rowBreakHeight = 0;
1587
- }
1588
- // else if (cellHeight === calculateHeight && (cell.value as PdfGrid) === null) {
1589
- // row.rowBreakHeight = this.currentBounds.y + calculateHeight - this.currentPageBounds.height;
1590
- // }
1591
- }
1592
- for (let i : number = this.cellStartIndex; i <= this.cellEndIndex; i++) {
1593
- let cancelSpans : boolean = ((row.cells.getCell(i).columnSpan + i > this.cellEndIndex + 1) &&
1594
- (row.cells.getCell(i).columnSpan > 1));
1595
- // if (!cancelSpans) {
1596
- // for (let k : number = 1; k < row.cells.getCell(i).columnSpan; k++) {
1597
- // row.cells.getCell(i + k).isCellMergeContinue = true;
1598
- // }
1599
- //}
1600
- let size : SizeF = new SizeF(this.Grid.columns.getColumn(i).width, this.gridHeight > 0.0 ? this.gridHeight :
1601
- this.currentPageBounds.height);
1602
- // if (size.width === 0) {
1603
- // size = new SizeF(row.cells.getCell(i).width, size.height);
1604
- // }
1605
- // if (!this.CheckIfDefaultFormat(this.Grid.columns.getColumn(i).format) &&
1606
- // this.CheckIfDefaultFormat((row.cells.getCell(i).stringFormat))) {
1607
- // row.cells.getCell(i).stringFormat = this.Grid.columns.getColumn(i).format;
1608
- // }
1609
- let cellstyle1 : PdfGridCellStyle = row.cells.getCell(i).style;
1610
- row.cells.getCell(i).style = cellstyle1;
1611
- let skipcell : boolean = false;
1612
- let stringResult : PdfStringLayoutResult = null;
1613
- if (!skipcell) {
1614
- row.cells.getCell(i)._rowHeight = row.height;
1615
- stringResult = row.cells.getCell(i).draw(this.currentGraphics, new RectangleF(location, size), cancelSpans);
1616
- }
1617
- //If still row is to be drawn, set cell finished drawing cell as false and update the text to be drawn.
1618
- if (row.rowBreakHeight > 0.0) {
1619
- if (stringResult != null && typeof stringResult.remainder !== 'undefined') {
1620
- row.cells.getCell(i).FinishedDrawingCell = false;
1621
- row.cells.getCell(i).remainingString = stringResult.remainder == null ? ' ' : stringResult.remainder;
1622
- row.rowBreakHeight = calculateHeight - stringResult.actualSize.height;
1623
- }
1624
- }
1625
- result.isFinish = (!result.isFinish) ? result.isFinish : row.cells.getCell(i).FinishedDrawingCell;
1626
- // let tempValue : string = ((typeof row.cells.getCell(i).value === 'string' &&
1627
- //row.cells.getCell(i).value !== null) ? row.cells.getCell(i).value : '') as string;
1628
- // if (!cancelSpans) {
1629
- // // this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i,
1630
- // // new RectangleF(location, size), tempValue, row.cells.getCell(i).style);
1631
- // this.raiseAfterCellDraw(this.currentGraphics, this.currentRowIndex, i, new RectangleF(location, size),
1632
- // (row.cells.getCell(i).value as string) ? row.cells.getCell(i).value.toString() : ' ',
1633
- // row.cells.getCell(i).style);
1634
- // }
1635
- if (row.cells.getCell(i).value instanceof PdfGrid) {
1636
- let grid : PdfGrid = row.cells.getCell(i).value as PdfGrid;
1637
- this.rowBreakPageHeightCellIndex = i;
1638
- // row.cells.getCell(i).pageCount = grid.listOfNavigatePages.length;
1639
- // for (let j : number = 0;j<grid.listOfNavigatePages.length;j++){
1640
- // let pageIndex : number =grid.listOfNavigatePages.indexOf(j);
1641
- // this.Grid.listOfNavigatePages.push(pageIndex);
1642
- // }
1643
- if (this.Grid.columns.getColumn(i).width >= this.currentGraphics.clientSize.width) {
1644
- location.x = this.rowLayoutBoundsWidth;
1645
- location.x += grid.style.cellSpacing;
1646
- } else {
1647
- location.x += this.Grid.columns.getColumn(i).width;
1648
- }
1649
- } else {
1650
- location.x += this.Grid.columns.getColumn(i).width;
1651
- }
1652
- }
1653
- this.currentBounds.y += this.gridHeight > 0.0 ? this.gridHeight : calculateHeight;
1654
- result.bounds = new RectangleF(new PointF(result.bounds.x, result.bounds.y), new SizeF(location.x, location.y));
1655
- }
1656
- }
1657
- // recalculateBounds : boolean, clientSize : SizeF
1658
- //Implementation
1659
- /**
1660
- * `Initializes` internal data.
1661
- * @private
1662
- */
1663
- //Internal declaration
1664
- export class PdfGridLayoutResult extends PdfLayoutResult {
1665
- /**
1666
- * Constructor
1667
- * @private
1668
- */
1669
- public constructor(page : PdfPage, bounds : RectangleF) {
1670
- super(page, bounds);
1671
- }
1672
- }
1673
- /**
1674
- * `PdfGridLayoutFormat` class represents a flexible grid that consists of columns and rows.
1675
- */
1676
- export class PdfGridLayoutFormat extends PdfLayoutFormat {
1677
- // Constructors
1678
- /**
1679
- * Initializes a new instance of the `PdfGridLayoutFormat` class.
1680
- * @private
1681
- */
1682
- public constructor()
1683
- /**
1684
- * Initializes a new instance of the `PdfGridLayoutFormat` class.
1685
- * @private
1686
- */
1687
- public constructor(baseFormat : PdfLayoutFormat)
1688
- /**
1689
- * Initializes a new instance of the `PdfGridLayoutFormat` class.
1690
- * @private
1691
- */
1692
- public constructor(baseFormat ?: PdfLayoutFormat) {
1693
- super(baseFormat);
1694
- }
1695
- }
1696
- export abstract class GridCellEventArgs {
1697
- // Fields
1698
- /**
1699
- * @hidden
1700
- * @private
1701
- */
1702
- private gridRowIndex : number;
1703
- /**
1704
- * @hidden
1705
- * @private
1706
- */
1707
- private gridCellIndex : number;
1708
- /**
1709
- * @hidden
1710
- * @private
1711
- */
1712
- private internalValue : string;
1713
- /**
1714
- * @hidden
1715
- * @private
1716
- */
1717
- private gridBounds : RectangleF;
1718
- /**
1719
- * @hidden
1720
- * @private
1721
- */
1722
- private pdfGraphics : PdfGraphics;
1723
- // Properties
1724
- /**
1725
- * Gets the value of current `row index`.
1726
- * @private
1727
- */
1728
- public get rowIndex() : number {
1729
- return this.gridRowIndex;
1730
- }
1731
- /**
1732
- * Gets the value of current `cell index`.
1733
- * @private
1734
- */
1735
- public get cellIndex() : number {
1736
- return this.gridCellIndex;
1737
- }
1738
- /**
1739
- * Gets the actual `value` of current cell.
1740
- * @private
1741
- */
1742
- public get value() : string {
1743
- return this.internalValue;
1744
- }
1745
- /**
1746
- * Gets the `bounds` of current cell.
1747
- * @private
1748
- */
1749
- public get bounds() : RectangleF {
1750
- return this.gridBounds;
1751
- }
1752
- /**
1753
- * Gets the instance of `current graphics`.
1754
- * @private
1755
- */
1756
- public get graphics() : PdfGraphics {
1757
- return this.pdfGraphics;
1758
- }
1759
- // Constructors
1760
- /**
1761
- * Initialize a new instance for `GridCellEventArgs` class.
1762
- * @private
1763
- */
1764
- public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF, value : string) {
1765
- this.gridRowIndex = rowIndex;
1766
- this.gridCellIndex = cellIndex;
1767
- this.internalValue = value;
1768
- this.gridBounds = bounds;
1769
- this.pdfGraphics = graphics;
1770
- }
1771
- }
1772
- export class PdfGridBeginCellDrawEventArgs extends GridCellEventArgs {
1773
- // Fields
1774
- /**
1775
- * @hidden
1776
- * @private
1777
- */
1778
- private bSkip : boolean;
1779
- /**
1780
- * @hidden
1781
- * @private
1782
- */
1783
- private cellStyle : PdfGridCellStyle;
1784
- // Properties
1785
- /**
1786
- * Gets or sets a value indicating whether the value of this cell should be `skipped`.
1787
- * @private
1788
- */
1789
- public get skip() : boolean {
1790
- return this.bSkip;
1791
- }
1792
- public set skip(value : boolean) {
1793
- this.bSkip = value;
1794
- }
1795
- /**
1796
- * Gets or sets a `style` value of the cell.
1797
- * @private
1798
- */
1799
- public get style() : PdfGridCellStyle {
1800
- return this.cellStyle;
1801
- }
1802
- public set style(value : PdfGridCellStyle) {
1803
- this.cellStyle = value;
1804
- }
1805
- // Constructors
1806
- /**
1807
- * Initializes a new instance of the `StartCellLayoutEventArgs` class.
1808
- * @private
1809
- */
1810
- public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1811
- value : string, style : PdfGridCellStyle) {
1812
- super(graphics, rowIndex, cellIndex, bounds, value);
1813
- this.style = style;
1814
- }
1815
- }
1816
- export class PdfGridEndCellDrawEventArgs extends GridCellEventArgs {
1817
- // Field
1818
- /**
1819
- * @hidden
1820
- * @private
1821
- */
1822
- private cellStyle : PdfGridCellStyle;
1823
- // Propertise
1824
- /**
1825
- * Get the `PdfGridCellStyle`.
1826
- * @private
1827
- */
1828
- public get style() : PdfGridCellStyle {
1829
- return this.cellStyle;
1830
- }
1831
- // Constructors
1832
- /**
1833
- * Initializes a new instance of the `PdfGridEndCellLayoutEventArgs` class.
1834
- * @private
1835
- */
1836
- public constructor(graphics : PdfGraphics, rowIndex : number, cellIndex : number, bounds : RectangleF,
1837
- value : string, style : PdfGridCellStyle) {
1838
- super(graphics, rowIndex, cellIndex, bounds, value);
1839
- this.cellStyle = style;
1840
- }
1841
- }
1842
-
1843
- export class PdfCancelEventArgs {
1844
- // Fields
1845
- /**
1846
- * @hidden
1847
- * @private
1848
- */
1849
- private isCancel : boolean;
1850
- // Properties
1851
- /**
1852
- * Gets and Sets the value of `cancel`.
1853
- * @private
1854
- */
1855
- public get cancel() : boolean {
1856
- return this.isCancel;
1857
- }
1858
- public set cancel(value : boolean) {
1859
- this.isCancel = value;
1860
- }
1861
- }
1862
- export class BeginPageLayoutEventArgs extends PdfCancelEventArgs {
1863
- // Fields
1864
- /**
1865
- * The `bounds` of the lay outing on the page.
1866
- * @private
1867
- */
1868
- private cellBounds : RectangleF;
1869
- /**
1870
- * `Page` where the lay outing should start.
1871
- * @private
1872
- */
1873
- private pdfPage : PdfPage;
1874
- // Properties
1875
- /**
1876
- * Gets or sets value that indicates the lay outing `bounds` on the page.
1877
- * @private
1878
- */
1879
- public get bounds() : RectangleF {
1880
- return this.cellBounds;
1881
- }
1882
- public set bounds(value : RectangleF) {
1883
- this.cellBounds = value;
1884
- }
1885
- /**
1886
- * Gets the `page` where the lay outing should start.
1887
- * @private
1888
- */
1889
- public get page() : PdfPage {
1890
- return this.pdfPage;
1891
- }
1892
- // Constructors
1893
- /**
1894
- * Initializes a new instance of the `BeginPageLayoutEventArgs` class with the specified rectangle and page.
1895
- * @private
1896
- */
1897
- public constructor(bounds : RectangleF, page : PdfPage) {
1898
- super();
1899
- this.bounds = bounds;
1900
- this.pdfPage = page;
1901
- }
1902
- }
1903
- /**
1904
- * `EndPageLayoutEventArgs` class is alternate for end page layout events.
1905
- */
1906
-
1907
- export class EndPageLayoutEventArgs extends PdfCancelEventArgs {
1908
- // Fields
1909
- /**
1910
- * `Layout result`.
1911
- * @private
1912
- */
1913
- private layoutResult : PdfLayoutResult;
1914
- /**
1915
- * The `next page` for lay outing.
1916
- * @private
1917
- */
1918
- private nextPdfPage : PdfPage;
1919
- // Properties
1920
- /**
1921
- * Gets the lay outing `result` of the page.
1922
- * @private
1923
- */
1924
- public get result() : PdfLayoutResult {
1925
- return this.layoutResult;
1926
- }
1927
- /**
1928
- * Gets or sets a value indicating the `next page` where the element should be layout.
1929
- * @private
1930
- */
1931
- public get nextPage() : PdfPage {
1932
- return this.nextPdfPage;
1933
- }
1934
- public set nextPage(value : PdfPage) {
1935
- this.nextPdfPage = value;
1936
- }
1937
- // Constructors
1938
- /**
1939
- * Initializes a new instance of the `EndPageLayoutEventArgs` class. with the specified 'PdfLayoutResult'.
1940
- * @private
1941
- */
1942
- public constructor(result : PdfLayoutResult) {
1943
- super();
1944
- this.layoutResult = result;
1945
- }
1946
- }
1947
- /**
1948
- * `PdfGridBeginPageLayoutEventArgs` class is alternate for begin page layout events.
1949
- */
1950
- export class PdfGridBeginPageLayoutEventArgs extends BeginPageLayoutEventArgs {
1951
- // Fields
1952
- /**
1953
- * @hidden
1954
- * @private
1955
- */
1956
- private startRow : number;
1957
- // Properties
1958
- /**
1959
- * Gets the `start row index`.
1960
- * @private
1961
- */
1962
- public get startRowIndex() : number {
1963
- return this.startRow;
1964
- }
1965
- // Constructors
1966
- /**
1967
- * Initialize a new instance of `PdfGridBeginPageLayoutEventArgs` class.
1968
- * @private
1969
- */
1970
- public constructor(bounds : RectangleF, page : PdfPage, startRow : number) {
1971
- super(bounds, page);
1972
- this.startRow = startRow;
1973
- }
1974
- }
1975
- /**
1976
- * `PdfGridEndPageLayoutEventArgs` class is alternate for begin page layout events.
1977
- */
1978
- export class PdfGridEndPageLayoutEventArgs extends EndPageLayoutEventArgs {
1979
- // Constructors
1980
- /**
1981
- * Initialize a new instance of `PdfGridEndPageLayoutEventArgs` class.
1982
- * @private
1983
- */
1984
- public constructor(result : PdfLayoutResult) {
1985
- super(result);
1986
- }
1987
- }
1988
- export class RowLayoutResult {
1989
- /**
1990
- * @hidden
1991
- * @private
1992
- */
1993
- private bIsFinished : boolean;
1994
- /**
1995
- * @hidden
1996
- * @private
1997
- */
1998
- private layoutedBounds : RectangleF;
1999
- /**
2000
- * Gets or sets a value indicating whether this instance `is finish`.
2001
- * @private
2002
- */
2003
- public get isFinish() : boolean {
2004
- return this.bIsFinished;
2005
- }
2006
- public set isFinish(value : boolean) {
2007
- this.bIsFinished = value;
2008
- }
2009
- /**
2010
- * Gets or sets the `bounds`.
2011
- * @private
2012
- */
2013
- public get bounds() : RectangleF {
2014
- return this.layoutedBounds;
2015
- }
2016
- public set bounds(value : RectangleF) {
2017
- this.layoutedBounds = value;
2018
- }
2019
- //Constructors
2020
- /**
2021
- * Initializes a new instance of the `RowLayoutResult` class.
2022
- * @private
2023
- */
2024
- public constructor() {
2025
- this.layoutedBounds = new RectangleF(0, 0, 0, 0);
2026
- }
2027
- }