Export to XLSX where the page should also contain header - java

I am using Grails and I am exporting a list of data to the excel sheet.Simple export of table is done, but I need header in that page which consists of a company's logo and the report's title. and the sheet must be saved according to the status of the data which should be in 5 sheets..Also page width must be 11in...
Requirement
5 Sheets:Open,....,closed
Header:
Left side: Logo,
Right side:Report title
So can anyone suggest how to do this!!

Have you tried [header.enabled:true] as one of the formatters?

Related

iTextPDF 7 - Table of content with clickable page numbers

I'm trying to create a table of content with iTextPDF 7 in Java from existing PDFs.
I've tried to use Link link = new Link() and PdfAction.createGoTo(PdfExplicitDestination.createFit(pageNum)) but to no avail.
I can't link the page number/row in TOC to the respective page in the end PDF (after merging).
The documentation on their website only gets me so far and I'm out of ideas.
What is the correct way to create a TOC for existing PDFs and how to implement it correctly?

How to set hidden element/text/id in background for visible text in pdf document

I am giving internal link in pdf document using pdfbox library. For that I am comparing the string and get the co-ordinates of string from pdf document and add link on string. This is working fine and here is the link.
Now, I have two same string and I want to redirect to two different pages like following
Link 1 -> redirects to Page 3
Link 1 -> redirects to Page 5
Is there any way that while creating pdf I add some hidden element/text/id in Link 1 in background from which I can identify on which page I should redirect.

Setting footer in first page of a pdf file using dynamic reports

I am using java 8 and dynamic reports 6.0.0. I am generating a pdf file. I have to set the footer only in the first page.
There is a default method for setting the footer only in last page named lastPageFooter().
Code for adding footer in last page :
JasperReportBuilder report = new JasperReportBuilder();
report.lastPageFooter(cmp.text("footer text"));
Similarly I want to apply footer only for the first page. Please let me know how it can be one. Thanks in advance.

POI enable different header/footer for the first page in word docx file

I'm generating a docx file using Apache POI 3.13 and I stuck with headers/footers for first page.
I create XMPFParagraph[] without any problem. Next I create headers and footers like this (I've tried in different oreder):
policy.createHeader(XWPFHeaderFooterPolicy.DEFAULT, defaultHeader);
policy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, defaultFooter);
policy.createHeader(XWPFHeaderFooterPolicy.FIRST, firstHeader);
policy.createFooter(XWPFHeaderFooterPolicy.FIRST, firstFooter);
Once I generate my docx file I could see my default header/footer on every page including first one. But if I select to use different header/footer for the first page - my first header and footer apperes correctly.
How could I make this happens automaticaly via code? And is there any appropriate documentation with examples about POI?
If you want to set a first page header in a section, you must enter a title page tag in section properties tag (w:sectPr). The title page tag can be empty, but it is necessary. In your case, you can add only 2 code lines:
CTSectPr sect = document.getDocument().getBody().getSectPr();
sect.addNewTitlePg();
`Best regards!

iText PdfPTables, document.add with writeSelectedRows

I am currently modifying an existing system that generates reports with iText and java. The report template is as follows:
Header1(PdfPTable)
Header2(PdfPTable)
Body(PdfPTable)
I am currently using the writeSelectedRows to display Header1 and Header2, but document.add is used to display the Body. The problem is that the system is setup to write the headers AFTER the body has already been displayed on the screen, so I am displaying my headers on top of my body content. My question is how do I add my body table (using document.add) and have it display about halfway down the page (or any predetermined vertical position)? This way I would have sufficient room to display my headers above the body table.
Note: I believe the body table is using document.add to facilitate automatic paging if the body content is too large.
Write your header tables to an absolute position at top of the document, so y position would be:
y = PageHeight - TableHeight;
Then add your body tables using document.add
here is an example i googled, Image in the Page Header Generated by iTextSharp?

Categories

Resources