Creating multiple slides from excel

Hi Prabu R,


I have observed your comments and have created an issue with ID SLIDESJAVA-35290 in our issue tracking system to further investigate the possible cause of the resizing issue in case of multiple excel sheets. Our product team will investigate the possible cause of the issue since by looking at the code there is no issue observed. The possible cause may be in any of APIs, Aspose.Cells or Aspose.Slides. I will be able to share the further with you in this regard once the feedback will be shared by our product team in this regard.

Many Thanks,

Hi,

When we can expect the fix for this issue (SLIDESJAVA-35290).
Our delivery date is in next week.

Regards
Prabu R

Hi Prabu R,

I like to share that the issue has just recently been created in our issue tracking system. Also this is issue is one complex and similar like these are already added in our issue tracking system. Our product team may schedule and investigate the issue on its due turn and after that I will be able to share further feedback with you in this regard. I will really appreciate your patience till the time our product time schedule and investigate the issue and provide time line for implementation.

Many Thanks,

Hi Prabu R,

We have further investigated the issue on our end and suggest you to please try using the following sample code on your end to serve the purpose. I hope this will be helpful. Please share, if I may help you further in this regard.


Workbook workbook = new Workbook(“Multiple_page_excel.xlsx”);



// Create slide

Presentation presentation = new Presentation();

ISlide slide = presentation.getSlides().get_Item(0);


// Get chart worksheet

Worksheet sheet = workbook.getWorksheets().get(“Chart”);

workbook.getWorksheets().setActiveSheetIndex(0);

sheet.getPageSetup().setLeftMargin(0.0);

sheet.getPageSetup().setRightMargin(0.0);

sheet.getPageSetup().setTopMargin(0.0);

sheet.getPageSetup().setBottomMargin(0.0);


// Get the chart worksheet as image

ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();

imageOptions.setImageFormat(com.aspose.cells.ImageFormat.getEmf());

imageOptions.setPrintingPage(PrintingPageType.DEFAULT);

imageOptions.setOnePagePerSheet(false);

imageOptions.setOnlyArea(true);

SheetRender sheetRender = new SheetRender(sheet, imageOptions);

CellArea[] area = sheet.getPrintingPageBreaks(imageOptions);

// Add the workbook on slide

float oleX = 0f;

float oleY = 0f;

float oleHeight = (float)presentation.getSlideSize().getSize().getHeight();

float oleWidth = (float)presentation.getSlideSize().getSize().getWidth();


byte[] imageByteArray = null;

byte[] workbookByteArray = null;

ByteArrayOutputStream imageStream = new ByteArrayOutputStream();

ByteArrayOutputStream workBookStream = new ByteArrayOutputStream();

System.out.println(“Area length------>”+area.length);

for (int j = 0; j < sheetRender.getPageCount(); j++)

{

imageStream.reset();

sheetRender.toImage(j, imageStream);

imageByteArray = imageStream.toByteArray();


int oleStartRow = 0;

int oleStartColumn = 0;

int oleEndRow, oleEndColumn;

int numrows;

int numcols;


System.out.println(“Multipage”);

oleStartRow = area[j].StartRow;

oleStartColumn = area[j].StartColumn;

oleEndRow = area[j].EndRow;

oleEndColumn = area[j].EndColumn;

numrows = area[j].EndRow - oleStartRow;

numcols = area[j].EndColumn - oleStartColumn;

System.out.println("Number of rows and cols in “+j+” Page "+numrows + " " + numcols);

workbook.getWorksheets().setOleSize(oleStartRow, oleEndRow, oleStartColumn, oleEndColumn);

sheet.freezePanes(oleStartRow, oleStartColumn + 1, oleEndRow, oleEndColumn);

sheet.getPageSetup().setPrintArea(sheet.getCells().get(oleStartRow, oleStartColumn).getName() + “:” +

sheet.getCells().get(oleEndRow, oleEndColumn).getName());


// Get workbook as OLE object data

workBookStream.reset();

workbook.save(workBookStream, com.aspose.cells.SaveFormat.XLSX);

workbookByteArray = workBookStream.toByteArray();


IOleObjectFrame frame = slide.getShapes().addOleObjectFrame(oleX, oleY, oleWidth, oleHeight, “Excel.Sheet.12”, workbookByteArray);

frame.getSubstitutePictureFormat().getPicture().setImage(presentation.getImages().addImage(imageByteArray));


// Write the presentation

slide = presentation.getSlides().addEmptySlide(presentation.getLayoutSlides().getByType(SlideLayoutType.Blank));

}

presentation.getSlides().removeAt(sheetRender.getPageCount());

presentation.save(“Multiple_page_ole_new.pptx”, 3);

Many Thanks,

Hi Mudassir Fayyaz,

When we execute the above code, we are getting more slides. That’s single page has cut horizontally into two parts and the second part will create a new slide. This is the problem because of the below code:

imageOptions.setOnlyArea(true);

When we changed it into false as like imageOptions.setOnlyArea(false); we are getting the correct number of slides, but resize issue will be occur.

I have attached the input, output files and code for your reference.

Regards
Prabu R

Hi Prabu R,

I have observed the comments shared by you and like to share that I have linked the shared information in our issue tracking system for further investigation and resolution and will share the feedback with you as soon as it will be shared by our product team after investigation.

Many Thanks,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.