I used docx4j for excel implementation.
By using code I drew text frame , then a table and then again a text frame.
I used xdr:absoluteAnchor instead of xdr:twoCellAnchor.
But i noticed that my last (3rd) text frame is moved slightly down.
Is there any way to avoid such shape auto re-placement(auto movement) ?
You should create a text frame in Excel which behaves as you wish, then create corresponding Java code, which you can do by feeding your sample xlsx into http://webapp.docx4java.org/OnlineDemo/PartsList.html
For more help, you'll need to add the XML to your question.
Related
I have been using Apache POI to create excel invoices/reports in my application.
The report uses cell styles which have different foreground and background colors, different font sizes, bordered cells and non-bordered cells. A new requirement needs me to put page borders. I have gone through most of the samples. I could only find sample code for cell level borders and not the page as a whole.
In OpenOffice/Libre Office excel applications this can be achieved by going to Format>Page>Border and selecting options as in the image below
page border
I thank you all in advance.
I have a play framework application which I want to be able to produce a product label from. I have the label design in illustrator. It consists of a black circle, white writing with a QR code in the middle, also has curved text.
I want to create a high resolution PDF and/or image file of this design on the fly. All most all of the drawing stuff I find for java relates to swing.
Anyone done this?
The basic class which allows creating an image programatically is BufferedImage and the corresponding Graphics2D class. You are not forced to use it with Swing. You can easily convert it to common graphic formats like PNG. Then you can save it as an image file or place it in a generated(e.g. with iText) PDF.
http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html
http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html
In other words - yes, it can be done.
But if I ware you I would consider exporting the design from Illustrator to a file and use it as a resource in your application. But if you need to scale it programatically you ought to consider using SVG format to avoid loosing quality. Java does not have build-in support for vector images so you should look at
Apache Batik
I need to delete a text in several PDF files, which is always at the same position. How to achieve this with iText?
I've tried to use the PdfStamper and draw a white filled rectangle over this. This was ok, but the text wasn't really deleted and each PDF Reader (Acrobta, Foxit, etc.) were able to mark the content (ctrl+a), copy and paste it.
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
A customer requested me a software, and one of its requirements is build a form and fill it with data collected from database.
This form is currently being created in Excel. It uses cells to build the form, some cells have blank background, others blank background with black bottom border (to look like a line where text is typed), others have gray background with white text, and there's also a logo image. In Excel, some cells are merged to become bigger than other cells. They fill the text in another spreadsheet and the required cells in the form take that text and format it.
I've looked many report frameworks in Java, some are very complex and some look like Excel's graph builders, but I saw none that can make a complex 2D form like this.
Data filled in it is simple, like name, quantity, some numbers, but they have different length requiring for example that name's cell to be merged to cover a full horizontal line, and some have smaller font size. There's no repeated data that would require sorting and I have no problem gathering the data.
In the end, the filled form must also be printed, so I can't use normal Swing table or grid. It will be used in Windows now, but it'd be nice to support Linux printing too.
Any suggestion of a Java component that builds a 2D layout like this and fills it with strings will be very much appreciated. I even thought of taking a screenshot of their current form and just use 2D Graphics to print the text, but I'd not be able to print it.
This is an example of the kind of form I must build, it's somewhat like that but some areas have gray background with white text:
No, it's not a duplicate, but it is a good example of the layout.