@syncfusion/ej2-pdf-export 24.1.41 → 24.2.3

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 (164) hide show
  1. package/CHANGELOG.md +10 -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 +157 -28
  6. package/dist/es6/ej2-pdf-export.es2015.js.map +1 -1
  7. package/dist/es6/ej2-pdf-export.es5.js +157 -28
  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 +6 -6
  13. package/src/implementation/graphics/pdf-graphics.d.ts +35 -0
  14. package/src/implementation/graphics/pdf-graphics.js +157 -29
  15. package/dist/ts/implementation/actions/action.ts +0 -76
  16. package/dist/ts/implementation/actions/uri-action.ts +0 -52
  17. package/dist/ts/implementation/annotations/action-link-annotation.ts +0 -43
  18. package/dist/ts/implementation/annotations/annotation-collection.ts +0 -159
  19. package/dist/ts/implementation/annotations/annotation.ts +0 -241
  20. package/dist/ts/implementation/annotations/document-link-annotation.ts +0 -118
  21. package/dist/ts/implementation/annotations/link-annotation.ts +0 -32
  22. package/dist/ts/implementation/annotations/pdf-text-web-link.ts +0 -265
  23. package/dist/ts/implementation/annotations/uri-annotation.ts +0 -86
  24. package/dist/ts/implementation/collections/dictionary.ts +0 -150
  25. package/dist/ts/implementation/collections/object-object-pair/dictionary.ts +0 -125
  26. package/dist/ts/implementation/collections/utils.ts +0 -38
  27. package/dist/ts/implementation/document/automatic-fields/automatic-field-info-collection.ts +0 -39
  28. package/dist/ts/implementation/document/automatic-fields/automatic-field-info.ts +0 -108
  29. package/dist/ts/implementation/document/automatic-fields/automatic-field.ts +0 -127
  30. package/dist/ts/implementation/document/automatic-fields/composite-field.ts +0 -76
  31. package/dist/ts/implementation/document/automatic-fields/multiple-value-field.ts +0 -37
  32. package/dist/ts/implementation/document/automatic-fields/page-count-field.ts +0 -75
  33. package/dist/ts/implementation/document/automatic-fields/pdf-numbers-convertor.ts +0 -157
  34. package/dist/ts/implementation/document/automatic-fields/pdf-page-number-field.ts +0 -82
  35. package/dist/ts/implementation/document/automatic-fields/pdf-template-value-pair.ts +0 -60
  36. package/dist/ts/implementation/document/automatic-fields/single-value-field.ts +0 -48
  37. package/dist/ts/implementation/document/pdf-catalog.ts +0 -65
  38. package/dist/ts/implementation/document/pdf-document-base.ts +0 -180
  39. package/dist/ts/implementation/document/pdf-document-template.ts +0 -310
  40. package/dist/ts/implementation/document/pdf-document.ts +0 -342
  41. package/dist/ts/implementation/document/pdf-viewer-preferences.ts +0 -578
  42. package/dist/ts/implementation/drawing/pdf-drawing.ts +0 -218
  43. package/dist/ts/implementation/general/enum.ts +0 -21
  44. package/dist/ts/implementation/general/functions/pdf-function.ts +0 -66
  45. package/dist/ts/implementation/general/functions/pdf-sampled-function.ts +0 -63
  46. package/dist/ts/implementation/general/pdf-cache-collection.ts +0 -97
  47. package/dist/ts/implementation/general/pdf-collection.ts +0 -41
  48. package/dist/ts/implementation/general/pdf-destination.ts +0 -170
  49. package/dist/ts/implementation/graphics/brushes/enum.ts +0 -237
  50. package/dist/ts/implementation/graphics/brushes/pdf-blend.ts +0 -294
  51. package/dist/ts/implementation/graphics/brushes/pdf-brush.ts +0 -68
  52. package/dist/ts/implementation/graphics/brushes/pdf-brushes.ts +0 -2438
  53. package/dist/ts/implementation/graphics/brushes/pdf-color-blend.ts +0 -295
  54. package/dist/ts/implementation/graphics/brushes/pdf-gradient-brush.ts +0 -311
  55. package/dist/ts/implementation/graphics/brushes/pdf-linear-gradient-brush.ts +0 -406
  56. package/dist/ts/implementation/graphics/brushes/pdf-radial-gradient-brush.ts +0 -290
  57. package/dist/ts/implementation/graphics/brushes/pdf-solid-brush.ts +0 -107
  58. package/dist/ts/implementation/graphics/brushes/pdf-tiling-brush.ts +0 -304
  59. package/dist/ts/implementation/graphics/constants.ts +0 -31
  60. package/dist/ts/implementation/graphics/enum.ts +0 -413
  61. package/dist/ts/implementation/graphics/figures/arc.ts +0 -133
  62. package/dist/ts/implementation/graphics/figures/base/draw-element.ts +0 -59
  63. package/dist/ts/implementation/graphics/figures/base/element-layouter.ts +0 -260
  64. package/dist/ts/implementation/graphics/figures/base/fill-element.ts +0 -72
  65. package/dist/ts/implementation/graphics/figures/base/graphics-element.ts +0 -34
  66. package/dist/ts/implementation/graphics/figures/base/pdf-shape-element.ts +0 -69
  67. package/dist/ts/implementation/graphics/figures/base/shape-layouter.ts +0 -276
  68. package/dist/ts/implementation/graphics/figures/base/text-layouter.ts +0 -205
  69. package/dist/ts/implementation/graphics/figures/ellipse-part.ts +0 -76
  70. package/dist/ts/implementation/graphics/figures/enum.ts +0 -80
  71. package/dist/ts/implementation/graphics/figures/layout-element.ts +0 -132
  72. package/dist/ts/implementation/graphics/figures/path.ts +0 -646
  73. package/dist/ts/implementation/graphics/figures/pdf-template.ts +0 -205
  74. package/dist/ts/implementation/graphics/figures/rectangle-area.ts +0 -108
  75. package/dist/ts/implementation/graphics/figures/text-element.ts +0 -445
  76. package/dist/ts/implementation/graphics/fonts/enum.ts +0 -385
  77. package/dist/ts/implementation/graphics/fonts/pdf-font-metrics.ts +0 -248
  78. package/dist/ts/implementation/graphics/fonts/pdf-font.ts +0 -316
  79. package/dist/ts/implementation/graphics/fonts/pdf-standard-font-metrics-factory.ts +0 -606
  80. package/dist/ts/implementation/graphics/fonts/pdf-standard-font.ts +0 -243
  81. package/dist/ts/implementation/graphics/fonts/pdf-string-format.ts +0 -474
  82. package/dist/ts/implementation/graphics/fonts/pdf-true-type-font.ts +0 -165
  83. package/dist/ts/implementation/graphics/fonts/rtl/rtl-bidirectional.ts +0 -958
  84. package/dist/ts/implementation/graphics/fonts/rtl/rtl-text-shape.ts +0 -374
  85. package/dist/ts/implementation/graphics/fonts/rtl-renderer.ts +0 -255
  86. package/dist/ts/implementation/graphics/fonts/string-layouter.ts +0 -617
  87. package/dist/ts/implementation/graphics/fonts/string-tokenizer.ts +0 -275
  88. package/dist/ts/implementation/graphics/fonts/ttf-OS2-Table.ts +0 -206
  89. package/dist/ts/implementation/graphics/fonts/ttf-apple-cmap-sub-table.ts +0 -18
  90. package/dist/ts/implementation/graphics/fonts/ttf-cmap-sub-table.ts +0 -18
  91. package/dist/ts/implementation/graphics/fonts/ttf-cmap-table.ts +0 -14
  92. package/dist/ts/implementation/graphics/fonts/ttf-glyph-header.ts +0 -26
  93. package/dist/ts/implementation/graphics/fonts/ttf-glyph-info.ts +0 -35
  94. package/dist/ts/implementation/graphics/fonts/ttf-head-table.ts +0 -94
  95. package/dist/ts/implementation/graphics/fonts/ttf-horizontal-header-table.ts +0 -56
  96. package/dist/ts/implementation/graphics/fonts/ttf-loca-table.ts +0 -10
  97. package/dist/ts/implementation/graphics/fonts/ttf-long-hor-metric.ts +0 -14
  98. package/dist/ts/implementation/graphics/fonts/ttf-metrics.ts +0 -106
  99. package/dist/ts/implementation/graphics/fonts/ttf-microsoft-cmap-sub-table.ts +0 -58
  100. package/dist/ts/implementation/graphics/fonts/ttf-name-record.ts +0 -33
  101. package/dist/ts/implementation/graphics/fonts/ttf-name-table.ts +0 -22
  102. package/dist/ts/implementation/graphics/fonts/ttf-post-table.ts +0 -42
  103. package/dist/ts/implementation/graphics/fonts/ttf-reader.ts +0 -1254
  104. package/dist/ts/implementation/graphics/fonts/ttf-table-info.ts +0 -26
  105. package/dist/ts/implementation/graphics/fonts/ttf-trimmed-cmap-sub-table.ts +0 -26
  106. package/dist/ts/implementation/graphics/fonts/unicode-true-type-font.ts +0 -577
  107. package/dist/ts/implementation/graphics/images/byte-array.ts +0 -137
  108. package/dist/ts/implementation/graphics/images/image-decoder.ts +0 -439
  109. package/dist/ts/implementation/graphics/images/pdf-bitmap.ts +0 -110
  110. package/dist/ts/implementation/graphics/images/pdf-image.ts +0 -132
  111. package/dist/ts/implementation/graphics/pdf-color.ts +0 -478
  112. package/dist/ts/implementation/graphics/pdf-graphics.ts +0 -2429
  113. package/dist/ts/implementation/graphics/pdf-margins.ts +0 -124
  114. package/dist/ts/implementation/graphics/pdf-pen.ts +0 -370
  115. package/dist/ts/implementation/graphics/pdf-resources.ts +0 -300
  116. package/dist/ts/implementation/graphics/pdf-transformation-matrix.ts +0 -246
  117. package/dist/ts/implementation/graphics/pdf-transparency.ts +0 -93
  118. package/dist/ts/implementation/graphics/unit-convertor.ts +0 -96
  119. package/dist/ts/implementation/input-output/big-endian-writer.ts +0 -121
  120. package/dist/ts/implementation/input-output/cross-table.ts +0 -21
  121. package/dist/ts/implementation/input-output/enum.ts +0 -16
  122. package/dist/ts/implementation/input-output/pdf-cross-table.ts +0 -524
  123. package/dist/ts/implementation/input-output/pdf-dictionary-properties.ts +0 -571
  124. package/dist/ts/implementation/input-output/pdf-main-object-collection.ts +0 -194
  125. package/dist/ts/implementation/input-output/pdf-operators.ts +0 -363
  126. package/dist/ts/implementation/input-output/pdf-stream-writer.ts +0 -681
  127. package/dist/ts/implementation/input-output/pdf-writer.ts +0 -88
  128. package/dist/ts/implementation/pages/enum.ts +0 -201
  129. package/dist/ts/implementation/pages/page-added-event-arguments.ts +0 -39
  130. package/dist/ts/implementation/pages/pdf-document-page-collection.ts +0 -180
  131. package/dist/ts/implementation/pages/pdf-page-base.ts +0 -181
  132. package/dist/ts/implementation/pages/pdf-page-layer-collection.ts +0 -348
  133. package/dist/ts/implementation/pages/pdf-page-layer.ts +0 -271
  134. package/dist/ts/implementation/pages/pdf-page-settings.ts +0 -192
  135. package/dist/ts/implementation/pages/pdf-page-size.ts +0 -162
  136. package/dist/ts/implementation/pages/pdf-page-template-element.ts +0 -663
  137. package/dist/ts/implementation/pages/pdf-page.ts +0 -235
  138. package/dist/ts/implementation/pages/pdf-section-collection.ts +0 -187
  139. package/dist/ts/implementation/pages/pdf-section-page-collection.ts +0 -61
  140. package/dist/ts/implementation/pages/pdf-section-templates.ts +0 -96
  141. package/dist/ts/implementation/pages/pdf-section.ts +0 -644
  142. package/dist/ts/implementation/primitives/pdf-array.ts +0 -386
  143. package/dist/ts/implementation/primitives/pdf-boolean.ts +0 -119
  144. package/dist/ts/implementation/primitives/pdf-dictionary.ts +0 -513
  145. package/dist/ts/implementation/primitives/pdf-name.ts +0 -218
  146. package/dist/ts/implementation/primitives/pdf-number.ts +0 -165
  147. package/dist/ts/implementation/primitives/pdf-reference.ts +0 -430
  148. package/dist/ts/implementation/primitives/pdf-stream.ts +0 -306
  149. package/dist/ts/implementation/primitives/pdf-string.ts +0 -397
  150. package/dist/ts/implementation/structured-elements/grid/layout/grid-layouter.ts +0 -2027
  151. package/dist/ts/implementation/structured-elements/grid/pdf-grid-cell.ts +0 -1193
  152. package/dist/ts/implementation/structured-elements/grid/pdf-grid-column.ts +0 -206
  153. package/dist/ts/implementation/structured-elements/grid/pdf-grid-row.ts +0 -470
  154. package/dist/ts/implementation/structured-elements/grid/pdf-grid.ts +0 -853
  155. package/dist/ts/implementation/structured-elements/grid/styles/pdf-borders.ts +0 -240
  156. package/dist/ts/implementation/structured-elements/grid/styles/style.ts +0 -424
  157. package/dist/ts/implementation/structured-elements/tables/light-tables/enum.ts +0 -16
  158. package/dist/ts/interfaces/i-pdf-cache.ts +0 -23
  159. package/dist/ts/interfaces/i-pdf-changable.ts +0 -17
  160. package/dist/ts/interfaces/i-pdf-clonable.ts +0 -12
  161. package/dist/ts/interfaces/i-pdf-primitives.ts +0 -45
  162. package/dist/ts/interfaces/i-pdf-true-type-font.ts +0 -48
  163. package/dist/ts/interfaces/i-pdf-wrapper.ts +0 -13
  164. package/dist/ts/interfaces/i-pdf-writer.ts +0 -29
@@ -1,1193 +0,0 @@
1
- /**
2
- * `PdfGridCell.ts` class for EJ2-PDF
3
- */
4
- import { PdfGridRow } from './pdf-grid-row';
5
- import { PdfGrid } from './pdf-grid';
6
- import { PdfGridCellStyle } from './styles/style';
7
- import { PdfStringLayouter, PdfStringLayoutResult } from './../../graphics/fonts/string-layouter';
8
- import { PdfDocument } from './../../document/pdf-document';
9
- import { PdfFont } from './../../graphics/fonts/pdf-font';
10
- import { PdfBrush } from './../../graphics/brushes/pdf-brush';
11
- import { PdfPen } from './../../graphics/pdf-pen';
12
- import { PdfStringFormat } from './../../graphics/fonts/pdf-string-format';
13
- import { RectangleF, PointF, SizeF } from './../../drawing/pdf-drawing';
14
- import { PdfGraphics } from './../../graphics/pdf-graphics';
15
- import { PdfDashStyle, PdfLineCap } from './../../graphics/enum';
16
- import { PdfBorderOverlapStyle } from './../tables/light-tables/enum';
17
- import { PdfSolidBrush } from './../../graphics/brushes/pdf-solid-brush';
18
- import { PdfColor } from './../../graphics/pdf-color';
19
- import { PdfImage } from './../../graphics/images/pdf-image';
20
- import { PdfBitmap } from './../../graphics/images/pdf-bitmap';
21
- import { PdfTextWebLink } from './../../annotations/pdf-text-web-link';
22
- import { PdfPage } from './../../pages/pdf-page';
23
- import { PdfLayoutType } from './../../graphics/figures/enum';
24
- import { PdfGridLayouter , PdfGridLayoutFormat } from './../../structured-elements/grid/layout/grid-layouter';
25
- import { PdfLayoutParams, PdfLayoutResult, PdfLayoutFormat } from '../../../implementation/graphics/figures/base/element-layouter';
26
- /**
27
- * `PdfGridCell` class represents the schema of a cell in a 'PdfGrid'.
28
- */
29
- export class PdfGridCell {
30
- //Fields
31
- _rowHeight: number;
32
- /**
33
- * The `row span`.
34
- * @private
35
- */
36
- private gridRowSpan : number;
37
- /**
38
- * The `column span`.
39
- * @private
40
- */
41
- private colSpan : number;
42
- /**
43
- * Specifies the current `row`.
44
- * @private
45
- */
46
- private gridRow : PdfGridRow;
47
- /**
48
- * The actual `value` of the cell.
49
- * @private
50
- */
51
- private objectValue : Object;
52
- /**
53
- * Current cell `style`.
54
- * @private
55
- */
56
- private cellStyle : PdfGridCellStyle;
57
- /**
58
- * `Width` of the cell.
59
- * @default 0
60
- * @private
61
- */
62
- private cellWidth : number = 0;
63
- /**
64
- * `Height` of the cell.
65
- * @default 0
66
- * @private
67
- */
68
- private cellHeight : number = 0;
69
- /**
70
- * `tempval`to stores current width .
71
- * @default 0
72
- * @private
73
- */
74
- private tempval : number = 0;
75
- private fontSpilt : boolean = false;
76
- /**
77
- * The `remaining string`.
78
- * @private
79
- */
80
- private remaining : string;
81
- /**
82
- * Specifies weather the `cell is drawn`.
83
- * @default true
84
- * @private
85
- */
86
- private finsh : boolean = true;
87
- /**
88
- * 'parent ' of the grid cell.
89
- * @private
90
- */
91
- private parent : PdfGridCell ;
92
- /**
93
- * `StringFormat` of the cell.
94
- * @private
95
- */
96
- private format : PdfStringFormat;
97
- /**
98
- * The `remaining height` of row span.
99
- * @default 0
100
- * @private
101
- */
102
- public rowSpanRemainingHeight : number = 0;
103
- private internalIsCellMergeContinue : boolean;
104
- private internalIsRowMergeContinue : boolean;
105
- private internalIsCellMergeStart : boolean;
106
- private internalIsRowMergeStart : boolean;
107
- public hasRowSpan : boolean = false;
108
- public hasColSpan : boolean = false;
109
- /**
110
- * the 'isFinish' is set to page finish
111
- */
112
- private isFinish : boolean = true;
113
- /**
114
- * The `present' to store the current cell.
115
- * @default false
116
- * @private
117
- */
118
- public present : boolean = false;
119
- /**
120
- * The `Count` of the page.
121
- * @private
122
- */
123
- public pageCount : number ;
124
- //constructor
125
- /**
126
- * Initializes a new instance of the `PdfGridCell` class.
127
- * @private
128
- */
129
- public constructor()
130
- /**
131
- * Initializes a new instance of the `PdfGridCell` class.
132
- * @private
133
- */
134
- public constructor(row : PdfGridRow)
135
- public constructor(row ?: PdfGridRow) {
136
- this.gridRowSpan = 1;
137
- this.colSpan = 1;
138
- if (typeof row !== 'undefined') {
139
- this.gridRow = row;
140
- }
141
- }
142
- //Properties
143
- public get isCellMergeContinue() : boolean {
144
- return this.internalIsCellMergeContinue;
145
- }
146
- public set isCellMergeContinue(value : boolean) {
147
- this.internalIsCellMergeContinue = value;
148
- }
149
- public get isRowMergeContinue() : boolean {
150
- return this.internalIsRowMergeContinue;
151
- }
152
- public set isRowMergeContinue(value : boolean) {
153
- this.internalIsRowMergeContinue = value;
154
- }
155
- public get isCellMergeStart() : boolean {
156
- return this.internalIsCellMergeStart;
157
- }
158
- public set isCellMergeStart(value : boolean) {
159
- this.internalIsCellMergeStart = value;
160
- }
161
- public get isRowMergeStart() : boolean {
162
- return this.internalIsRowMergeStart;
163
- }
164
- public set isRowMergeStart(value : boolean) {
165
- this.internalIsRowMergeStart = value;
166
- }
167
- /**
168
- * Gets or sets the `remaining string` after the row split between pages.
169
- * @private
170
- */
171
- public get remainingString() : string {
172
- return this.remaining;
173
- }
174
- public set remainingString(value : string) {
175
- this.remaining = value;
176
- }
177
- /**
178
- * Gets or sets the `FinishedDrawingCell` .
179
- * @private
180
- */
181
- public get FinishedDrawingCell() : boolean {
182
- return this.isFinish;
183
- }
184
- public set FinishedDrawingCell(value : boolean) {
185
- this.isFinish = value;
186
- }
187
- /**
188
- * Gets or sets the `string format`.
189
- * @private
190
- */
191
- public get stringFormat() : PdfStringFormat {
192
- if (this.format == null) {
193
- this.format = new PdfStringFormat();
194
- }
195
- return this.format;
196
- }
197
- public set stringFormat(value : PdfStringFormat) {
198
- this.format = value;
199
- }
200
- /**
201
- * Gets or sets the parent `row`.
202
- * @private
203
- */
204
- public get row() : PdfGridRow {
205
- return this.gridRow;
206
- }
207
- public set row(value : PdfGridRow) {
208
- this.gridRow = value;
209
- }
210
- /**
211
- * Gets or sets the `value` of the cell.
212
- * @private
213
- */
214
- public get value() : Object {
215
- return this.objectValue;
216
- }
217
- public set value(value : Object) {
218
- this.objectValue = value;
219
- if (this.objectValue instanceof PdfGrid) {
220
- this.row.grid.isSingleGrid = false;
221
- let grid : PdfGrid = this.objectValue as PdfGrid;
222
- grid.ParentCell = this;
223
- (this.objectValue as PdfGrid).isChildGrid = true;
224
- let rowCount : number = this.row.grid.rows.count;
225
- for (let i : number = 0; i < rowCount; i++) {
226
- let row : PdfGridRow = this.row.grid.rows.getRow(i);
227
- let colCount : number = row.cells.count;
228
- for (let j : number = 0; j < colCount; j++) {
229
- let cell : PdfGridCell = row.cells.getCell(j);
230
- cell.parent = this;
231
- }
232
- }
233
- }
234
- }
235
- /**
236
- * Gets or sets a value that indicates the total number of rows that cell `spans` within a PdfGrid.
237
- * @private
238
- */
239
- public get rowSpan() : number {
240
- return this.gridRowSpan;
241
- }
242
- public set rowSpan(value : number) {
243
- if (value < 1) {
244
- throw new Error('ArgumentException : Invalid span specified, must be greater than or equal to 1');
245
- } else {
246
- this.gridRowSpan = value;
247
- this.row.rowSpanExists = true;
248
- this.row.grid.hasRowSpanSpan = true;
249
- }
250
- }
251
- /**
252
- * Gets or sets the cell `style`.
253
- * @private
254
- */
255
- public get style() : PdfGridCellStyle {
256
- if (this.cellStyle == null) {
257
- this.cellStyle = new PdfGridCellStyle();
258
- }
259
- return this.cellStyle;
260
- }
261
- public set style(value : PdfGridCellStyle) {
262
- this.cellStyle = value;
263
- }
264
- /**
265
- * Gets the `height` of the PdfGrid cell.[Read-Only].
266
- * @private
267
- */
268
- public get height() : number {
269
- if (this.cellHeight === 0) {
270
- this.cellHeight = this.measureHeight();
271
- }
272
- return this.cellHeight;
273
- }
274
- public set height(value : number) {
275
- this.cellHeight = value;
276
- }
277
- /**
278
- * Gets or sets a value that indicates the total number of columns that cell `spans` within a PdfGrid.
279
- * @private
280
- */
281
- public get columnSpan() : number {
282
- return this.colSpan;
283
- }
284
- public set columnSpan(value : number) {
285
- if (value < 1) {
286
- throw Error('Invalid span specified, must be greater than or equal to 1');
287
- } else {
288
- this.colSpan = value;
289
- this.row.columnSpanExists = true;
290
- }
291
- }
292
- /**
293
- * Gets the `width` of the PdfGrid cell.[Read-Only].
294
- * @private
295
- */
296
- public get width() : number {
297
- if (this.cellWidth === 0 || this.row.grid.isComplete) {
298
- this.cellWidth = this.measureWidth();
299
- }
300
- return Math.round(this.cellWidth);
301
- }
302
- public set width(value : number) {
303
- this.cellWidth = value;
304
- }
305
- //Implementation
306
- /**
307
- * `Calculates the width`.
308
- * @private
309
- */
310
- private measureWidth() : number {
311
- // .. Calculate the cell text width.
312
- // .....Add border widths, cell spacings and paddings to the width.
313
- let width : number = 0;
314
- let layouter : PdfStringLayouter = new PdfStringLayouter();
315
- if (typeof this.objectValue === 'string') {
316
- /* tslint:disable */
317
- let slr : PdfStringLayoutResult = layouter.layout((this.objectValue as string), this.getTextFont(), this.stringFormat, new SizeF(Number.MAX_VALUE, Number.MAX_VALUE), false, new SizeF(0, 0));
318
- width += slr.actualSize.width;
319
- width += (this.style.borders.left.width + this.style.borders.right.width) * 2;
320
- } else if (this.objectValue instanceof PdfGrid) {
321
- width = (this.objectValue as PdfGrid).size.width;
322
- //width += this.objectValue.style.cellSpacing;
323
- } else if (this.objectValue instanceof PdfImage || this.objectValue instanceof PdfBitmap) {
324
- width += (this.objectValue as PdfImage).width;
325
- } else if (this.objectValue instanceof PdfTextWebLink) {
326
- let webLink : PdfTextWebLink = this.objectValue as PdfTextWebLink;
327
- let result : PdfStringLayoutResult = layouter.layout(webLink.text, webLink.font, webLink.stringFormat, new SizeF(0, 0), false, new SizeF(0, 0));
328
- /* tslint:enable */
329
- width += result.actualSize.width;
330
- width += (this.style.borders.left.width + this.style.borders.right.width) * 2;
331
- }
332
- if (!(this.objectValue instanceof PdfGrid)) {
333
- if (this.style.cellPadding != null) {
334
- width += (this.style.cellPadding.left + this.style.cellPadding.right);
335
- } else {
336
- width += (this.row.grid.style.cellPadding.left + this.row.grid.style.cellPadding.right);
337
- }
338
- } else {
339
- if (this.style.cellPadding != null || typeof this.style.cellPadding !== 'undefined') {
340
- if (typeof this.style.cellPadding.left !== 'undefined' && this.style.cellPadding.hasLeftPad) {
341
- width += this.style.cellPadding.left;
342
- }
343
- if (typeof this.style.cellPadding.right !== 'undefined' && this.style.cellPadding.hasRightPad) {
344
- width += this.style.cellPadding.right;
345
- }
346
- } else {
347
- if (typeof this.row.grid.style.cellPadding.left !== 'undefined' && this.row.grid.style.cellPadding.hasLeftPad) {
348
- width += this.row.grid.style.cellPadding.left;
349
- }
350
- if (typeof this.row.grid.style.cellPadding.right !== 'undefined' && this.row.grid.style.cellPadding.hasRightPad) {
351
- width += this.row.grid.style.cellPadding.right;
352
- }
353
- }
354
- }
355
- width += this.row.grid.style.cellSpacing;
356
- return width;
357
- }
358
- /**
359
- * Draw the `cell background`.
360
- * @private
361
- */
362
- public drawCellBackground(graphics : PdfGraphics, bounds : RectangleF) : void {
363
- let backgroundBrush : PdfBrush = this.getBackgroundBrush();
364
- //graphics.isTemplateGraphics = true;
365
- if (backgroundBrush != null) {
366
- graphics.save();
367
- graphics.drawRectangle(backgroundBrush, bounds.x, bounds.y, bounds.width, bounds.height);
368
- graphics.restore();
369
- }
370
- if (this.style.backgroundImage != null) {
371
- let image : PdfImage = this.getBackgroundImage();
372
- graphics.drawImage(this.style.backgroundImage, bounds.x, bounds.y, bounds.width, bounds.height);
373
- }
374
- }
375
- /**
376
- * `Adjusts the text layout area`.
377
- * @private
378
- */
379
- /* tslint:disable */
380
- private adjustContentLayoutArea(bounds : RectangleF) : RectangleF {
381
- //Add Padding value to its Cell Bounds
382
- let returnBounds : RectangleF = new RectangleF(bounds.x, bounds.y, bounds.width, bounds.height);
383
- if (!(this.objectValue instanceof PdfGrid))
384
- {
385
- if (typeof this.style.cellPadding === 'undefined' || this.style.cellPadding == null) {
386
- returnBounds.x += this.gridRow.grid.style.cellPadding.left + this.cellStyle.borders.left.width;
387
- returnBounds.y += this.gridRow.grid.style.cellPadding.top + this.cellStyle.borders.top.width;
388
- returnBounds.width -= (this.gridRow.grid.style.cellPadding.right + this.gridRow.grid.style.cellPadding.left);
389
- returnBounds.height -= (this.gridRow.grid.style.cellPadding.bottom + this.gridRow.grid.style.cellPadding.top);
390
- returnBounds.height -= (this.cellStyle.borders.top.width + this.cellStyle.borders.bottom.width);
391
- } else {
392
- returnBounds.x += this.style.cellPadding.left + this.cellStyle.borders.left.width;
393
- returnBounds.y += this.style.cellPadding.top + this.cellStyle.borders.top.width;
394
- returnBounds.width -= (this.style.cellPadding.right + this.style.cellPadding.left);
395
- returnBounds.width -= (this.cellStyle.borders.left.width + this.cellStyle.borders.right.width);
396
- returnBounds.height -= (this.style.cellPadding.bottom + this.style.cellPadding.top);
397
- returnBounds.height -= (this.cellStyle.borders.top.width + this.cellStyle.borders.bottom.width);
398
- if (this.rowSpan === 1) {
399
- returnBounds.width -= (this.style.borders.left.width);
400
- }
401
- }
402
- }
403
- else{
404
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined')
405
- {
406
- if(typeof this.gridRow.grid.style.cellPadding.left !== 'undefined' && this.gridRow.grid.style.cellPadding.hasLeftPad){
407
- returnBounds.x += this.gridRow.grid.style.cellPadding.left + this.cellStyle.borders.left.width;
408
- returnBounds.width -= this.gridRow.grid.style.cellPadding.left;
409
- }
410
- if(typeof this.gridRow.grid.style.cellPadding.top !== 'undefined' && this.gridRow.grid.style.cellPadding.hasTopPad){
411
- returnBounds.y += this.gridRow.grid.style.cellPadding.top + this.cellStyle.borders.top.width;
412
- returnBounds.height -= this.gridRow.grid.style.cellPadding.top;
413
- }
414
- if(typeof this.gridRow.grid.style.cellPadding.right !== 'undefined' && this.gridRow.grid.style.cellPadding.hasRightPad){
415
- returnBounds.width -= this.gridRow.grid.style.cellPadding.right;
416
- }
417
- if(typeof this.gridRow.grid.style.cellPadding.bottom !== 'undefined' && this.gridRow.grid.style.cellPadding.hasBottomPad){
418
- returnBounds.height -= this.gridRow.grid.style.cellPadding.bottom;
419
- }
420
- }
421
- else
422
- {
423
- if(typeof this.style.cellPadding.left !== 'undefined' && this.style.cellPadding.hasLeftPad) {
424
- returnBounds.x += this.style.cellPadding.left + this.cellStyle.borders.left.width;
425
- returnBounds.width -= this.style.cellPadding.left;
426
- }
427
- if(typeof this.style.cellPadding.top !== 'undefined' && this.style.cellPadding.hasTopPad) {
428
- returnBounds.y += this.style.cellPadding.top + this.cellStyle.borders.top.width;
429
- returnBounds.height -= this.style.cellPadding.top;
430
- }
431
- if(typeof this.style.cellPadding.right !== 'undefined' && this.style.cellPadding.hasRightPad){
432
- returnBounds.width -= this.style.cellPadding.right;
433
- }
434
- if(typeof this.style.cellPadding.bottom !== 'undefined' && this.style.cellPadding.hasBottomPad){
435
- returnBounds.height -= this.style.cellPadding.bottom;
436
- }
437
- }
438
- returnBounds.width -= (this.cellStyle.borders.left.width + this.cellStyle.borders.right.width);
439
- returnBounds.height -= (this.cellStyle.borders.top.width + this.cellStyle.borders.bottom.width);
440
- }
441
- return returnBounds;
442
- }
443
- /**
444
- * `Draws` the specified graphics.
445
- * @private
446
- */
447
- public draw(graphics : PdfGraphics, bounds : RectangleF, cancelSubsequentSpans : boolean) : PdfStringLayoutResult {
448
- let isrowbreak : boolean = false;
449
- /*if (!this.row.grid.isSingleGrid)
450
- {
451
- //Check whether the Grid Span to Nextpage
452
- if ((this.remainingString != null) || (PdfGridLayouter.repeatRowIndex != -1))
453
- {
454
- this.DrawParentCells(graphics, bounds, true);
455
- }
456
- else if (this.row.grid.rows.count > 1)
457
- {
458
- for (let i : number = 0; i < this.row.grid.rows.count; i++)
459
- {
460
- if (this.row == this.row.grid.rows.getRow(i))
461
- {
462
- if (this.row.grid.rows.getRow(i).rowBreakHeight > 0)
463
- isrowbreak = true;
464
- if ((i > 0) && (isrowbreak))
465
- this.DrawParentCells(graphics, bounds, false);
466
- }
467
- }
468
- }
469
- } */
470
- let result : PdfStringLayoutResult = null;
471
- /*if (cancelSubsequentSpans)
472
- {
473
- //..Cancel all subsequent cell spans, if no space exists.
474
- let currentCellIndex : number = this.row.cells.indexOf(this);
475
- for (let i : number = currentCellIndex + 1; i <= currentCellIndex + this.colSpan; i++)
476
- {
477
- this.row.cells.getCell(i).isCellMergeContinue = false;
478
- this.row.cells.getCell(i).isRowMergeContinue = false;
479
- }
480
- this.colSpan = 1;
481
- }*/
482
- //..Skip cells which were already covered by spanmap.
483
- if (this.internalIsCellMergeContinue || this.internalIsRowMergeContinue) {
484
- if (this.internalIsCellMergeContinue && this.row.grid.style.allowHorizontalOverflow) {
485
- if ((this.row.rowOverflowIndex > 0 && (this.row.cells.indexOf(this) != this.row.rowOverflowIndex + 1)) || (this.row.rowOverflowIndex == 0 && this.internalIsCellMergeContinue)) {
486
- return result;
487
- }
488
- }
489
- else {
490
- return result;
491
- }
492
- }
493
- //Adjust bounds with Row and Column Spacing
494
- bounds = this.adjustOuterLayoutArea(bounds, graphics);
495
- this.drawCellBackground(graphics, bounds);
496
- let textPen : PdfPen = this.getTextPen();
497
- let textBrush : PdfBrush = this.getTextBrush();
498
- if (typeof textPen === 'undefined' && typeof textBrush === 'undefined') {
499
- textBrush = new PdfSolidBrush(new PdfColor(0, 0, 0));
500
- }
501
- let font : PdfFont = this.getTextFont();
502
- let strFormat : PdfStringFormat = this.getStringFormat();
503
- let innerLayoutArea : RectangleF = bounds;
504
- if (innerLayoutArea.height >= graphics.clientSize.height)
505
- {
506
- // If to break row to next page.
507
- if (this.row.grid.allowRowBreakAcrossPages)
508
- {
509
- innerLayoutArea.height -= innerLayoutArea.y;
510
- if (typeof this._rowHeight !== 'undefined' && this._rowHeight !== null && innerLayoutArea.height > this._rowHeight) {
511
- innerLayoutArea.height = this._rowHeight;
512
- }
513
- //bounds.height -= bounds.y;
514
- // if(this.row.grid.isChildGrid)
515
- // {
516
- // innerLayoutArea.height -= this.row.grid.ParentCell.row.grid.style.cellPadding.bottom;
517
- // }
518
- }
519
- // if user choose to cut the row whose height is more than page height.
520
- // else
521
- // {
522
- // innerLayoutArea.height = graphics.clientSize.height;
523
- // bounds.height = graphics.clientSize.height;
524
- // }
525
- }
526
- innerLayoutArea = this.adjustContentLayoutArea(innerLayoutArea);
527
- if (typeof this.objectValue === 'string' || typeof this.remaining === 'string') {
528
- let temp : string;
529
- let layoutRectangle : RectangleF;
530
- if (innerLayoutArea.height < font.height)
531
- layoutRectangle = new RectangleF(innerLayoutArea.x, innerLayoutArea.y, innerLayoutArea.width, font.height);
532
- else
533
- layoutRectangle = innerLayoutArea;
534
- if (innerLayoutArea.height < font.height && this.row.grid.isChildGrid && this.row.grid.ParentCell != null)
535
- {
536
- let height : number = layoutRectangle.height - this.row.grid.ParentCell.row.grid.style.cellPadding.bottom - this.row.grid.style.cellPadding.bottom;
537
- if(this.row.grid.splitChildRowIndex != -1){
538
- this.fontSpilt = true;
539
- this.row.rowFontSplit = true;
540
- }
541
- if (height > 0 && height < font.height)
542
- layoutRectangle.height = height;
543
- // else if (height + this.row.grid.style.cellPadding.bottom > 0 && height + this.row.grid.style.cellPadding.bottom < font.height)
544
- // layoutRectangle.height = height + this.row.grid.style.cellPadding.bottom;
545
- // else if (bounds.height < font.height)
546
- // layoutRectangle.height = bounds.height;
547
- // else if (bounds.height - this.row.grid.ParentCell.row.grid.style.cellPadding.bottom < font.height)
548
- // layoutRectangle.height = bounds.height - this.row.grid.ParentCell.row.grid.style.cellPadding.bottom;
549
- }
550
-
551
- if(this.gridRow.grid.style.cellSpacing != 0) {
552
- layoutRectangle.width -= this.gridRow.grid.style.cellSpacing;
553
- bounds.width -= this.gridRow.grid.style.cellSpacing;
554
- }
555
-
556
- if (this.isFinish) {
557
- // if (this.row.grid.splitChildRowIndex != -1 && !this.row.grid.isChildGrid && typeof this.remaining === 'undefined'){
558
- // this.remaining = '';
559
- // graphics.drawString(this.remaining, font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
560
- // } else {
561
- temp = this.remaining === '' ? this.remaining : (this.objectValue as string);
562
- graphics.drawString(temp, font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
563
- if (this.row.grid.splitChildRowIndex != -1 && !this.row.grid.isChildGrid && typeof this.remaining === 'undefined'){
564
- this.remaining = '';
565
- //graphics.drawString(this.remaining, font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
566
- }
567
- }
568
- else {
569
- if(typeof this.remaining == 'undefined' ||this.remaining === null){
570
- this.remaining = '';
571
- }
572
- if (this.row.repeatFlag) {
573
- graphics.drawString((this.remaining as string), font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
574
- }
575
- // else {
576
- // if(this.row.grid.ParentCell.row.repeatFlag) {
577
- // graphics.drawString((this.remaining as string), font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
578
- // } else {
579
- // layoutRectangle.height = this.row.height;
580
- // graphics.drawString((this.objectValue as string), font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
581
- // bounds.height = this.row.height;
582
-
583
- // }
584
-
585
- // }
586
- this.isFinish = true;
587
- //graphics.drawString((this.remaining as string), font, textPen, textBrush, layoutRectangle.x, layoutRectangle.y, layoutRectangle.width, layoutRectangle.height, strFormat);
588
- }
589
- result = graphics.stringLayoutResult;
590
- // if(this.row.grid.isChildGrid && this.row.rowBreakHeight > 0 && result !=null) {
591
- // bounds.height -= this.row.grid.ParentCell.row.grid.style.cellPadding.bottom;
592
- // }
593
- } else if (this.objectValue instanceof PdfGrid ) {
594
- let childGrid : PdfGrid = this.objectValue as PdfGrid;
595
- childGrid.isChildGrid = true;
596
- childGrid.ParentCell = this;
597
- let layoutRect : RectangleF;
598
- layoutRect = innerLayoutArea;
599
-
600
- if(this.gridRow.grid.style.cellSpacing != 0){
601
- bounds.width -= this.gridRow.grid.style.cellSpacing;
602
- }
603
- // layoutRect = bounds;
604
- // if (this.style.cellPadding != null){
605
- // layoutRect = bounds;
606
- // } else if((this.row.grid.style.cellPadding != null) && (childGrid.style.cellPadding.bottom === 0.5) && (childGrid.style.cellPadding.top === 0.5)
607
- // && (childGrid.style.cellPadding.left === 5.76) && (childGrid.style.cellPadding.right === 5.76)
608
- // && (this.gridRow.grid.style.cellSpacing === 0) && (childGrid.style.cellSpacing === 0)) {
609
- // layoutRect = innerLayoutArea;
610
- // }
611
- // if(this.objectValue.style.cellPadding != null && typeof this.objectValue.style.cellPadding !== 'undefined'){
612
- // layoutRect = bounds;
613
- // }
614
- let layouter : PdfGridLayouter= new PdfGridLayouter(childGrid);
615
- let format : PdfLayoutFormat = new PdfGridLayoutFormat();
616
- if (this.row.grid.LayoutFormat != null)
617
- format = this.row.grid.LayoutFormat;
618
- else
619
- format.layout = PdfLayoutType.Paginate;
620
-
621
- let param : PdfLayoutParams = new PdfLayoutParams();
622
- if (graphics.layer != null)
623
- {
624
- // Define layout parameters.
625
- param.page = graphics.page as PdfPage;
626
- param.bounds = layoutRect;
627
- param.format = format;
628
- //Set the span
629
- childGrid.setSpan();
630
- childGrid.checkSpan();
631
- // Draw the child grid.
632
- let childGridResult : PdfLayoutResult = layouter.Layouter(param);
633
-
634
- //let childGridResult : PdfLayoutResult = layouter.innerLayout(param);
635
- this.value = childGrid;
636
- if(this.row.grid.splitChildRowIndex !== -1){
637
- this.height = this.row.rowBreakHeightValue;
638
- }
639
- if (param.page != childGridResult.page) //&& (isWidthGreaterthanParent != true))
640
- {
641
- childGridResult.bounds.height = this.row.rowBreakHeightValue;
642
- if(this.row.rowBreakHeight == 0)
643
- this.row.NestedGridLayoutResult = childGridResult;
644
- else
645
- this.row.rowBreakHeight = this.row.rowBreakHeightValue;
646
- //bounds.height = this.row.rowBreakHeight;
647
-
648
-
649
- //After drawing paginated nested grid, the bounds of the parent grid in start page should be corrected for borders.
650
- //bounds.height = graphics.clientSize.height - bounds.y;
651
-
652
- }
653
- }
654
-
655
- } else if (this.objectValue instanceof PdfImage || this.objectValue instanceof PdfBitmap) {
656
- let imageBounds : RectangleF;
657
- if ((this.objectValue as PdfImage).width <= innerLayoutArea.width) {
658
- imageBounds = new RectangleF(innerLayoutArea.x, innerLayoutArea.y, (this.objectValue as PdfImage).width, innerLayoutArea.height);
659
- } else {
660
- imageBounds = innerLayoutArea;
661
- }
662
- graphics.drawImage(this.objectValue as PdfImage, imageBounds.x, imageBounds.y, imageBounds.width, imageBounds.height);
663
- } else if (this.objectValue instanceof PdfTextWebLink) {
664
- (this.objectValue as PdfTextWebLink).draw(graphics.currentPage, innerLayoutArea);
665
- } else if (typeof this.objectValue === 'undefined') {
666
- this.objectValue = "";
667
- graphics.drawString(this.objectValue as string, font, textPen, textBrush, innerLayoutArea.x, innerLayoutArea.y,innerLayoutArea.width, innerLayoutArea.height,strFormat);
668
- if (this.style.cellPadding != null && this.style.cellPadding.bottom == 0 && this.style.cellPadding.left == 0 && this.style.cellPadding.right == 0 && this.style.cellPadding.top == 0) {
669
- bounds.width -= (this.style.borders.left.width + this.style.borders.right.width);
670
- }
671
- if (this.gridRow.grid.style.cellSpacing != 0) {
672
- bounds.width -= this.gridRow.grid.style.cellSpacing;
673
- }
674
- }
675
- if (this.style.borders != null) {
676
- if(!this.fontSpilt)
677
- this.drawCellBorders(graphics, bounds);
678
- else {
679
- if(this.row.grid.ParentCell.row.grid.splitChildRowIndex != -1){
680
- this.row.rowFontSplit = false;
681
- this.drawCellBorders(graphics, bounds);
682
- }
683
- }
684
- }
685
- return result;
686
- }
687
- /* tslint:enable */
688
- /**
689
- * Draws the `cell border` constructed by drawing lines.
690
- * @private
691
- */
692
- public drawCellBorders(graphics : PdfGraphics, bounds : RectangleF) : void {
693
- if (this.row.grid.style.borderOverlapStyle === PdfBorderOverlapStyle.Inside) {
694
- bounds.x += this.style.borders.left.width;
695
- bounds.y += this.style.borders.top.width;
696
- bounds.width -= this.style.borders.right.width;
697
- bounds.height -= this.style.borders.bottom.width;
698
- }
699
- let p1 : PointF = new PointF(bounds.x, bounds.y + bounds.height);
700
- let p2 : PointF = new PointF(bounds.x, bounds.y);
701
- let pen : PdfPen = this.cellStyle.borders.left;
702
- if (this.cellStyle.borders.left.dashStyle === PdfDashStyle.Solid) {
703
- pen.lineCap = PdfLineCap.Square;
704
- }
705
- // SetTransparency(ref graphics, pen);
706
- if (pen.width !== 0) {
707
- graphics.drawLine(pen, p1, p2);
708
- }
709
- p1 = new PointF(bounds.x + bounds.width, bounds.y);
710
- p2 = new PointF(bounds.x + bounds.width, bounds.y + bounds.height);
711
- pen = this.cellStyle.borders.right;
712
- if ((bounds.x + bounds.width) > (graphics.clientSize.width - (pen.width / 2))) {
713
- p1 = new PointF(graphics.clientSize.width - (pen.width / 2), bounds.y);
714
- p2 = new PointF(graphics.clientSize.width - (pen.width / 2), bounds.y + bounds.height);
715
- }
716
- if (this.cellStyle.borders.right.dashStyle === PdfDashStyle.Solid) {
717
- pen.lineCap = PdfLineCap.Square;
718
- }
719
- if (pen.width !== 0) {
720
- graphics.drawLine(pen, p1, p2);
721
- }
722
- p1 = new PointF(bounds.x, bounds.y);
723
- p2 = new PointF(bounds.x + bounds.width, bounds.y);
724
- pen = this.cellStyle.borders.top;
725
- if (this.cellStyle.borders.top.dashStyle === PdfDashStyle.Solid) {
726
- pen.lineCap = PdfLineCap.Square;
727
- }
728
- if (pen.width !== 0) {
729
- graphics.drawLine(pen, p1, p2);
730
- }
731
- p1 = new PointF(bounds.x + bounds.width, bounds.y + bounds.height);
732
- p2 = new PointF(bounds.x, bounds.y + bounds.height);
733
- pen = this.cellStyle.borders.bottom;
734
- if ((bounds.y + bounds.height) > (graphics.clientSize.height - (pen.width / 2))) {
735
- p1 = new PointF((bounds.x + bounds.width), (graphics.clientSize.height - (pen.width / 2)));
736
- p2 = new PointF(bounds.x, (graphics.clientSize.height - (pen.width / 2)));
737
- }
738
- if (this.cellStyle.borders.bottom.dashStyle === PdfDashStyle.Solid) {
739
- pen.lineCap = PdfLineCap.Square;
740
- }
741
- if (pen.width !== 0) {
742
- graphics.drawLine(pen, p1, p2);
743
- }
744
- }
745
- // private setTransparency(graphics : PdfGraphics, pen : PdfPen) : void {
746
- // let alpha : number = (pen.color.a / 255) as number;
747
- // graphics.save();
748
- // graphics.setTransparency(alpha);
749
- // }
750
- /**
751
- * `Adjusts the outer layout area`.
752
- * @private
753
- */
754
- /* tslint:disable */
755
- private adjustOuterLayoutArea(bounds : RectangleF, g : PdfGraphics) : RectangleF {
756
- let isHeader : boolean = false;
757
- let cellSpacing : number = this.row.grid.style.cellSpacing;
758
- if (cellSpacing > 0) {
759
- bounds = new RectangleF(bounds.x + cellSpacing, bounds.y + cellSpacing,
760
- bounds.width - cellSpacing, bounds.height - cellSpacing);
761
- }
762
- let currentColIndex : number = this.row.cells.indexOf(this);
763
- if (this.columnSpan > 1|| (this.row.rowOverflowIndex > 0 && (currentColIndex == this.row.rowOverflowIndex + 1) && this.isCellMergeContinue)) {
764
- let span : number = this.columnSpan;
765
- if (span == 1 && this.isCellMergeContinue) {
766
- for (let j : number = currentColIndex + 1; j < this.row.grid.columns.count; j++)
767
- {
768
- if (this.row.cells.getCell(j).isCellMergeContinue)
769
- span++;
770
- else
771
- break;
772
- }
773
- }
774
- let totalWidth : number = 0;
775
- for (let i : number = currentColIndex; i < currentColIndex + span; i++) {
776
- if (this.row.grid.style.allowHorizontalOverflow) {
777
- let width : number;
778
- let compWidth : number = this.row.grid.size.width < g.clientSize.width ? this.row.grid.size.width : g.clientSize.width;
779
- if(this.row.grid.size.width > g.clientSize.width) {
780
- width = bounds.x + totalWidth + this.row.grid.columns.getColumn(i).width;
781
- } else {
782
- width = totalWidth + this.row.grid.columns.getColumn(i).width;
783
- }
784
- if (width > compWidth) {
785
- break;
786
- }
787
- }
788
- totalWidth += this.row.grid.columns.getColumn(i).width;
789
- }
790
- totalWidth -= this.row.grid.style.cellSpacing;
791
- bounds.width = totalWidth;
792
- }
793
- if (this.rowSpan > 1 || this.row.rowSpanExists) {
794
- let span : number = this.rowSpan;
795
- let currentRowIndex : number = this.row.grid.rows.rowCollection.indexOf(this.row);
796
- if (currentRowIndex == -1) {
797
- currentRowIndex = this.row.grid.headers.indexOf(this.row);
798
- if (currentRowIndex != -1) {
799
- isHeader = true;
800
- }
801
- }
802
- // if (span == 1 && this.isCellMergeContinue) {
803
- // for (let j : number = currentRowIndex + 1; j < this.row.grid.rows.count; j++)
804
- // {
805
- // let flag : boolean = (isHeader ? this.row.grid.headers.getHeader(j).cells.getCell(currentColIndex).isCellMergeContinue : this.row.grid.rows.getRow(j).cells.getCell(currentColIndex).isCellMergeContinue);
806
- // if (flag)
807
- // span++;
808
- // else
809
- // break;
810
- // }
811
- // }
812
- let totalHeight : number = 0;
813
- let max : number = 0;
814
- for (let i : number = currentRowIndex; i < currentRowIndex + span; i++) {
815
- totalHeight += (isHeader ? this.row.grid.headers.getHeader(i).height : this.row.grid.rows.getRow(i).height);
816
- let row : PdfGridRow = this.row.grid.rows.getRow(i);
817
- let rowIndex : number = this.row.grid.rows.rowCollection.indexOf(row);
818
- /*if (this.rowSpan > 1)
819
- {
820
- for (let k : number = 0; k < this.row.cells.count; k++) {
821
- let cell : PdfGridCell = this.row.cells.getCell(k);
822
- if(cell.rowSpan>1)
823
- {
824
- let tempHeight : number =0;
825
-
826
- for (let j :number = i; j < i +cell.rowSpan; j++)
827
- {
828
- if (!this.row.grid.rows.getRow(j).isRowSpanRowHeightSet)
829
- this.row.grid.rows.getRow(j).isRowHeightSet = false;
830
- tempHeight += this.row.grid.rows.getRow(j).height;
831
- if (!this.row.grid.rows.getRow(j).isRowSpanRowHeightSet)
832
- this.row.grid.rows.getRow(j).isRowHeightSet = true;
833
- }
834
- //To check the Row spanned cell height is greater than the total spanned row height.
835
- if(cell.height>tempHeight)
836
- {
837
- if (max < (cell.height - tempHeight))
838
- {
839
- max = cell.height - tempHeight;
840
- if (this.rowSpanRemainingHeight != 0 && max > this.rowSpanRemainingHeight)
841
- {
842
- max += this.rowSpanRemainingHeight;
843
- }
844
- let index :number = row.cells.indexOf(cell);
845
- //set the m_rowspanRemainingHeight to last rowspanned row.
846
- this.row.grid.rows.getRow((rowIndex +cell.rowSpan) - 1).cells.getCell(index).rowSpanRemainingHeight = max;
847
- this.rowSpanRemainingHeight = this.row.grid.rows.getRow((rowIndex + cell.rowSpan) - 1).cells.getCell(index).rowSpanRemainingHeight;
848
- }
849
- }
850
- }
851
- }
852
- }
853
- if (!this.row.grid.rows.getRow(i).isRowSpanRowHeightSet)
854
- this.row.grid.rows.getRow(i).isRowHeightSet = true;*/
855
- }
856
- let cellIndex = this.row.cells.indexOf(this);
857
- totalHeight -= this.row.grid.style.cellSpacing;
858
- // if (this.row.cells.getCell(cellIndex).height > totalHeight && (!this.row.grid.rows.getRow((currentRowIndex + span) - 1).isRowHeightSet)) {
859
- // this.row.grid.rows.getRow((currentRowIndex + span) - 1).cells.getCell(cellIndex).rowSpanRemainingHeight = this.row.cells.getCell(cellIndex).height - totalHeight;
860
- // totalHeight = this.row.cells.getCell(cellIndex).height;
861
- // bounds.height = totalHeight;
862
- // } else {
863
- bounds.height = totalHeight;
864
- // }
865
- if (!this.row.rowMergeComplete) {
866
- bounds.height = totalHeight;
867
- }
868
- }
869
- return bounds;
870
- }
871
- /* tslint:enable */
872
- /**
873
- * Gets the `text font`.
874
- * @private
875
- */
876
- private getTextFont() : PdfFont {
877
- if (typeof this.style.font !== 'undefined' && this.style.font != null) {
878
- return this.style.font;
879
- } else if (typeof this.row.style.font !== 'undefined' && this.row.style.font != null) {
880
- return this.row.style.font;
881
- } else if (typeof this.row.grid.style.font !== 'undefined' && this.row.grid.style.font != null) {
882
- return this.row.grid.style.font;
883
- } else {
884
- return PdfDocument.defaultFont;
885
- }
886
- }
887
- /**
888
- * Gets the `text brush`.
889
- * @private
890
- */
891
- private getTextBrush() : PdfBrush {
892
- if (typeof this.style.textBrush !== 'undefined' && this.style.textBrush != null) {
893
- return this.style.textBrush;
894
- } else if (typeof this.row.style.textBrush !== 'undefined' && this.row.style.textBrush != null) {
895
- return this.row.style.textBrush;
896
- } else {
897
- return this.row.grid.style.textBrush;
898
- }
899
- }
900
- /**
901
- * Gets the `text pen`.
902
- * @private
903
- */
904
- private getTextPen() : PdfPen {
905
- if (typeof this.style.textPen !== 'undefined' && this.style.textPen != null) {
906
- return this.style.textPen;
907
- } else if (typeof this.row.style.textPen !== 'undefined' && this.row.style.textPen != null) {
908
- return this.row.style.textPen;
909
- } else {
910
- return this.row.grid.style.textPen;
911
- }
912
- }
913
- /**
914
- * Gets the `background brush`.
915
- * @private
916
- */
917
- private getBackgroundBrush() : PdfBrush {
918
- if (typeof this.style.backgroundBrush !== 'undefined' && this.style.backgroundBrush != null) {
919
- return this.style.backgroundBrush;
920
- } else if (typeof this.row.style.backgroundBrush !== 'undefined' && this.row.style.backgroundBrush != null) {
921
- return this.row.style.backgroundBrush;
922
- } else {
923
- return this.row.grid.style.backgroundBrush;
924
- }
925
- }
926
- /**
927
- * Gets the `background image`.
928
- * @private
929
- */
930
- private getBackgroundImage() : PdfImage {
931
- if (typeof this.style.backgroundImage !== 'undefined' && this.style.backgroundImage != null) {
932
- return this.style.backgroundImage;
933
- } else if (typeof this.row.style.backgroundImage !== 'undefined' && this.row.style.backgroundImage != null) {
934
- return this.row.style.backgroundImage;
935
- } else {
936
- return this.row.grid.style.backgroundImage;
937
- }
938
- }
939
- /**
940
- * Gets the current `StringFormat`.
941
- * @private
942
- */
943
- private getStringFormat() : PdfStringFormat {
944
- if (typeof this.style.stringFormat !== 'undefined' && this.style.stringFormat != null) {
945
- return this.style.stringFormat;
946
- } else {
947
- return this.stringFormat;
948
- }
949
- }
950
- /**
951
- * Calculates the `height`.
952
- * @private
953
- */
954
- public measureHeight() : number {
955
- // .. Calculate the cell text height.
956
- // .....Add border widths, cell spacings and paddings to the height.
957
- let width : number = this.calculateWidth();
958
- // //check whether the Current PdfGridCell has padding
959
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined') {
960
- width -= (this.gridRow.grid.style.cellPadding.right + this.gridRow.grid.style.cellPadding.left);
961
- //width -= (this.style.borders.left.width + this.style.borders.right.width);
962
- } else {
963
- width -= (this.style.cellPadding.right + this.style.cellPadding.left);
964
- width -= (this.style.borders.left.width + this.style.borders.right.width);
965
- }
966
- let height : number = 0;
967
- let layouter : PdfStringLayouter = new PdfStringLayouter();
968
- if (typeof this.objectValue === 'string' || typeof this.remaining === 'string') {
969
- let currentValue : string = this.objectValue as string;
970
- /* tslint:disable */
971
- if (!this.isFinish)
972
- currentValue = !(this.remaining === null || this.remaining === '' ||
973
- typeof this.remaining === 'undefined') ? this.remaining : (this.objectValue as string);
974
- let slr : PdfStringLayoutResult = null;
975
- let cellIndex : number = this.row.cells.indexOf(this);
976
-
977
- if (this.gridRow.grid.style.cellSpacing != 0){
978
- width -= this.gridRow.grid.style.cellSpacing * 2;
979
- }
980
- if(!this.row.cells.getCell(cellIndex).hasColSpan && !this.row.cells.getCell(cellIndex).hasRowSpan) {
981
- if(this.gridRow.grid.isChildGrid) {
982
- if (width < 0) {
983
- this.tempval = width;
984
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined') {
985
- this.tempval += (this.gridRow.grid.style.cellPadding.right + this.gridRow.grid.style.cellPadding.left);
986
- } else {
987
- this.tempval += (this.style.cellPadding.right + this.style.cellPadding.left);
988
- this.tempval += (this.style.borders.left.width + this.style.borders.right.width);
989
- }
990
- } else {
991
- this.tempval = width;
992
- }
993
- slr = layouter.layout(currentValue, this.getTextFont(), this.stringFormat, new SizeF(this.tempval, 0), false, new SizeF(0, 0));
994
- height += slr.actualSize.height;
995
- } else {
996
- slr = layouter.layout(currentValue, this.getTextFont(), this.stringFormat, new SizeF(width, 0), false, new SizeF(0, 0));
997
- height += slr.actualSize.height;
998
- }
999
- }
1000
- /* tslint:enable */
1001
- height += (this.style.borders.top.width + this.style.borders.bottom.width) * 2;
1002
- } else if (this.objectValue instanceof PdfGrid) {
1003
- let cellIndex : number = this.row.cells.indexOf(this);
1004
- let internalWidth : number = 0;
1005
- if ((this.style.cellPadding != null || typeof this.style.cellPadding !== 'undefined' )) {
1006
- internalWidth = this.calculateWidth();
1007
- if (typeof this.style.cellPadding.left !== 'undefined' && this.style.cellPadding.hasLeftPad) {
1008
- internalWidth -= this.style.cellPadding.left;
1009
- }
1010
- if (typeof this.style.cellPadding.right !== 'undefined' && this.style.cellPadding.hasRightPad) {
1011
- internalWidth -= this.style.cellPadding.right;
1012
- }
1013
- } else if ((this.row.grid.style.cellPadding != null || typeof this.row.grid.style.cellPadding !== 'undefined')) {
1014
- internalWidth = this.calculateWidth();
1015
- if (typeof this.row.grid.style.cellPadding.left !== 'undefined' && this.row.grid.style.cellPadding.hasLeftPad) {
1016
- internalWidth -= this.row.grid.style.cellPadding.left;
1017
- }
1018
- if (typeof this.row.grid.style.cellPadding.right !== 'undefined' && this.row.grid.style.cellPadding.hasRightPad) {
1019
- internalWidth -= this.row.grid.style.cellPadding.right;
1020
- }
1021
- } else {
1022
- internalWidth = this.calculateWidth();
1023
- }
1024
- (this.objectValue as PdfGrid).tempWidth = internalWidth;
1025
- if (!this.row.cells.getCell(cellIndex).hasColSpan && !this.row.cells.getCell(cellIndex).hasRowSpan) {
1026
- height = (this.objectValue as PdfGrid).size.height;
1027
- } else {
1028
- height += (this.style.borders.top.width + this.style.borders.bottom.width) * 2;
1029
- }
1030
- if (this.gridRow.grid.style.cellSpacing !== 0 ) {
1031
- width -= this.gridRow.grid.style.cellSpacing * 2;
1032
- //height += (this.row.grid.style.cellPadding.top + this.row.grid.style.cellPadding.bottom);
1033
- }
1034
- if (this.style.cellPadding != null || typeof this.style.cellPadding !== 'undefined') {
1035
- if (typeof this.row.grid.style.cellPadding.top !== 'undefined' && this.row.grid.style.cellPadding.hasTopPad) {
1036
- height += this.row.grid.style.cellPadding.top;
1037
- }
1038
- if (this.row.grid.style.cellPadding.hasBottomPad && typeof this.row.grid.style.cellPadding.bottom !== 'undefined') {
1039
- height += this.row.grid.style.cellPadding.bottom;
1040
- }
1041
- }
1042
- height += this.objectValue.style.cellSpacing;
1043
- } else if (this.objectValue instanceof PdfImage || this.objectValue instanceof PdfBitmap) {
1044
- height += (this.objectValue as PdfImage).height;
1045
- } else if (this.objectValue instanceof PdfTextWebLink) {
1046
- let webLink : PdfTextWebLink = this.objectValue as PdfTextWebLink;
1047
- /* tslint:disable */
1048
- let slr : PdfStringLayoutResult = layouter.layout(webLink.text, webLink.font, webLink.stringFormat, new SizeF(width, 0), false, new SizeF(0, 0));
1049
- /* tslint:enable */
1050
- height += slr.actualSize.height;
1051
- height += (this.style.borders.top.width + this.style.borders.bottom.width) * 2;
1052
- } else if (typeof this.objectValue === 'undefined') {
1053
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined') {
1054
- width -= (this.gridRow.grid.style.cellPadding.right + this.gridRow.grid.style.cellPadding.left);
1055
- } else {
1056
- width -= (this.style.cellPadding.right + this.style.cellPadding.left);
1057
- width -= (this.style.borders.left.width + this.style.borders.right.width);
1058
- }
1059
- height += (this.style.borders.top.width + this.style.borders.bottom.width) * 2;
1060
- }
1061
- //Add padding top and bottom value to height
1062
- if (!(this.objectValue instanceof PdfGrid)) {
1063
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined') {
1064
- height += (this.row.grid.style.cellPadding.top + this.row.grid.style.cellPadding.bottom);
1065
- } else {
1066
- height += (this.style.cellPadding.top + this.style.cellPadding.bottom);
1067
- }
1068
- } else {
1069
- if (this.style.cellPadding == null || typeof this.style.cellPadding === 'undefined') {
1070
- if (typeof this.row.grid.style.cellPadding.top !== 'undefined' && this.row.grid.style.cellPadding.hasTopPad) {
1071
- height += this.row.grid.style.cellPadding.top;
1072
- }
1073
- if (typeof this.row.grid.style.cellPadding.bottom !== 'undefined' && this.row.grid.style.cellPadding.hasBottomPad) {
1074
- height += this.row.grid.style.cellPadding.bottom;
1075
- }
1076
- } else {
1077
- if (typeof this.style.cellPadding.top !== 'undefined' && this.style.cellPadding.hasTopPad) {
1078
- height += this.style.cellPadding.top;
1079
- }
1080
- if (typeof this.style.cellPadding.bottom !== 'undefined' && this.style.cellPadding.hasBottomPad) {
1081
- height += this.style.cellPadding.bottom;
1082
- }
1083
- }
1084
- }
1085
- height += this.row.grid.style.cellSpacing;
1086
- return height;
1087
- }
1088
- /**
1089
- * return the calculated `width` of the cell.
1090
- * @private
1091
- */
1092
- private calculateWidth() : number {
1093
- let cellIndex : number = this.row.cells.indexOf(this);
1094
- let rowindex : number = this.row.grid.rows.rowCollection.indexOf(this.row);
1095
- let columnSpan : number = this.columnSpan;
1096
- let width : number = 0;
1097
- if (columnSpan === 1) {
1098
- for (let i : number = 0; i < columnSpan; i++) {
1099
- width += this.row.grid.columns.getColumn(cellIndex + i).width;
1100
- }
1101
- } else if (columnSpan > 1) {
1102
- for (let i : number = 0; i < columnSpan; i++) {
1103
- width += this.row.grid.columns.getColumn(cellIndex + i).width;
1104
- if ( (i + 1) < columnSpan) {
1105
- this.row.cells.getCell(cellIndex + i + 1).hasColSpan = true;
1106
- }
1107
- }
1108
- }
1109
-
1110
- if (this.parent != null && this.parent.row.width > 0) {
1111
- if ((this.row.grid.isChildGrid) && this.parent != null && (this.row.width > this.parent.row.width)) {
1112
- width = 0;
1113
- for (let j : number = 0; j < this.parent.columnSpan; j++) {
1114
- width += this.parent.row.grid.columns.getColumn(j).width;
1115
- }
1116
- width = width / this.row.cells.count;
1117
- }
1118
- }
1119
- return width;
1120
- }
1121
- }
1122
- /**
1123
- * `PdfGridCellCollection` class provides access to an ordered,
1124
- * strongly typed collection of 'PdfGridCell' objects.
1125
- * @private
1126
- */
1127
- export class PdfGridCellCollection {
1128
- //Fields
1129
- /**
1130
- * @hidden
1131
- * @private
1132
- */
1133
- private gridRow : PdfGridRow;
1134
- /**
1135
- * @hidden
1136
- * @private
1137
- */
1138
- private cells : PdfGridCell[] = [];
1139
- //Constructor
1140
- /**
1141
- * Initializes a new instance of the `PdfGridCellCollection` class with the row.
1142
- * @private
1143
- */
1144
- public constructor(row : PdfGridRow) {
1145
- this.gridRow = row;
1146
- }
1147
- //Properties
1148
- /**
1149
- * Gets the current `cell`.
1150
- * @private
1151
- */
1152
- public getCell(index : number) : PdfGridCell {
1153
- if (index < 0 || index >= this.count) {
1154
- throw new Error('IndexOutOfRangeException');
1155
- }
1156
- return this.cells[index];
1157
- }
1158
- /**
1159
- * Gets the cells `count`.[Read-Only].
1160
- * @private
1161
- */
1162
- public get count() : number {
1163
- return this.cells.length;
1164
- }
1165
- //Implementation
1166
- /**
1167
- * `Adds` this instance.
1168
- * @private
1169
- */
1170
- public add() : PdfGridCell
1171
- /**
1172
- * `Adds` this instance.
1173
- * @private
1174
- */
1175
- public add(cell : PdfGridCell) : void
1176
- public add(cell ?: PdfGridCell) : PdfGridCell|void {
1177
- if (typeof cell === 'undefined') {
1178
- let tempcell : PdfGridCell = new PdfGridCell();
1179
- this.add(tempcell);
1180
- return cell;
1181
- } else {
1182
- cell.row = this.gridRow;
1183
- this.cells.push(cell);
1184
- }
1185
- }
1186
- /**
1187
- * Returns the `index of` a particular cell in the collection.
1188
- * @private
1189
- */
1190
- public indexOf(cell : PdfGridCell) : number {
1191
- return this.cells.indexOf(cell);
1192
- }
1193
- }