From 8d72fa55421bc59b0fe8f3005723581be32a7fef Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 12 Mar 2017 23:31:43 +0000 Subject: [PATCH] added more boilerplate files to drawing --- ts/docx/index.ts | 2 ++ ts/docx/run/picture-run.ts | 10 ++++++++++ ts/docx/run/run-components/drawing/index.ts | 2 +- ts/docx/run/run-components/drawing/inline.ts | 8 -------- .../drawing/inline/graphic/graphic-data/index.ts | 8 ++++++++ .../run/run-components/drawing/inline/graphic/index.ts | 8 ++++++++ ts/docx/run/run-components/drawing/inline/index.ts | 8 ++++++++ 7 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 ts/docx/run/picture-run.ts delete mode 100644 ts/docx/run/run-components/drawing/inline.ts create mode 100644 ts/docx/run/run-components/drawing/inline/graphic/graphic-data/index.ts create mode 100644 ts/docx/run/run-components/drawing/inline/graphic/index.ts create mode 100644 ts/docx/run/run-components/drawing/inline/index.ts 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"); + } +}