Progress on embeddding image
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IGraphicDataAttributes {
|
||||
uri?: string;
|
||||
}
|
||||
|
||||
export class GraphicDataAttributes extends XmlAttributeComponent<IGraphicDataAttributes> {
|
||||
protected xmlKeys = {
|
||||
uri: "uri",
|
||||
};
|
||||
}
|
16
src/file/drawing/inline/graphic/graphic-data/graphic-data.ts
Normal file
16
src/file/drawing/inline/graphic/graphic-data/graphic-data.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { GraphicDataAttributes } from "./graphic-data-attribute";
|
||||
import { Pic } from "./pic";
|
||||
|
||||
export class GraphicData extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("a:graphicData");
|
||||
|
||||
this.root.push(new GraphicDataAttributes({
|
||||
uri: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
||||
}));
|
||||
|
||||
this.root.push(new Pic(referenceId));
|
||||
}
|
||||
}
|
@ -1,10 +1 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Pic } from "./pic";
|
||||
|
||||
export class GraphicData extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("a:graphicData");
|
||||
this.root.push(new Pic(referenceId));
|
||||
}
|
||||
}
|
||||
export * from "./graphic-data";
|
||||
|
@ -2,11 +2,13 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
interface IBlipProperties {
|
||||
embed: string;
|
||||
cstate: string;
|
||||
}
|
||||
|
||||
class BlipAttributes extends XmlAttributeComponent<IBlipProperties> {
|
||||
protected xmlKeys = {
|
||||
embed: "r:embed",
|
||||
cstate: "cstate",
|
||||
};
|
||||
}
|
||||
|
||||
@ -16,6 +18,7 @@ export class Blip extends XmlComponent {
|
||||
super("a:blip");
|
||||
this.root.push(new BlipAttributes({
|
||||
embed: `rId${referenceId}`,
|
||||
cstate: "none",
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IPicAttributes {
|
||||
xmlns?: string;
|
||||
}
|
||||
|
||||
export class PicAttributes extends XmlAttributeComponent<IPicAttributes> {
|
||||
protected xmlKeys = {
|
||||
xmlns: "xmlns:pic",
|
||||
};
|
||||
}
|
@ -2,13 +2,16 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { BlipFill } from "./blip/blip-fill";
|
||||
import { NonVisualPicProperties } from "./non-visual-pic-properties/non-visual-pic-properties";
|
||||
import { PicAttributes } from "./pic-attributes";
|
||||
import { ShapeProperties } from "./shape-properties/shape-properties";
|
||||
|
||||
export class Pic extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("pic:pic");
|
||||
|
||||
this.root.push(new PicAttributes({
|
||||
xmlns: "http://schemas.openxmlformats.org/drawingml/2006/picture",
|
||||
}));
|
||||
this.root.push(new NonVisualPicProperties());
|
||||
this.root.push(new BlipFill(referenceId));
|
||||
this.root.push(new ShapeProperties());
|
||||
|
17
src/file/drawing/inline/inline-attributes.ts
Normal file
17
src/file/drawing/inline/inline-attributes.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IInlineAttributes {
|
||||
distT?: number;
|
||||
distB?: number;
|
||||
distL?: number;
|
||||
distR?: number;
|
||||
}
|
||||
|
||||
export class InlineAttributes extends XmlAttributeComponent<IInlineAttributes> {
|
||||
protected xmlKeys = {
|
||||
distT: "distT",
|
||||
distB: "distB",
|
||||
distL: "distL",
|
||||
distR: "distR",
|
||||
};
|
||||
}
|
@ -1,12 +1,20 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Graphic } from "./graphic";
|
||||
import { GraphicFrameProperties } from "./graphic-frame/graphic-frame-properties";
|
||||
import { InlineAttributes } from "./inline-attributes";
|
||||
|
||||
export class Inline extends XmlComponent {
|
||||
|
||||
constructor(referenceId: number) {
|
||||
super("wp:inline");
|
||||
|
||||
this.root.push(new InlineAttributes({
|
||||
distT: 0,
|
||||
distB: 0,
|
||||
distL: 0,
|
||||
distR: 0,
|
||||
}));
|
||||
|
||||
this.root.push(new GraphicFrameProperties());
|
||||
this.root.push(new Graphic(referenceId));
|
||||
}
|
||||
|
Reference in New Issue
Block a user