-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[QUESTION] Setting the "Wrap text in shape" option #771
Comments
+1 for the feature or an explanation on how to implement it if it's hidden but available :). |
Wrapping text is usually done by powerpoint's internal rendering engine when you open the pptx. I'd be interested to know if this library can enable "wrap" on overflow and if it has any affect on the text. |
As of v3.3.1 there's a new demo slide with examples and explanations for how wrap works. |
Hi @gitbrent , setting the property Setting var pptx = new PptxGenJS();
var slide = pptx.addSlide();
slide.addText(
'A long text. A very long text. It is so long prompting the question when does it end? Maybe now, or never? All things end, I guess. So, is it the end for now?',
{ x:1, y:1, w: 1, h:3, align:'center', fill:{ color:pptx.SchemeColor.background2, transparency:50 }, wrap: false }
);
pptx.writeFile('PptxGenJS-Sandbox-'+getTimestamp())
.then(function(fileName){ console.log('Saved! File Name: '+fileName) }); Still need to work with var pptx = new PptxGenJS();
var slide = pptx.addSlide();
slide.addText(
'A long text. A very long text. It is so long prompting the question when does it end? Maybe now, or never? All things end, I guess. So, is it the end for now?',
{ x:1, y:1, w: 1, h:3, align:'center', fill:{ color:pptx.SchemeColor.background2, transparency:50 }, _bodyProp: { wrap: 'none' } }
);
pptx.writeFile('PptxGenJS-Sandbox-'+getTimestamp())
.then(function(fileName){ console.log('Saved! File Name: '+fileName) }); I think Best regards |
Fixed! Thanks @CroniD var pptx = new PptxGenJS();
var slide = pptx.addSlide();
slide.addText("A long text. A very long text. It is so long prompting the question when does it end?", {
x: 0.5,
y: 0.5,
w: 4,
h: 2,
align: "center",
fill: { color: pptx.SchemeColor.background2, transparency: 50 },
wrap: false,
});
slide.addText("A long text. A very long text. It is so long prompting the question when does it end?", {
x: 0.5,
y: 3,
w: 4,
h: 2,
align: "center",
fill: { color: pptx.SchemeColor.background2, transparency: 50 },
wrap: true,
});
pptx.writeFile("PptxGenJS-Sandbox-" + getTimestamp()).then(function (fileName) {
console.log("Saved! File Name: " + fileName);
}); |
Hi Team, when version 3.5.0 will be available. I am also looking for wrap feature. |
Hi @sachinbagla86 , you can use it already in 3.4.0. Just set it like |
Update for version 3.3.0:
bodyProp
renamed to_bodyProp
. Also, there is now a property calledwrap
(boolean, default: true), but it does nothing at the moment.Hi there,
Category
Version
Please specify what version of the library you are using: [3.2.1]
Please specify what version(s) of PowerPoint you are targeting: [2019 & 365]
Expected / Desired Behavior / Question
There is no obvious property to control the "Wrap text in shape" option for shapes and text boxes in the documentation.
But there is in code: https://github.com/gitbrent/PptxGenJS/blob/master/src/gen-xml.ts#L1038
Using
none
will uncheck it, whilesquare
will check it.There is a
textWrap
property mentioned in https://github.com/gitbrent/PptxGenJS/blob/master/src/gen-xml.ts#L516 , but I don't know if this code is related.And there is the
bodyProp.wrap
property in https://github.com/gitbrent/PptxGenJS/blob/master/src/core-interfaces.ts#L648 , but with a wrong type andwrap
https://github.com/gitbrent/PptxGenJS/blob/master/src/core-interfaces.ts#L706 as a boolean. I guess, the first one is a bug, the other might be correct, if an easy usage is intended for future versions.Also, I guess, the
bodyProp.wrap
property has some relevance for how text will flow around an image or chart or media object, but I'm not sure on that part.The text was updated successfully, but these errors were encountered: