diff --git a/ts/docx/index.ts b/ts/docx/index.ts index 875821c29a..1e837b8340 100644 --- a/ts/docx/index.ts +++ b/ts/docx/index.ts @@ -2,4 +2,6 @@ export { Document } from "./document"; export { Paragraph } from "./paragraph"; export { Run } from "./run"; export { TextRun } from "./run/text-run"; +export { PictureRun } from "./run/picture-run"; export { Table } from "./table"; +// Perhaps all run related stuff can be exported from run, instead of exporting Run, TextRun, PictureRun seperately. diff --git a/ts/docx/run/picture-run.ts b/ts/docx/run/picture-run.ts new file mode 100644 index 0000000000..fdf2310c4b --- /dev/null +++ b/ts/docx/run/picture-run.ts @@ -0,0 +1,10 @@ +import { Run } from "../run"; +import { Drawing } from "./run-components/drawing"; + +export class PictureRun extends Run { + + constructor(imagePath: string) { + super(); + this.root.push(new Drawing(imagePath)); + } +} diff --git a/ts/docx/run/run-components/drawing/index.ts b/ts/docx/run/run-components/drawing/index.ts index 61820442ed..668f45c612 100644 --- a/ts/docx/run/run-components/drawing/index.ts +++ b/ts/docx/run/run-components/drawing/index.ts @@ -2,7 +2,7 @@ import { XmlComponent } from "../../../xml-components"; export class Drawing extends XmlComponent { - constructor() { + constructor(imagePath: string) { super("w:drawing"); } } diff --git a/ts/docx/run/run-components/drawing/inline.ts b/ts/docx/run/run-components/drawing/inline.ts deleted file mode 100644 index 47ce8dabcd..0000000000 --- a/ts/docx/run/run-components/drawing/inline.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { XmlComponent } from "../../../xml-components"; - -export class Inline extends XmlComponent { - - constructor() { - super("w:drawing"); - } -} diff --git a/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/index.ts b/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/index.ts new file mode 100644 index 0000000000..b9e8267e0d --- /dev/null +++ b/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/index.ts @@ -0,0 +1,8 @@ +import { XmlComponent } from "../../../../../../xml-components"; + +export class Graphic extends XmlComponent { + + constructor() { + super("a:graphicData"); + } +} diff --git a/ts/docx/run/run-components/drawing/inline/graphic/index.ts b/ts/docx/run/run-components/drawing/inline/graphic/index.ts new file mode 100644 index 0000000000..d922f44f58 --- /dev/null +++ b/ts/docx/run/run-components/drawing/inline/graphic/index.ts @@ -0,0 +1,8 @@ +import { XmlComponent } from "../../../../../xml-components"; + +export class Graphic extends XmlComponent { + + constructor() { + super("a:graphic"); + } +} diff --git a/ts/docx/run/run-components/drawing/inline/index.ts b/ts/docx/run/run-components/drawing/inline/index.ts new file mode 100644 index 0000000000..be38ec1836 --- /dev/null +++ b/ts/docx/run/run-components/drawing/inline/index.ts @@ -0,0 +1,8 @@ +import { XmlComponent } from "../../../../xml-components"; + +export class Inline extends XmlComponent { + + constructor() { + super("wp:inline"); + } +}