Worksheets.SetOleSize in Java version

The method exists in .NET version. Does it also exist in JAVA version of Aspose.Cells? If yes, what is the version number and if not, can you implement this?

See this thread for more info.

Hi,

Thank you for considering Aspose.

Well, currently this method is not supported in Aspose.Cells for Java. We will look in to it and see if we can support it soon.

Thank You & Best Regards,

Hi,
Please try the attached version (2.0.0.14). We have introduced a new API for your requirement:
Workbook.setOleSize(int startRow, int endRow, int startColumn, int endColumn)
Thank you.

The issues you have found earlier (filed as 7343) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Laurence.

Hi Laurence,

I want to set the Worksheets.SetOleSize before exporting this Excel to PPT.

The think is , how can i get the EndRow and End Column of the Excel Sheet dynamically

using Aspose Cells to set the OleSize.

Regards

Janakiraman

Hi,

Thank you for considering Aspose.

Well, you can use the following APIs to get the maximum index of row and column as per your requirement,

// Maximum column index of cell which contains data.

int maxDataColumn = workbook.getWorksheets().getSheet(0).getCells().getMaxDataColumn();

// Maximum row index of cell which contains data.

int maxDataRow = workbook.getWorksheets().getSheet(0).getCells().getMaxDataRow();

//Maximum Column index of cell which contains data or any formatting

int maxColumn = workbook.getWorksheets().getSheet(0).getCells().getMaxColumn();

//Maximum row index of cell which contains data or any formatting

int maxRow = workbook.getWorksheets().getSheet(0).getCells().getMaxRow();

Thank You & Best Regards,

Hi Aslam,

Thanks for your response.

I have tried with the above code but am not getting the exact maxDataColumn and maxColumn

correctly.I have attached sample file for your reference.

Regards

Janakiraman

Hi,

Thank you for considering Aspose.

Well, as your template file contains shapes (Charts), that’s why maxColumn is not returning the exact value as it does not consider the shapes. It only considers the data and formatting. For your requirement, you have to write your custom code to get the max row and max column of the shapes. You can loop through all the shapes and get the max row and column of the shape by using the following APIs, Shape.getLowerRightColumn() and Shape.getLowerRightRow().

We will also look into the feasibility of this feature and let you know if we can implement it.

Thank You & Best Regards,

Hi,

Please see the following sample code, which will help you get the maxRow and maxColumn as per your requirement,

Shapes shapes = sheet.getShapes();

int maxRow = -1;

int maxCol = -1;

int pos;

for (int i=shapes.size()-1; i>-1; i–)

{

Shape shape = shapes.get(i);

if (shape.getGroup() != null )

{

continue ;

}

pos = shape.getLowerRightRow();

if (pos > maxRow)

{

maxRow = pos;

}

pos = shape.getLowerRightColumn();

if (pos > maxCol)

{

maxCol = pos;

}

}

Cells cells = sheet.getCells();

pos = cells.getMaxDataRow();

if (pos > maxRow)

{

maxRow = pos;

}

pos = cells.getMaxDataColumn();

if (pos > maxCol)

{

maxCol = pos;

}

System.out .println("row: " + maxRow + "; col: " + maxCol);

Thank You & Best Regards,

Hi ,

I used the above code , it works fine .

After setting the Ole size using max row and col

workbook.setOleSize(1, maxRow, 1,maxCol)

am saving to a new xls file.But am facing the problem there.

workbook.save("output.xls")

When i open that xls file the Upper Left rows and Columns are hidded.

I want the Whole data and Charts in that Excel in a single view , so that i can add the

Excel object PPT Slide.

Image file is attached for your reference.

If you more information please let me know.

Regards

Janakiraman
Hi,
Thank you for considering Aspose.
Please setOleSize as workbook.setOleSize(0, maxRow, 0, maxCol),because the row/column index is 0 based.

Thank You & Best Regards,

Hi,

Thanks for your reply.

As mention i changed workbook.setOleSize(0, maxRow, 0, maxCol).

After setting it am creatint the new Xls file from it and setting that Excel object in

PPT slides using below code.

OleObjectFrame oof = slide1.getShapes().addOleObjectFrame(0, 0,

(int) pres.getSlideSize().getX(),

(int) pres.getSlideSize().getY(), "Excel.Sheet.8", b);

When i open this file the whole sheet data is not coming under single slide.

Ouput PPT file and CScreenshot is placed for your reference.

Regards

Janakiraman

Hi Aslam,

I am waiting for your response , regarding this issue.

Please let me know if you need more information.

Regards

Janakiraman

Hi,

Thank you for considering Aspose.

We are in coordination with Aspose.Slides team regarding this issue. As soon as we get some response from them, we will update you in this regard.

Thank you for understanding,

Hi Aslam ,

Thanks a lot for your response.

Hi am facing another issue too.

While changing the resolution of the system , the position of the object in PPT getting changed.

Please take the resoultion problem also in consideration.

Regards

Janakiraman

Hi,

Thank you for considering Aspose.

We will look into this issue as well and will get back to you soon.

Thank You & Best Regards,

Hi Aslam,

Is there any updates on Issue ID 172680 , 173092 in the same post.

I'm waiting for your response.

Regards

Janakiraman

Hello,

We are looking into these issues and update you after further investigation.

Hello,

I finally found the solution. You should decrease the width of the inserted OLE Object compared to its height.

Check the attached file, if you double click it, you will see, your sheet now fits inside the slide. Screenshot is also attached.

This is the code example.

int xPos = 1000 / 2;

int yPos = 0;

int width = pres.getSlideSize().getWidth() - 1000;

int height = pres.getSlideSize().getHeight();

sld.getShapes().addOleObjectFrame(xPos, yPos, width, height, "Excel.Sheet.8", array);

Hi msfaiz ,

Thanks for your reply.

This is the output we are expecting , but there is no getWidth() and getHeight () method in Java Version

int width = pres.getSlideSize().getWidth() - 1000;

int height = pres.getSlideSize().getHeight();

If there is any hot fixed version for aspose slides ,

please let us know the path to download.

Regards

Janakiraman