Comments (6)
Have you tried to push img as a child to paragraph?
from docx.
Still an issue, I've verified the arrayBuffer is correct for the uploaded file, but nothing ends up in the final document. Can anyone shed light on what I'm missing here?
const imageResponse = await fetch(item.url!)
const imageArrayBuffer = await imageResponse.arrayBuffer()
const imageParagraph = new Paragraph({
spacing: {
after: 150,
},
children: [
new ImageRun({
data: imageArrayBuffer,
transformation: {
width: 100,
height: 100,
}
}),
],
})
docSectionChildren.push(imageParagraph) // from here they're added to the document section. All of that is working for everything else.
from docx.
ImageRun
now requires the mimetype (eg. 'image/png') to be specified undertype
property. FWIW this library is much easier to use with Typescript.
from docx.
ImageRun
now requires the mimetype (eg. 'image/png') to be specified undertype
property. FWIW this library is much easier to use with Typescript.
I'm using TypeScript, but the IImageOptions interface doesn't have a type
property:
export interface IImageOptions {
readonly data: Buffer | string | Uint8Array | ArrayBuffer;
readonly transformation: IMediaTransformation;
readonly floating?: IFloating;
readonly altText?: DocPropertiesOptions;
readonly outline?: OutlineOptions;
}
But I see this in GitHub: https://github.com/dolanmiu/docx/blob/master/src/file/paragraph/run/image-run.ts where there is a type property. Also, I'm using the current release (8.5.0). Any ideas?
from docx.
I also tried pulling down the repo and using a freshly built version. IImageOptions is updated to have the image type which is good, but it still isn't rendering images.
from docx.
You're right - I forgot that I'm running a fork off of master.
I've always supplied a Blob to IImageOptions (even though it's not in the supported type) - might be worth a try?
from docx.
Related Issues (20)
- Generate Table Of Contents (TOC) programmatically HOT 3
- What I am doing wrong ?
- Inconsistency in bulleted lists between Mac Pages, MSWord, and Google Docs. HOT 1
- can i add background color on entire header section? please suggest me HOT 4
- Use fitText In TextRun HOT 1
- Table of Content manual update option missing
- Table Styling Issue - Default & externalStyles
- Corrupted document when using async await for image load HOT 1
- NPM 8.5.0 Package / wrong types for patchDocument HOT 4
- patchDocument - input.prepForXml Error HOT 1
- Open exists docx file by Document ? HOT 1
- How to integrate HTML string into the docx? HOT 5
- nodenext: Module '"docx"' has no exported member 'Paragraph'. HOT 3
- Can i set border style for 'dashLargeGap'?
- Patching of values in Text Frames/Boxes HOT 1
- The same table may appear on different pages
- Corrupted document after using Patcher with version 8.4.0 HOT 2
- Using embedded fonts for client side generated files
- Text Frame not working correctly after save to docx file, and not support for almost doc viewer
- How can i set padding to a Paragraph? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docx.