From 66eace4a33737c8eb956e8128cc747a3fdb72bda Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 13 Mar 2017 00:40:39 +0000 Subject: [PATCH] added a attribute to graphic --- .../inline/graphic/graphic-data/pic/blip/blip.ts | 4 ++-- .../drawing/inline/graphic/index.ts | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/pic/blip/blip.ts b/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/pic/blip/blip.ts index 12ae6b01e2..2926c52893 100644 --- a/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/pic/blip/blip.ts +++ b/ts/docx/run/run-components/drawing/inline/graphic/graphic-data/pic/blip/blip.ts @@ -1,7 +1,7 @@ import { XmlAttributeComponent, XmlComponent } from "../../../../../../../../xml-components"; -export interface IBlipProperties { - embed?: string; +interface IBlipProperties { + embed: string; } class BlipAttributes extends XmlAttributeComponent { diff --git a/ts/docx/run/run-components/drawing/inline/graphic/index.ts b/ts/docx/run/run-components/drawing/inline/graphic/index.ts index f512e8ad5a..75dd24f75d 100644 --- a/ts/docx/run/run-components/drawing/inline/graphic/index.ts +++ b/ts/docx/run/run-components/drawing/inline/graphic/index.ts @@ -1,10 +1,24 @@ -import { XmlComponent } from "../../../../../xml-components"; +import { XmlAttributeComponent, XmlComponent } from "../../../../../xml-components"; import { GraphicData } from "./graphic-data"; + +interface IGraphicProperties { + a: string; +} + +class GraphicAttributes extends XmlAttributeComponent { + protected xmlKeys = { + a: "xmlns:a", + }; +} + export class Graphic extends XmlComponent { constructor(referenceId: number) { super("a:graphic"); + this.root.push(new GraphicAttributes({ + a: "http://schemas.openxmlformats.org/drawingml/2006/main", + })); this.root.push(new GraphicData(referenceId)); } }