Docx: Document Header/Footer - Table cell with Image

Created on 6 Sep 2018  路  3Comments  路  Source: dolanmiu/docx

In reference to closed issue #82 and Demo24 which both now work great if I try and use the same functionality in the document Header i get a "This picture can't be displayed"

const table = doc.createTable(1, 1);
table.getCell(1, 0).addContent(new Paragraph("This is am header"));

const image = Media.addImage(doc, "./demo/images/image1.jpeg");
table.getCell(1, 1).addContent(image.Paragraph);

image

Many thanks, DocX is great by the way thanks for all your work

bug

Most helpful comment

Did some investigation

I will fix but it will take some time

Basically, when you add an image to the header/footer, it does not create a relationship

I will re-write this with a better "scanning" solution

At the moment, adding table wont add relationships, and .addImage also wont add relationships to header/footer

only .createImage adds relationships.

So, there's 2 bugs actually!

All 3 comments

Thanks for raising this bug!

Same problem here.

Additionally, the header createImage method is more restrictive than paragraph.createImage. It would be great if the first parameter has the same options (not only Buffer) than paragraph. Maybe the bug is in that line.

Did some investigation

I will fix but it will take some time

Basically, when you add an image to the header/footer, it does not create a relationship

I will re-write this with a better "scanning" solution

At the moment, adding table wont add relationships, and .addImage also wont add relationships to header/footer

only .createImage adds relationships.

So, there's 2 bugs actually!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sleepinzombie picture sleepinzombie  路  3Comments

jacwright picture jacwright  路  6Comments

efx picture efx  路  6Comments

brunogaleski picture brunogaleski  路  6Comments

zahrafali picture zahrafali  路  5Comments