Apache POI problem clone sheet with chart content - java

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.

Related

Moving Sheet order in Excel with apache POI; how to avoid changing formulas

Im trying to move a sheet in my excel between other sheets with Apache POI.
to accomplish that Im calling
workbook.setSheetOrder("sheetToMove", 1);
problem is in another sheet i have formulas like "=sheetToMove!A2"
if I do above call, the formula changes to "=unrelatedSheet!A2"
my current workaround involves going through all cells of the referencing sheet, storing away all the formulas + row/column information in a datastructure before changing sheet orders. after I changed the order, I go thorugh the stored formulas and put them in the correct cell. Is there a more efficient way of changing sheet order without changing the formulas?

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.

Inserting image in to the excel cell using jxl api

I have to insert image in to the excel cell using jxl api
I have tried with some sample code but it will insert at some coordinator, but I want in to at particular cell index or inside cell.
Here is sample code that I found while searching for this.
Anyone has solution for this?
From a discussion on channel9:
No version of Excel allows you to insert a picture into a cell. Pictures are inserted into the worksheet and will always float.
One of the properties of a picture can be set to "move and size with cells" but that only moves or stretches the picture when the underlying rows and columns are inserted, deleted or sized. It does not confine a picture to a cell.
Here is a step-by-step procedure on how to do it from Excel, maybe you can mime it programmatically.

How to write two hyperlink in Excel cell using 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

Categories

Resources