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