Add image to run

This commit is contained in:
Dolan
2018-08-09 01:55:50 +01:00
parent 94274733f4
commit e10c20fa42
9 changed files with 43 additions and 20 deletions

View File

@ -7,9 +7,9 @@ import { SectionPropertiesOptions } from "./document/body/section-properties/sec
import { FooterWrapper } from "./footer-wrapper";
import { FootNotes } from "./footnotes";
import { HeaderWrapper } from "./header-wrapper";
import { Media } from "./media";
import { Image, Media } from "./media";
import { Numbering } from "./numbering";
import { Bookmark, Hyperlink, Image, Paragraph } from "./paragraph";
import { Bookmark, Hyperlink, Paragraph } from "./paragraph";
import { Relationships } from "./relationships";
import { Styles } from "./styles";
import { ExternalStylesFactory } from "./styles/external-styles-factory";
@ -126,19 +126,19 @@ export class File {
public createImage(filePath: string): Image {
const image = Media.addImage(this, filePath);
this.document.addParagraph(image);
this.document.addParagraph(image.Paragraph);
return image;
}
public addImage(image: Image): File {
this.document.addParagraph(image);
this.document.addParagraph(image.Paragraph);
return this;
}
public createImageFromBuffer(buffer: Buffer, width?: number, height?: number): Image {
const image = Media.addImageFromBuffer(this, buffer, width, height);
this.document.addParagraph(image);
this.document.addParagraph(image.Paragraph);
return image;
}