I think that paragraph elements by definition creates a new line but I need to insert elements as the first element of a page not moving down existing elements.
Is there another element I can use instead of paragraph? I think that only tables and paragraphs are available and I understand that tables contains paragraphs so they don't work for my purpose.
Or maybe exists any property I can set to avoid the new paragraph moving the other elements?
I tried keepNext and keepLines but is not what I'm looking for.
You can absolutely position an ellipse, without it being in the first paragraph on the page.
In Word, on your ellipse, right click and choose "More layout options". On the position tab, eg 1" below page.
This creates something like:
<w:r>
<w:pict>
<v:oval strokecolor="#243f60 [1604]" strokeweight="2pt"
style="position:absolute;margin-left:41.25pt;margin-top:1in;
width:207.35pt;height:1in;z-index:251659264;visibility:visible;mso-wrap-style:square;mso-width-percent:0;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:page;mso-width-percent:0;mso-width-relative:margin;v-text-anchor:middle" id="Oval 1" o:spid="_x0000_s1026">
<w10:wrap anchory="page"/>
</v:oval>
</w:pict>
</w:r>
If for some reason you want to add a new first paragraph, you could make the paragraph have a small font, with no space before or after. r:Pr/r:vanish causes the ellipse to vanish, so don't try that!
Related
I need to keep more than one paragraph in the same area. See the image, I want title "Proposal Summary Report", solid line, and next paragraph in the same area. When I used the method setKeepWithNext, it just keep two paragraph in the same area. How can I do it?
You could check the remaining space available on the page, and compare that to the height of the elements you want to render. If there is not enough room to have all of these elements on the same page, insert a new page and then insert the elements.
The wonderful thing about this approach is that it becomes very modular. You can create a virtual element used solely for grouping elements together that imbues this logic. Then, whenever you want elements held together, use this container-element to ensure the logic.
I am using iText 2.1.7
I write a pdf document for which the page size and contant can differ each time. What i want to achieve is a table at the very last page and at the bottom of that page. I am aware of the method 'writeSelectedRows', but with this it could happen that i overwrite text on the page, because i dont know if there is space for my table.
So in conclusion:
If i have reached the last page i want to add my table at the bottom of the page. But if the table does not fit, i want a new page and on this page i want to add the table at the bottom.
I could not find a solution so far.
Use this http://developers.itextpdf.com/de/node/1910 to calculate the height of a table and then check the available space on a page with PdfWriter.GetVerticalPostition(). You might want to consider your Document.BottomMargin or some other offset in your space calculation. (v4.1.6)
Check out this link:
http://developers.itextpdf.com/content/best-itext-questions-stackoverview/general-questions-about-itext/itext7-how-find-out-current-cursor-position-page
I suppose that once you know the current cursor position on this page, you can write a simple if-statement to add a new page, or not.
Kind regards,
Joris
As you can see, after every text comes a tab, everything is working fine, but after third tab (see output) it generates a space not a tab.
fileWriter = new FileWriter(indexFile, true);
fileWriter.append(id).append("\t");
fileWriter.append(String.valueOf(idx)).append("\t");
fileWriter.append(String.valueOf(pageCount)).append("\t");
fileWriter.append(postal.toUpperCase()).append("\t"); <-- this one
fileWriter.append(address.toUpperCase());
fileWriter.append("\r\n");
My output:
00000347 1 1 FB-6666 DUMMY STREET 1 LAT
The problem comes after "FB-6666".
Any ideas on this?
No, it really is generating a tab - it's just that whatever you're using to view the file is deciding to handle tabs by aligning them to some boundary or other. If you make your postal value FB-6666x I suspect you'll then see a much larger space.
This isn't a problem with the file content at all.
If you want to enforce a certain number of spaces between columns, you'll need to write that many spaces. Alternatively, something else to view the file...
Tabstops don't work this way. As the wikipedia article states,
Tab stops are set manually, and pressing the tab key causes the carriage to go to the next tab stop. In text editors on a computer, the same concept is implemented simplistically with automatic, fixed tab stops.
This means the tabstop will stop at a predefined position in the textfile, not after let's say the space it would take to insert a specific amount of spaces.
It is writing a tab I promise - to convince yourself of this you should either open the resulting file in a hex editor and look at the value in that position, or add another character to the value before the tab and see how the format of the output changes.
I need my vertex label displayed entirely inside vertex bounds. I mean if my label is too long then part of it will be displayed outside the vertex box. Is there any way to automatically split label into multiple lines and make it fit the vertex bounds? This line breaks should be recalculated after vertex resize. Can i do it using styles? mxUtils.wordWrap() seems to be the way but i cannot figure out how to use it properly. Give me an example of using it please. Thanks for your answers
Another similar question: Calculate the display width of a string in Java
Abstract:
Graphics.getFontMetrics + FontMetrics.stringWidth
From this, I suppose you could create a List<String> and add the words of the text one at a time until you reach your max length, then add a new node to the list for the overflow. Finally, append each node in the List to each other with a line break in between.
On another note, from what research I did, it seems jGraphX runs on swing. Swing now supports HTML. Here's a link to further info: http://docs.oracle.com/javase/tutorial/uiswing/components/html.html.
I will see if I can get a quick test coded up, but that must wait until I get home.
I have a list of data in a JList component in my GUI.
I would like to know if there is a method that i can call on the list element(s) to strike through a particular element in the list. I would like to draw a line through the element to appear as if that element is canceled.
I want a similar thing like the strike through functionality in Microsoft Word document whereby a line i drawn through the text.
thanks for your help
You can apply html formating to each element of a list. Therefore if you know what element you want struck through you can modify the string held by that element as such:
<html><strike>this text will be struck through</strike></html>
Edit: I should note that I haven't tested this so if the strike tag isn't supported in Java try just s. One of those should work
JIDE Common Layer has a StyledListCellRenderer that can be used to provide this functionality.