abstract-document 18.2.5 → 18.2.9
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/lib/abstract-document/atoms/image.d.ts +4 -0
- package/lib/abstract-document/atoms/image.d.ts.map +1 -1
- package/lib/abstract-document/atoms/image.js.map +1 -1
- package/lib/abstract-document-exporters/pdf/measure.d.ts.map +1 -1
- package/lib/abstract-document-exporters/pdf/measure.js.map +1 -1
- package/lib/abstract-document-exporters/pdf/render-image.d.ts.map +1 -1
- package/lib/abstract-document-exporters/pdf/render-image.js +19 -3
- package/lib/abstract-document-exporters/pdf/render-image.js.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.d.ts +6 -2
- package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.d.ts.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js +13 -17
- package/lib/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.js.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/creator.d.ts.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/creator.js.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts +3 -5
- package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.d.ts.map +1 -1
- package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js +4 -4
- package/lib/abstract-document-xml/abstract-doc-of-xml/custom-elements.js.map +1 -1
- package/lib/abstract-document-xml/xsd-template/elements.d.ts +1 -1
- package/lib/abstract-document-xml/xsd-template/elements.d.ts.map +1 -1
- package/lib/abstract-document-xml/xsd-template/elements.js +18 -0
- package/lib/abstract-document-xml/xsd-template/elements.js.map +1 -1
- package/lib/abstract-document-xml/xsd-template/xsd-template.d.ts +2 -2
- package/lib/abstract-document-xml/xsd-template/xsd-template.d.ts.map +1 -1
- package/package.json +4 -6
- package/src/abstract-document/atoms/image.ts +4 -0
- package/src/abstract-document-exporters/pdf/measure.ts +7 -10
- package/src/abstract-document-exporters/pdf/render-image.ts +29 -8
- package/src/abstract-document-xml/abstract-doc-of-xml/abstract-doc-of-xml.ts +36 -28
- package/src/abstract-document-xml/abstract-doc-of-xml/creator.ts +36 -35
- package/src/abstract-document-xml/abstract-doc-of-xml/custom-elements.tsx +18 -8
- package/src/abstract-document-xml/xsd-template/elements.ts +18 -0
|
@@ -3,7 +3,7 @@ import { AbstractDoc } from "../../abstract-document/index.js";
|
|
|
3
3
|
import * as StyleKey from "../../abstract-document/styles/style-key.js";
|
|
4
4
|
import { Resources } from "../../abstract-document/resources.js";
|
|
5
5
|
import { ADCreatorFn, creators, propsCreators } from "./creator.js";
|
|
6
|
-
import { parseHandlebarsXml,
|
|
6
|
+
import { parseHandlebarsXml, type XmlElement } from "handlebars-xml";
|
|
7
7
|
import { getFontStyleName } from "../../abstract-document-exporters/pdf/font.js";
|
|
8
8
|
import { Font } from "../../abstract-document/primitives/font.js";
|
|
9
9
|
|
|
@@ -21,19 +21,27 @@ export type Format = "PDF" | "DOCX";
|
|
|
21
21
|
|
|
22
22
|
export async function abstractDocsXml(
|
|
23
23
|
templateInputs: ReadonlyArray<TemplateInput>,
|
|
24
|
-
getResources: (
|
|
24
|
+
getResources: (
|
|
25
|
+
imageUrls: Record<string, true>,
|
|
26
|
+
fontFamilies: Record<string, ReadonlyArray<keyof Font>>
|
|
27
|
+
) => Promise<Resources>
|
|
25
28
|
): Promise<AbstractDoxXmlsResult> {
|
|
26
29
|
try {
|
|
27
30
|
const abstractDocs = Array<AbstractDoc.AbstractDoc>();
|
|
28
31
|
let imageUrls: Record<string, true> = {};
|
|
29
|
-
|
|
32
|
+
const fontFamilies: Record<string, Partial<Record<keyof Font, boolean>>> = {};
|
|
30
33
|
for (const r of templateInputs) {
|
|
31
|
-
const [ad, newImageUrls, newFontFamilies] = abstractDocXml(r.template, r.data, r.partials
|
|
34
|
+
const [ad, newImageUrls, newFontFamilies] = abstractDocXml(r.template, r.data, r.partials);
|
|
32
35
|
abstractDocs.push(ad);
|
|
33
36
|
imageUrls = { ...imageUrls, ...newImageUrls };
|
|
34
|
-
|
|
37
|
+
Object.entries(newFontFamilies).forEach(
|
|
38
|
+
([font, types]) => (fontFamilies[font] = { ...fontFamilies[font], ...types })
|
|
39
|
+
);
|
|
35
40
|
}
|
|
36
|
-
const resources = await getResources(
|
|
41
|
+
const resources = await getResources(
|
|
42
|
+
imageUrls,
|
|
43
|
+
Object.fromEntries(Object.entries(fontFamilies).map(([f, s]) => [f, Object.keys(s) as Array<keyof Font>]))
|
|
44
|
+
);
|
|
37
45
|
const combinedReport = addResources(merge(...abstractDocs), resources);
|
|
38
46
|
return { type: "Ok", value: combinedReport };
|
|
39
47
|
} catch (e) {
|
|
@@ -44,14 +52,16 @@ export async function abstractDocsXml(
|
|
|
44
52
|
export function abstractDocXml(
|
|
45
53
|
template: string,
|
|
46
54
|
data: any,
|
|
47
|
-
partials: Record<string, string
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
partials: Record<string, string>
|
|
56
|
+
): readonly [
|
|
57
|
+
AbstractDoc.AbstractDoc,
|
|
58
|
+
imageUrls: Record<string, true>,
|
|
59
|
+
fontFamilies: Record<string, Partial<Record<keyof Font, boolean>>>
|
|
60
|
+
] {
|
|
61
|
+
const xml = parseHandlebarsXml(template, data, partials);
|
|
62
|
+
const [imageUrls, fontFamilies, styleNames] = extractImageFontsStyleNames(xml);
|
|
53
63
|
const doc = abstractDocXmlRecursive(creators(styleNames), xml[0]!);
|
|
54
|
-
return [doc, imageUrls, fontFamilies
|
|
64
|
+
return [doc, imageUrls, fontFamilies];
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
function abstractDocXmlRecursive(
|
|
@@ -103,7 +113,8 @@ function abstractDocXmlRecursive(
|
|
|
103
113
|
const obj = creator(allProps, children) as { [k: string]: unknown };
|
|
104
114
|
|
|
105
115
|
for (const propName of Object.keys(allProps).sort((a, b) => a.length - b.length)) {
|
|
106
|
-
const propsCreator =
|
|
116
|
+
const propsCreator =
|
|
117
|
+
allProps[propName] !== undefined && propsCreators[propName] ? propsCreators[propName] : undefined;
|
|
107
118
|
if (propsCreator) {
|
|
108
119
|
const attributeName = getSuffixedAttributeBaseName(propsCreator.name) ?? propsCreator.name;
|
|
109
120
|
obj[attributeName] = propsCreator(allProps, children);
|
|
@@ -156,8 +167,8 @@ function abstractDocXmlRecursive(
|
|
|
156
167
|
function getSuffixedAttributeBaseName(attributeName: string): string | undefined {
|
|
157
168
|
const suffixRemoved = (() => {
|
|
158
169
|
const suffixes = ["Top", "Bottom", "Left", "Right"];
|
|
159
|
-
for(const suffix of suffixes) {
|
|
160
|
-
if(attributeName.endsWith(suffix)) {
|
|
170
|
+
for (const suffix of suffixes) {
|
|
171
|
+
if (attributeName.endsWith(suffix)) {
|
|
161
172
|
return attributeName.slice(0, -suffix.length);
|
|
162
173
|
}
|
|
163
174
|
}
|
|
@@ -178,29 +189,26 @@ function extractImageFontsStyleNames(
|
|
|
178
189
|
xmlElement: ReadonlyArray<XmlElement>,
|
|
179
190
|
styleNames: Record<string, string> = {},
|
|
180
191
|
images: Record<string, true> = {},
|
|
181
|
-
fonts: Record<string,
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
fonts: Record<string, Partial<Record<keyof Font, boolean>>> = {}
|
|
193
|
+
): readonly [
|
|
194
|
+
imageUrls: Record<string, true>,
|
|
195
|
+
fontFamilies: Record<string, Partial<Record<keyof Font, boolean>>>,
|
|
196
|
+
styleNames: Record<string, string>
|
|
197
|
+
] {
|
|
184
198
|
xmlElement.forEach((item) => {
|
|
185
199
|
if (item.tagName.startsWith("Image") && item.attributes?.src) {
|
|
186
200
|
images[item.attributes.src as string] = true;
|
|
187
201
|
} else if (item.attributes?.fontFamily) {
|
|
188
|
-
fonts[item.attributes.fontFamily as string] = true;
|
|
189
|
-
|
|
190
202
|
const styleName = getFontStyleName(item.attributes);
|
|
191
|
-
|
|
192
|
-
if(currentStyleNames.findIndex((v) => v === styleName) === -1) {
|
|
193
|
-
fontStyles[item.attributes.fontFamily as string] = [...currentStyleNames, styleName];
|
|
194
|
-
}
|
|
195
|
-
|
|
203
|
+
(fonts[item.attributes.fontFamily as string] ??= {})[styleName] = true;
|
|
196
204
|
if (item.tagName === "StyleName" && item.attributes.name && item.attributes.type) {
|
|
197
205
|
styleNames[item.attributes.name as string] = item.attributes.type;
|
|
198
206
|
}
|
|
199
207
|
} else if (item.tagName === "StyleName" && item.attributes.name && item.attributes.type) {
|
|
200
208
|
styleNames[item.attributes.name as string] = item.attributes.type;
|
|
201
209
|
} else {
|
|
202
|
-
extractImageFontsStyleNames(item.children, styleNames, images, fonts
|
|
210
|
+
extractImageFontsStyleNames(item.children, styleNames, images, fonts);
|
|
203
211
|
}
|
|
204
212
|
});
|
|
205
|
-
return [images, fonts, styleNames
|
|
213
|
+
return [images, fonts, styleNames];
|
|
206
214
|
}
|
|
@@ -46,9 +46,10 @@ export const creators: (styleNames: Record<string, string>) => Record<string, AD
|
|
|
46
46
|
TextCell: (props: TextCellProps) => TextCell(props, styleNames),
|
|
47
47
|
TextParagraph: (props: TextParagraphProps) => TextParagraph(props, styleNames),
|
|
48
48
|
TextRun: (props) => TextRun.create(props as unknown as TextRun.TextRunProps),
|
|
49
|
-
ImageRow: (props:
|
|
50
|
-
ImageCell: (props:
|
|
51
|
-
|
|
49
|
+
ImageRow: (props: Record<string, unknown>) => ImageRow(imageProps(props) as unknown as ImageRowProps, styleNames),
|
|
50
|
+
ImageCell: (props: Record<string, unknown>) =>
|
|
51
|
+
ImageCell(imageProps(props) as unknown as ImageCellProps, styleNames),
|
|
52
|
+
ImageParagraph: (props: Record<string, unknown>) =>
|
|
52
53
|
ImageParagraph(imageProps(props) as unknown as ImageParagraphProps, styleNames),
|
|
53
54
|
Image: (props: Record<string, unknown>) => Image.create(imageProps(props) as unknown as Image.ImageProps),
|
|
54
55
|
Table: (props, children: ReadonlyArray<TableRow.TableRow>) =>
|
|
@@ -139,27 +140,27 @@ export const propsCreators: Record<string, ADCreatorFn> = {
|
|
|
139
140
|
},
|
|
140
141
|
borderTop: (props: { readonly borderTop: string }): unknown => {
|
|
141
142
|
const allProps = props as Record<string, unknown>;
|
|
142
|
-
const borders: { top?: number
|
|
143
|
+
const borders: { top?: number; bottom?: number; left?: number; right?: number } = allProps.borders ?? {};
|
|
143
144
|
borders.top = Number(props.borderTop);
|
|
144
|
-
return borders;
|
|
145
|
+
return borders;
|
|
145
146
|
},
|
|
146
147
|
borderBottom: (props: { readonly borderBottom: string }): unknown => {
|
|
147
148
|
const allProps = props as Record<string, unknown>;
|
|
148
|
-
const borders: { top?: number
|
|
149
|
+
const borders: { top?: number; bottom?: number; left?: number; right?: number } = allProps.borders ?? {};
|
|
149
150
|
borders.bottom = Number(props.borderBottom);
|
|
150
|
-
return borders;
|
|
151
|
+
return borders;
|
|
151
152
|
},
|
|
152
153
|
borderLeft: (props: { readonly borderLeft: string }): unknown => {
|
|
153
154
|
const allProps = props as Record<string, unknown>;
|
|
154
|
-
const borders: { top?: number
|
|
155
|
+
const borders: { top?: number; bottom?: number; left?: number; right?: number } = allProps.borders ?? {};
|
|
155
156
|
borders.left = Number(props.borderLeft);
|
|
156
|
-
return borders;
|
|
157
|
+
return borders;
|
|
157
158
|
},
|
|
158
159
|
borderRight: (props: { readonly borderRight: string }): unknown => {
|
|
159
160
|
const allProps = props as Record<string, unknown>;
|
|
160
|
-
const borders: { top?: number
|
|
161
|
+
const borders: { top?: number; bottom?: number; left?: number; right?: number } = allProps.borders ?? {};
|
|
161
162
|
borders.right = Number(props.borderRight);
|
|
162
|
-
return borders;
|
|
163
|
+
return borders;
|
|
163
164
|
},
|
|
164
165
|
padding: (props: { readonly padding: string }): unknown => {
|
|
165
166
|
const padding: { [k: string]: number } = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
@@ -205,27 +206,27 @@ export const propsCreators: Record<string, ADCreatorFn> = {
|
|
|
205
206
|
},
|
|
206
207
|
paddingTop: (props: { readonly paddingTop: string }): unknown => {
|
|
207
208
|
const allProps = props as Record<string, unknown>;
|
|
208
|
-
const padding: { top?: number
|
|
209
|
+
const padding: { top?: number; bottom?: number; left?: number; right?: number } = allProps.padding ?? {};
|
|
209
210
|
padding.top = Number(props.paddingTop);
|
|
210
|
-
return padding;
|
|
211
|
+
return padding;
|
|
211
212
|
},
|
|
212
213
|
paddingBottom: (props: { readonly paddingBottom: string }): unknown => {
|
|
213
214
|
const allProps = props as Record<string, unknown>;
|
|
214
|
-
const padding: { top?: number
|
|
215
|
+
const padding: { top?: number; bottom?: number; left?: number; right?: number } = allProps.padding ?? {};
|
|
215
216
|
padding.bottom = Number(props.paddingBottom);
|
|
216
|
-
return padding;
|
|
217
|
+
return padding;
|
|
217
218
|
},
|
|
218
219
|
paddingLeft: (props: { readonly paddingLeft: string }): unknown => {
|
|
219
220
|
const allProps = props as Record<string, unknown>;
|
|
220
|
-
const padding: { top?: number
|
|
221
|
+
const padding: { top?: number; bottom?: number; left?: number; right?: number } = allProps.padding ?? {};
|
|
221
222
|
padding.left = Number(props.paddingLeft);
|
|
222
|
-
return padding;
|
|
223
|
+
return padding;
|
|
223
224
|
},
|
|
224
225
|
paddingRight: (props: { readonly paddingRight: string }): unknown => {
|
|
225
226
|
const allProps = props as Record<string, unknown>;
|
|
226
|
-
const padding: { top?: number
|
|
227
|
+
const padding: { top?: number; bottom?: number; left?: number; right?: number } = allProps.padding ?? {};
|
|
227
228
|
padding.right = Number(props.paddingRight);
|
|
228
|
-
return padding;
|
|
229
|
+
return padding;
|
|
229
230
|
},
|
|
230
231
|
margins: (props: { readonly margins: string }): unknown => {
|
|
231
232
|
const margins: { [k: string]: number } = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
@@ -269,27 +270,27 @@ export const propsCreators: Record<string, ADCreatorFn> = {
|
|
|
269
270
|
},
|
|
270
271
|
marginTop: (props: { readonly marginTop: string }): unknown => {
|
|
271
272
|
const allProps = props as Record<string, unknown>;
|
|
272
|
-
const margins: { top?: number
|
|
273
|
+
const margins: { top?: number; bottom?: number; left?: number; right?: number } = allProps.margins ?? {};
|
|
273
274
|
margins.top = Number(props.marginTop);
|
|
274
|
-
return margins;
|
|
275
|
+
return margins;
|
|
275
276
|
},
|
|
276
277
|
marginBottom: (props: { readonly marginBottom: string }): unknown => {
|
|
277
278
|
const allProps = props as Record<string, unknown>;
|
|
278
|
-
const margins: { top?: number
|
|
279
|
+
const margins: { top?: number; bottom?: number; left?: number; right?: number } = allProps.margins ?? {};
|
|
279
280
|
margins.bottom = Number(props.marginBottom);
|
|
280
|
-
return margins;
|
|
281
|
+
return margins;
|
|
281
282
|
},
|
|
282
283
|
marginLeft: (props: { readonly marginLeft: string }): unknown => {
|
|
283
284
|
const allProps = props as Record<string, unknown>;
|
|
284
|
-
const margins: { top?: number
|
|
285
|
+
const margins: { top?: number; bottom?: number; left?: number; right?: number } = allProps.margins ?? {};
|
|
285
286
|
margins.left = Number(props.marginLeft);
|
|
286
|
-
return margins;
|
|
287
|
+
return margins;
|
|
287
288
|
},
|
|
288
289
|
marginRight: (props: { readonly marginRight: string }): unknown => {
|
|
289
290
|
const allProps = props as Record<string, unknown>;
|
|
290
|
-
const margins: { top?: number
|
|
291
|
+
const margins: { top?: number; bottom?: number; left?: number; right?: number } = allProps.margins ?? {};
|
|
291
292
|
margins.right = Number(props.marginRight);
|
|
292
|
-
return margins;
|
|
293
|
+
return margins;
|
|
293
294
|
},
|
|
294
295
|
borderColors: (props: { readonly borderColors: string }): unknown => {
|
|
295
296
|
const borderColors: { [k: string]: string } = { top: "", right: "", bottom: "", left: "" };
|
|
@@ -315,27 +316,27 @@ export const propsCreators: Record<string, ADCreatorFn> = {
|
|
|
315
316
|
},
|
|
316
317
|
borderColorTop: (props: { readonly borderColorTop: string }): unknown => {
|
|
317
318
|
const allProps = props as Record<string, unknown>;
|
|
318
|
-
const margins: { top?: string
|
|
319
|
+
const margins: { top?: string; bottom?: string; left?: string; right?: string } = allProps.borderColors ?? {};
|
|
319
320
|
margins.top = props.borderColorTop;
|
|
320
|
-
return margins;
|
|
321
|
+
return margins;
|
|
321
322
|
},
|
|
322
323
|
borderColorBottom: (props: { readonly borderColorBottom: string }): unknown => {
|
|
323
324
|
const allProps = props as Record<string, unknown>;
|
|
324
|
-
const boderColors: { top?: string
|
|
325
|
+
const boderColors: { top?: string; bottom?: string; left?: string; right?: string } = allProps.borderColors ?? {};
|
|
325
326
|
boderColors.bottom = props.borderColorBottom;
|
|
326
|
-
return boderColors;
|
|
327
|
+
return boderColors;
|
|
327
328
|
},
|
|
328
329
|
borderColorLeft: (props: { readonly borderColorLeft: string }): unknown => {
|
|
329
330
|
const allProps = props as Record<string, unknown>;
|
|
330
|
-
const boderColors: { top?: string
|
|
331
|
+
const boderColors: { top?: string; bottom?: string; left?: string; right?: string } = allProps.borderColors ?? {};
|
|
331
332
|
boderColors.left = props.borderColorLeft;
|
|
332
|
-
return boderColors;
|
|
333
|
+
return boderColors;
|
|
333
334
|
},
|
|
334
335
|
borderColorRight: (props: { readonly borderColorRight: string }): unknown => {
|
|
335
336
|
const allProps = props as Record<string, unknown>;
|
|
336
|
-
const boderColors: { top?: string
|
|
337
|
+
const boderColors: { top?: string; bottom?: string; left?: string; right?: string } = allProps.borderColors ?? {};
|
|
337
338
|
boderColors.right = props.borderColorRight;
|
|
338
|
-
return boderColors;
|
|
339
|
+
return boderColors;
|
|
339
340
|
},
|
|
340
341
|
};
|
|
341
342
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ImageProps } from "../../abstract-document/atoms/image.js";
|
|
1
2
|
import {
|
|
2
3
|
TextStyle,
|
|
3
4
|
ParagraphStyle,
|
|
@@ -110,9 +111,20 @@ export type ImageCellProps = Omit<ImageParagraphProps, "style"> & {
|
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string, string>): TableCell.TableCell {
|
|
113
|
-
const {
|
|
114
|
+
const {
|
|
115
|
+
imageResource,
|
|
116
|
+
width,
|
|
117
|
+
height,
|
|
118
|
+
horizontalAlignment,
|
|
119
|
+
verticalAlignment,
|
|
120
|
+
paragraphStyle,
|
|
121
|
+
style,
|
|
122
|
+
columnSpan,
|
|
123
|
+
rowSpan,
|
|
124
|
+
} = props;
|
|
114
125
|
const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
|
|
115
|
-
const imageElement =
|
|
126
|
+
const imageElement =
|
|
127
|
+
imageResource && Image.create({ imageResource, width, height, horizontalAlignment, verticalAlignment });
|
|
116
128
|
const pararaphProps = {
|
|
117
129
|
style: paragraphStyle ? { ...paragraphStyle, type: "ParagraphStyle" } : undefined,
|
|
118
130
|
styleName: styleNames.ParagraphStyle,
|
|
@@ -123,10 +135,7 @@ export function ImageCell(props: ImageCellProps, styleNameTypes: Record<string,
|
|
|
123
135
|
return TableCell.create({ columnSpan, rowSpan, style, styleName: styleNames.TableCellStyle }, [paragraph]);
|
|
124
136
|
}
|
|
125
137
|
|
|
126
|
-
export type ImageParagraphProps = {
|
|
127
|
-
readonly imageResource: ImageResource.ImageResource;
|
|
128
|
-
readonly width: number;
|
|
129
|
-
readonly height: number;
|
|
138
|
+
export type ImageParagraphProps = ImageProps & {
|
|
130
139
|
readonly style?: ParagraphStyle.ParagraphStyle;
|
|
131
140
|
readonly styleNames?: string;
|
|
132
141
|
};
|
|
@@ -135,9 +144,10 @@ export function ImageParagraph(
|
|
|
135
144
|
props: ImageParagraphProps,
|
|
136
145
|
styleNameTypes: Record<string, string>
|
|
137
146
|
): Paragraph.Paragraph | undefined {
|
|
138
|
-
const { imageResource, width, height, style } = props;
|
|
147
|
+
const { imageResource, width, height, style, horizontalAlignment, verticalAlignment } = props;
|
|
139
148
|
const styleNames = extractStyleNames(props.styleNames, styleNameTypes);
|
|
140
|
-
const imageElement =
|
|
149
|
+
const imageElement =
|
|
150
|
+
imageResource && Image.create({ imageResource, width, height, horizontalAlignment, verticalAlignment });
|
|
141
151
|
const pararaphProps = { style, styleName: styleNames.ParagraphStyle };
|
|
142
152
|
return imageElement
|
|
143
153
|
? Paragraph.create(pararaphProps, [imageElement])
|
|
@@ -212,6 +212,24 @@ export const image = `<xs:complexType name="Image">
|
|
|
212
212
|
<xs:attribute name="src" type="xs:string" use="required" />
|
|
213
213
|
<xs:attribute name="width" type="xs:decimal" use="required" />
|
|
214
214
|
<xs:attribute name="height" type="xs:decimal" use="required" />
|
|
215
|
+
<xs:attribute name="verticalAlignment">
|
|
216
|
+
<xs:simpleType>
|
|
217
|
+
<xs:restriction base="xs:string">
|
|
218
|
+
<xs:enumeration value="Top" />
|
|
219
|
+
<xs:enumeration value="Center" />
|
|
220
|
+
<xs:enumeration value="Bottom" />
|
|
221
|
+
</xs:restriction>
|
|
222
|
+
</xs:simpleType>
|
|
223
|
+
</xs:attribute>
|
|
224
|
+
<xs:attribute name="horizontalAlignment">
|
|
225
|
+
<xs:simpleType>
|
|
226
|
+
<xs:restriction base="xs:string">
|
|
227
|
+
<xs:enumeration value="Left" />
|
|
228
|
+
<xs:enumeration value="Center" />
|
|
229
|
+
<xs:enumeration value="Right" />
|
|
230
|
+
</xs:restriction>
|
|
231
|
+
</xs:simpleType>
|
|
232
|
+
</xs:attribute>
|
|
215
233
|
</xs:complexType>`;
|
|
216
234
|
|
|
217
235
|
export const pageBreak = `<xs:complexType name="PageBreak" />`;
|