Merge pull request #118 from dolanmiu/feat/add-image-to-run
Add image to run
This commit is contained in:
@ -2,13 +2,13 @@
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
import { Formatter } from "../../export/formatter";
|
||||
import { Image } from "./image";
|
||||
import { ImageParagraph } from "./image";
|
||||
|
||||
describe("Image", () => {
|
||||
let image: Image;
|
||||
let image: ImageParagraph;
|
||||
|
||||
beforeEach(() => {
|
||||
image = new Image({
|
||||
image = new ImageParagraph({
|
||||
referenceId: 0,
|
||||
stream: new Buffer(""),
|
||||
path: "",
|
||||
|
@ -3,7 +3,7 @@ import { IMediaData } from "../media";
|
||||
import { Paragraph } from "./paragraph";
|
||||
import { PictureRun } from "./run";
|
||||
|
||||
export class Image extends Paragraph {
|
||||
export class ImageParagraph extends Paragraph {
|
||||
private readonly pictureRun: PictureRun;
|
||||
|
||||
constructor(imageData: IMediaData, drawingOptions?: IDrawingOptions) {
|
||||
@ -15,4 +15,8 @@ export class Image extends Paragraph {
|
||||
public scale(factorX: number, factorY?: number): void {
|
||||
this.pictureRun.scale(factorX, factorY);
|
||||
}
|
||||
|
||||
public get Run(): PictureRun {
|
||||
return this.pictureRun;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// http://officeopenxml.com/WPparagraph.php
|
||||
import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
|
||||
import { IMediaData } from "file/media";
|
||||
import { Image } from "file/media";
|
||||
import { Num } from "file/numbering/num";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
|
||||
@ -54,9 +54,10 @@ export class Paragraph extends XmlComponent {
|
||||
return run;
|
||||
}
|
||||
|
||||
public createPictureRun(imageData: IMediaData): PictureRun {
|
||||
const run = new PictureRun(imageData);
|
||||
public addImage(image: Image): PictureRun {
|
||||
const run = image.Run;
|
||||
this.addRun(run);
|
||||
|
||||
return run;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user