Remove create table helper function

This commit is contained in:
Dolan
2019-06-25 01:21:28 +01:00
parent dfe986331d
commit c97d15cb9f
22 changed files with 132 additions and 422 deletions

View File

@ -1,9 +1,10 @@
import { XmlComponent } from "file/xml-components";
import { HeaderReferenceType } from "./document";
import { IDrawingOptions } from "./drawing";
import { Header } from "./header/header";
import { Image, Media } from "./media";
import { ImageParagraph, Paragraph } from "./paragraph";
import { Paragraph } from "./paragraph";
import { Relationships } from "./relationships";
import { Table } from "./table";
@ -29,22 +30,26 @@ export class HeaderWrapper {
this.header.addTable(table);
}
public createTable(rows: number, cols: number): Table {
return this.header.createTable(rows, cols);
public addImage(image: Image): HeaderWrapper {
this.header.addParagraph(image.Paragraph);
return this;
}
public addChildElement(childElement: XmlComponent | string): void {
this.header.addChildElement(childElement);
}
public createImage(image: Buffer | string | Uint8Array | ArrayBuffer, width?: number, height?: number): void {
const mediaData = this.media.addMedia(image, width, height);
this.addImage(new Image(new ImageParagraph(mediaData)));
}
public createImage(
buffer: Buffer | string | Uint8Array | ArrayBuffer,
width?: number,
height?: number,
drawingOptions?: IDrawingOptions,
): Paragraph {
const image = Media.addImage(this, buffer, width, height, drawingOptions);
const paragraph = new Paragraph(image);
this.addParagraph(paragraph);
public addImage(image: Image): HeaderWrapper {
this.header.addParagraph(image.Paragraph);
return this;
return paragraph;
}
public get Header(): Header {