POI XSSF how to set text vertical top in the cell - java

Recently, I've met a problem on how to set the text into the vertical top using XSSF, I need to put the text in the top of one cell, but when I use
cellStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
it always show the text in the middle center of the cell, i'm so confused and don't know which method i need to change, very appreciate someone could give me some hints, thanks so much in advance!

Related

How to align the value with the beginning of the Horizontal Bar Chart - MPAndroidChart

I'm trying to align the value text with the beginning of the chart.
The ways I've found to change the location of the text are:
mChart.setDrawValueAboveBar(false);
mChart.setDrawValuesForWholeStack(true);
And both doesn't help me, if you know if it's possible to align the text value another way please tell me!
Thank you!

Is there always a natural "space" between cells in a table?

I created a table with "buttons" aligned onto my screen for my game I am using to learn libgdx. I want the buttons to squeeze together perfectly to form a seamless menu, however there seems to be a natural padding of 1 to 2 pixels between every cell.
Is there a way to remove that padding?
The code seems unnecessary but this is the contents of my table anyways:
table.add(buttonTyce).size(150,60).expandX().expandY().bottom().left().row();
table.add(buttonGrokk).size(150,60).bottom().left().row();
table.add(buttonCeleste).size(150,60).bottom().left().row();
table.add(buttonDaem).size(150,60).bottom().left().row();
table.add(buttonRisp).size(150,60).bottom().left().padBottom(80).row();
table.setFillParent(true);
stage.addActor(table);
Thank you for any help.
I don't think there is default space. Are you sure that the texture you are using for your buttons doesn't contain any transparent edges? Also, there's table.debug() (or something like that, check the docs) to draw lines around table cells for debugging such issues.

Text direction in apache poi

How to make the text direction in Apache poi as Vertical.
I tried Vertical alignment. I am not able to get the desired results.
I don't want to rotate the text.
Something like :
T
E
X
T
You have to create a cellStyle, where You have a method setRotation(short rotation). Subsequently apply the cellstyle to Your cell.
docs, for setRotation
https://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFCellStyle.html#setRotation(short)

LibGDX internal button spacing

I am trying to a create a gui in libGDX, but I am having problems with my buttons.
I am currently using a 9patch image for my button, which looks like this:
This button scales perfectly well, it's just that when I add text to the button there is too much space between the top of the button, and the top of this text. Like this:
The red line marks the amount of space between the top of the button and the top of the text. This space is too large, and I am wondering if there is any way to reduce it.
The font I am using is not scaled, and it is a normal BitmapFont with no filter. Regardless of the scale, the space between the text and the top edge is always proportionate, meaning that the space still looks the same size when I am using a small font or a large font, relative to the text size.
Any suggestions would be appreciated.
To solve this problem I did the following.
When adding the button to the table, I used the following Code.
table.add(button).height(HEIGHT).width(WIDTH);
This did not solve the mentioned issue, but it allowed me to explicitly set the desired width and height of the button, which played a part in solving the actual issue.
When creating the button, the button, being an extension of Cell, I used to add() function to re-position the text.
button = new TextButton("button", style);
button.add(button.getLabel()).padBottom(CONSTANT);
combined with the Cell.height() function, I was able to use a constant padding variable to position the button's text (or label) in the middle of the button.

Add text and an alligned image to a ColumnText Itext

I am writing text from right to left.
how can i add an image at the end of the text (alligned nicely)?
The question isn't entirely clear.
The order of objects added to a Document is always respected, except in the case of Image objects. If an Image object doesn't fit the page, it can be forwarded to the next page, and other content can be added first. If you want to avoid this, use writer.setStrictImageSequence(true);
However: you're writing from Right to Left (probably in Hebrew), so the above doesn't apply, not the previous answer by Anshu. You can only use RTL in ColumnText and PdfPTable.
It's not clear what you want to do.
Do you want to add an Image at the bottom of the text? That's easy: just add the text first, then add the Image. Do you want to add an Image inline? In that case, you can wrap the Image in a Chunk as is done in this example: http://itextpdf.com/examples/iia.php?id=54
My interpretation is: you want to add the image at the bottom left, and you want the text to be added next to the image. That's more difficult to achieve. You'd need to add the Image and the text separately. Add the Image at an absolute position and add the text using 'irregular columns'. That is: ColumnText in text mode (as opposed to composite mode). For an example showing how to use irregular columns, see http://itextpdf.com/examples/iia.php?id=67

Categories

Resources