Make media return a picture run instead
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
// Add image to table cell
|
||||
// Import from 'docx' rather than '../build' if you install from npm
|
||||
import * as fs from "fs";
|
||||
import { Document, Media, Packer, Table } from "../build";
|
||||
import { Document, Media, Packer, Paragraph, Table } from "../build";
|
||||
|
||||
const doc = new Document();
|
||||
const image = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg"));
|
||||
@ -10,7 +10,7 @@ const table = new Table({
|
||||
rows: 2,
|
||||
columns: 2,
|
||||
});
|
||||
table.getCell(1, 1).addParagraph(image.Paragraph);
|
||||
table.getCell(1, 1).addParagraph(new Paragraph(image));
|
||||
|
||||
doc.addTable(table);
|
||||
|
||||
|
Reference in New Issue
Block a user