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);
Related
I really have success updating cells that are linked with chart, the the graph changes well.
Tested on 4.4.0 and 4.4.1 versions.
But when I used the cloneSheet method in order to copy an existing sheet into new one, I get the error when I open it on Excel Office 365, and the charts disappear.
// only this is enough to get the erro.
workbook.cloneSheet(0, newName);
Well I'm certain that are open, and close the workbooks and sheet in correctly way.
If I do not clone, only update an existing sheet no errors and all work good.
I'm using XSSF workboooks, and do not tested with HFFS.
After protected the sheet.
sheet.protectSheet("");
Not able to enable sorting.
The new version of POI. Not have an argument to enable the sortingin a protected sheet. It has only to disable sorting.
sheet.lockSort();
I tried this also.
CTSheetProtection sheetProtection = excelSheet.getCTWorksheet().getSheetProtection();
sheetProtection.setSort(false);
But this function enables the sorting button in excel sheet. But after I click the A-Z or Z-A I am getting the pop-up. Because of the sheet protection.
I am using this <version>3.10.1</version>.
I am using a protection method for the user do not edit some column in sheet.
But I need sorting in a protected sheet.
One more question also.
Is this possible to lock the first row of excel. Because do not sort the title row.
But I used
sheet.createFreezePane(0, 1);
This will freeze from scrolling, not from the sorting. Please help with these two questions.
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.
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.
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