I am trying to set the width of a textbox as undefined so it will behave as autofit
in powerPoint 2007 I use the following:
shape = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, left, top, 0f, 0f);
And it look fine on the slide in pp-2007
But when I open the presentation in pp-2010 I get all the characters of the text wraped under each other.
This is maybe to be expected when you set the width as 0 but it looks fine in pp-2007.
I also use the following but it dose not help:
shape.AutoSize = PpAutoSize.ppAutoSizeShapeToFitText;
I tried it also like this:
shape = slide.Shapes.AddTextbox(Office.MsoTextOrientation.msoTextOrientationHorizontal, left, top, float.NaN, 0f);
But that only gives me a very long textbox
Can anyone help me on this?
You should disable word wrap then PowerPoint will size the text box as required:
shape.TextFrame.AutoSize = ppAutoSizeShapeToFitText
shape.TextFrame.WordWrap = msoFalse
shape.TextFrame.TextRange.Text = "Text"
Related
I am trying to increase the size of an image in a .pdf document using knitr, but when I try to do this the image shifts to the right and off the page. Here is the syntax I am using:
```{r test_image, echo = FALSE, out.width = '150%', fig.align = 'center'}
knitr::include_graphics("test_image.png")
```
I have also tried inserting fig.height and fig.width to adjust the height (instead of using out.width) but I still get the same thing. I have also tried fig.align = 'left' to keep the image on the page but that does not solve the issue either.
Has anyone else noticed this behavior? Is there a way to maintain the image centering when increasing the image size?
My thoughts.
I think, that this problem exists because of "big amount" of whitespace on left and right sides of your picture.
You can trim it manually and add after with knitr::include_graphics or do it with latex straightaway:
Add to your header:
header-includes:
- \usepackage{graphicx}
Add your pic
\includegraphics [trim={5cm 0 5cm 0},clip]{Ml6KL.png}
#you can also customize your width/height
#\includegraphics [trim={5cm 0 5cm 0},clip, width = XX, height = XX]{Ml6KL.png}
An output:
P.S. If you can - try to find better versions of first two logos(or scale < 1). As you can see - the quality leaves much to be desired...
I'm trying to parse the PSD file using PSD.rb gem.
When I'm trying to get the text box bounds, it is giving minimal bounding box for the text, not the actual text rectangle dimensions in the psd file.
Similar issue was posted here: https://github.com/layervault/psd.rb/issues/78
But, there is no proper solution for it. So, can anybody help me in finding the exact text box Bounds from PSD?
Thanks in advance!
Getting Height & Width information from the bounds object:
bounds = layer.adjustments[:type].data[:text]["bounds"]
layer_tree = layer.to_hash
transform = layer_tree[:text][:transform]
top = transform[:ty] + bounds["Top "][:value]
left = transform[:tx]
width = bounds["Rght"][:value]
height = bounds["Btom"][:value] - bounds["Top "][:value]
Thanks.
I'm working with a 2x2 GridLayout in Vaadin.
gridLayout = new GridLayout(2, 2);
gridLayout.setWidth(100, Unit.PERCENTAGE);
gridLayout.setMargin(true);
gridLayout.setSpacing(true);
The cell in the upper-left corner contains a simple label aligned to the right. Upper-right cell contains a textfield aligned to the left. The second row simply contains a label below the textfield.
gridLayout.addComponent(captionLabel, 0, 0);
gridLayout.addComponent(inputField, 1, 0);
gridLayout.setComponentAlignment(captionLabel, Alignment.MIDDLE_RIGHT);
gridLayout.setComponentAlignment(inputField, Alignment.MIDDLE_LEFT);
Now I want to have both columns within the grid to have size set to 50% to have the whole layout aligned in the middle of my page - now it is slightly shifted to the left side and I can not figure out why...
Vaadin's wiki-page shows a related article, but I can not figure out how to work with it. Seems to be deprecated, because I can not access #getColumn(); - method?! https://vaadin.com/wiki/-/wiki/10674/Configuring+Grid+column+widths
For further info: The GridLayout is added as a separate component to a VerticalLayout.
You can influence the column width's with the grid.setColumnExpandRatio(1, 1); method.
If you wish to have both use 50% of the total width, just set the expand ration to the same value on both columns.
Please also note this:
A layout that contains components with percentual size must have a defined size!
If a layout has undefined size and a contained component has, say, 100% size, the component would fill the space given by the layout, while the layout would shrink to fit the space taken by the component, which is a paradox. This requirement holds for height and width separately.
Book of Vaadin
Solved it by adding a HorizontalLayout-wrapper for the left column containing the label. The right colum contains a VerticalLayout with all other components.
Label captionLabel = new Label(localized);
captionLabel.setSizeUndefined();
HorizontalLayout wrapper = new HorizontalLayout();
wrapper.setSizeFull();
wrapper.addComponent(captionLabel);
wrapper.setComponentAlignment(captionLabel, Alignment.TOP_RIGHT);
[...]
gridLayout.addComponent(wrapper, 0, 0);
gridLayout.addComponent(inputLayout, 1, 0);
gridLayout.setColumnExpandRatio(0, (float)0.5);
gridLayout.setColumnExpandRatio(1, (float)0.5);
I want align text to center on elm_label widget. I can't find any functions about text align as evas object text function or elm_label function. Also, I can't find a function that can get the text size (absolute pixel or relative size) on a label.
I have tried elm_object_style_set with marker, it was showed bold text on center of label, but font size was too small (smaller than default style). (and I don't want bold on text.)
How I can align text to the center of a label?
You can use HTML like markup to customize the way you want to the display the text in elm_label.
To align the text to the center, you can use <align> markup tag with value center .
std::string text = "<align = center> TEXT TO DISPLAY </align>";
Evas_Object *label = elm_label_add(parent);
elm_object_text_set(label,text.c_str());
evas_object_show(label);
You can also use other tags like font_weight, font_style to customize your display text. List of all possible tags can be found here
You can set the alignment of the label through the evas_object API. Likely what you are looking for is:
evas_object_size_hint_align_set(label, 0.5, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
The 0.5 is center, you could try 0.0 for left align and 1.0 for right.
I'm learning Corona SDK and am new to lua as well (i mainly do ruby and some javascript).
I have a bar that i want to fill up as the user does stuff. I've set it up as follows:
--outer rectangle
powerBar = display.newRect(210, 6, 24, 9)
powerBar.strokeWidth = 1
powerBar:setStrokeColor(254,203,50)
powerBar:setFillColor(0,0,0,0)
--inner rectangle which fills up
powerBarFill = display.newRect(211,7,0,7)
powerBarFill:setFillColor(234,183,30)
When the "stuff" happens, i add 1 to powerBarFill.width, which i thought would make it grow from left to right. But, it's actually growing out from the centre, ie its x is in the centre and the width extends either side from that.
Whats the best way to keep the left side static and grow the right side? Can i set it so that it's x position is actually on the left hand side rather than in the middle? Seems like that might do it.
cheers in advance
I've run into this problem as well when creating a progress bar. The problem is with the rect's reference point. The default reference point is in the center of an object, as you've noticed. You can use object:setReferencePoint() to change it. I believe you want to use the display.BottomLeftReferencePoint value:
powerBar:setReferencePoint(display.BottomLeftReferencePoint)
Keep in mind that you have to set this value before you set your x,y values. So in your case you'll need to set the reference point after creating the rectangle, and then assign values to x,y again (even though you already did this in the newRect constructor):
powerBar = display.newRect(210, 6, 24, 9)
powerBar:setReferencePoint(display.BottomLeftReferencePoint)
powerBar.x, powerBar.y = 210, 6
If it's width is from the X position on both sides:
1) It should start at:
Centre - (Width when it's full / 2)
2) Every frame, add:
incrs = 1 --Amount to increase by
width = width + incrs
x = x + incrs / 2