How to write two hyperlink in Excel cell using java - java

Is there is any way to write hyperlink in Excel cell using java.
e.g. I want to write two hyperlink in one cell.
When i click on google.com it should open google site and same for yahoo site.
www.google.com | www.yahoo.com
Thanks

It is impossible to have more than one hyperlink per XLS cell. However, that link gives a "cheat" which involves using multiple linked shapes (which I doubt POI supports).

If you are using Apache POI, you can use the setFormula [1] method of HSSFCell to write a formula
HYPERLINK("http://example.com")
[1] http://poi.apache.org/spreadsheet/formula.html

Related

How to get the tabs color in excel using java?

I searched a lot but could not get solution to it.Is there any way to get the tabs colour in excel using java.enter image description here
In the image u will find three tabs sheet1,sheet2,sheet3 in excel i want to get the color of three tabs using java.
If you are using the apache POI library.
You can use
HSSFColor.getIndexHash().get(myCell.getCellStyle().getFillBackgroundColor())
to get the color infomations of the cell.
Deatils of the apache POI getFillBackgroundColor methd
For more informations see stackoverflow topic maybe it is helpfull.

Petaho kettle Java expression to split cell and duplicate value in excel horizontally

I am using Kettle for data migration for moving data, I come across a scenario where i got a excel where the column header is merged, When i read it only the first cell gets the name others are empty, Kettle can only duplicate values vertically, I have a macro which does the exact same thing, But some one has to do it manually, Is there a java code i could run to achieve this?
What do you mean by merged? In the excel file is there one cell with all the values? Is there a separator? If it's not a great deal of columns I'd just manually add them or change them to what I want using a select step. If you'd like to upload files I'll take a look.
I think, got the solution. Here Java code is not required. Please follow the step to achieve your result.
Step1: Drag and drop Microsoft Excel Input to the canvas.And go to Content uncheck Header.
Step2: Go to !Fields tab. See the below image and fill up like below image.
Step3:Go to Additional output fields tab and then check for sheet row nr field and fill up the check box with row_number.
Step4:Finally, click on preview button. You get the result like below.
If you see the result. First three rows are unnecessary. You can filter those three rows by using Filter step this part I'am not done.

Issue during Grouping and Ungrouping using Apache POI and java

I am able to write to excel Sheet by Using Apache POI with Java.
Also, I am able to groupby Row, as mentioned in the requirement.
But, the issue which I am facing is:
I create multiple sheets in the workbook, and use "groupRow" to group data in the sheets.
And, I need to activate the 2nd sheet, by default. All, works fine, apart from the expand(+) button to "Ungroup" the "group".
Basically, when I open the excel, the 2nd sheet is selected by default and the similiar data are grouped also. But, when I click the "Ungroup" button(+), It does not work.
Note: If I navigate to some other sheet and come back to the same sheet, then the "Ungroup" button works fine.
Its due to the fact that the "Data Tab" is deactivated by default.
How do I activate the "Data Tab" by default, so that the "Ungroup" button works fine.
So, Basically, I need the "Ungroup" button to work ,without navigating to some other sheet.
Appreciate your help and Support.
If possible please share code snippet.
Below are the code Snippets:
sheetx = wb.createSheet();
sheetx.groupRow(4, 11);
sheetx.setRowGroupCollapsed(4, true);
wb.setActiveSheet(1);

Open excelfile with an preselected cell

i have an application where i read an excelfile(.xls), make some calculations and present the result. At the result is a button implemented which opens the original excelfile.
Is it possible to provide the specific cell as an arguement to show the cell directly, so that the user does not have to select the cell by himself?
The selected cell is stored within the Excel file. You have to study the API of your Excel writing library to find out, how to set this.
E.g. with POI it would be http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFSheet.html#setActiveCell(java.lang.String)
Like Holger and Moritz said in their comments, it seems that that it is not possible to startup excel with a given cell preselected.

Fill excel or pdf with java rough guide

I have got some excel sheet and want to fill fields automaticly with data. I would like to be able to somehow tag the boxes where information can be entered. So I can then use some api (itext,pdfbox?) to fill these field without having to measure the pdf with a ruler and then paint into the right spaces. And it should be changable in the future.
What are the best apis and tool to use?
Which format should I use, xls, pdf, pdf with fdf or something better?
Project can invest 0 euros into buying tools.
For modifying/creating:
Excel: Apache POI
PDF: iText

Categories

Resources