-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
idea: positioning #79
Comments
Hi! You could try: modify.updatePosition({
// move right by 1cm
x: CmToDxa(1),
// and reduce width by 1cm
w: CmToDxa(1) * -1,
}), Additional info for each shape coordinates will bring const myTemplates = await pres.getInfo();
const shapeInfo = myTemplates.elementByName(`SlideWithShapes.pptx`, 1, 'Cloud 1');
// will return:
/*
{
name: 'Cloud 1',
type: 'sp',
id: '{B37A9009-27E0-43C3-8542-60F760C1FB47}',
position: { x: 9525000, y: 5240337, cx: 1820333, cy: 990600 }
}
*/ Have fun! 😄 |
While |
I'm so, so sorry, I don't know how I didn't find this! Seems this is redundant in that case! |
I don't think getAllTextElementIds uses setCreationIds does it? Regardless, I don't disagree, getAllTextElementIds and getAllSlideNumbers I just popped in because it enables the replace text on random arbitrary PPTXs which to me was invaluable as a feature, and I needed it asap. I just had a peek at the getAllTextElementIds test and yeah, aha, that was clearly written 'quickly'. At the least it should check for the actual elementIds (not just length), a check for creationIds on and off, and also a check for if it would work for text elements we add to the slide ourselves before using it (possibly not, but so long as that's documented not the end of the world as you can keep track of those yourself). I think more generally it would be really nice to have a chat about if it's worth expanding this "discovery" concept in general, we could then get a general method in place we're both happy with. The roots for what I did already appear to be in a new class that more methods could be added to. For example I could imagine a use for (and these might not be one helper, may be separated into a slide.getAll[$shape]Ids and a element.getX);
|
Hi,
We know we can set positioning using this lib e.g
But is there a way (using this lib) of getting existing position of elements, so we could move them e.g 1cm to the right (or whatever) programatically. I'm thinking, could this be added to getInfo, or we just add a helper;
getSizesAndPositions([elementIds]) which returns an object with the id,name, current position and dimensions or similar?
or slide.getAllElementPositions(), bonus points for us using internal helpers similar to the backend workings of my old slide.getAllTextElementIds() (or whatever it was) to tell the user if it is a textbox, image or chart (further support for element types added as we go, this could be a type ElementTypeIfKnown: "text" | "chart" ...
This would hook in with your recent support for replacing images with external files and so on, now we can move them in a relative rather than absolute way.
Thoughts?
The text was updated successfully, but these errors were encountered: