Dear Team,
We are trying to create the presentation from excel.
Case 1: When we have single page excel, we are getting the PPT in single slide - No issue.
Case 2: When we have multiple pages in excel, we are getting only one slide. Some of the rows are missing in the slide - Issue
My
requirement is to create number of slides equals to number of pages in
excel based on the page break or anything. Is it possible to solve this
using Aspose technology(Java)?
If the answer for the above question is, YES. Then my next requirement is getting the PPT with OLE.
Similarly, I’m able to create the presentation with OLE. When we have multiple pages, how can I achive the PPT with OLE.
Herewith I have attached the code which I have used to convert the excel into Presentation slide.
Thanks
Prabu R
Hi Prabu R,
I have observed your requirement of adding excel sheets as Ole frame inside presentation. I like to share that each Ole frame displays the selected excel worksheet area in slide. If your excel file has multiple sheets and you ought to display every sheet on a single slide then you need to add multiple Ole frames and you may have them on one slide or multiple slides. It depends on your representation. You need to use Aspose.Cells in conjunction with Aspose.Slides in order to set the desired excel sheet or even its desired area as ole frame on slide. I suggest you to please visit documentation link1 and documentation link 2 for your kind reference in this regard. In second link, you will find a sample code for selecting the desired worksheet and its area for display in Ole frame.
Many Thanks,
Dear Mudassir Fayyaz,
While trying the execute the documentation link2 which is shared by you, we are getting the error in the “workbookDesigner.setWorkbook(workbook);” line.
Error details:
Multiple markers at this line
- Syntax error on token “workbook”, VariableDeclaratorId expected after
this token - Syntax error on token(s), misplaced construct(s)
Could you please help us to resolve this issue.
Regards
Prabu R
FYI.
We are using Aspose.cells.8.7.0 and Aspose.Slides.15.7.0
Regards
Prabu R
Hi Prabu R,
Hi Fayyaz,
Eventhough removing the WorkbookDesigner class, we are getting the error in the subsequent lines. Could you please share executable code with us. I have imported the neccessary jar files.
Ex:
//Setting Ole frame according to Row, Columns
AddOleFrame(slide, 0, 15, 0, 3, 0, 300, 1100, 0, 0, presentation, workbookDesigner, true, 0, 0);
Error details:
Multiple markers at this line
- slide cannot be resolved to a type
- Syntax error on tokens, delete
these tokens
- Return type for the method is
missing
- Syntax error on tokens, delete
these tokens
presentation.save(“AsposeTest_Ole.pptx”, SaveFormat.Pptx);
Error Details:
Multiple markers at this line
- Syntax error on token “.”, …
expected
- Syntax error on tokens, delete
these tokens
Regards
Prabu R
Hi Prabu R,
public static void testOleFrameadd() throws Exception{//Loading presentation with Ole framePresentation pres=new Presentation (“d:\Aspose Data\OleEmbed.pptx”);Presentation pres=new Presentation ();//Accessing slide with Ole frameISlide slide = pres.getSlides().get_Item(0);//Reading object data in Workbookcom.aspose.cells.Workbook Wb;Wb = new com.aspose.cells.Workbook(“C:\Presentations\Test.xlsx”);//Setting active sheetWb.getWorksheets().setActiveSheetIndex(0);//Saving worbook to stream and copying in byte arrayByteArrayOutputStream mstream = new ByteArrayOutputStream ();Wb.save(mstream,com.aspose.cells.SaveFormat.XLSX);//Add an Ole Object Frame shapeIOleObjectFrame oof = slide.getShapes().addOleObjectFrame((float)0,(float) 0, (float)pres.getSlideSize().getSize().getWidth(),(float) pres.getSlideSize().getSize().getHeight (), “Excel.Sheet.12”, mstream.toByteArray());pres.save(“C:\Presentations\OleEmbed.pptx”, SaveFormat.Pptx);}
Dear Fayyaz,
When we are using single page excel, it’s working fine. But when we are having more than one page excel sheet we can’t have whole content in presentation that whatever we are having in Excel. Hereby I have attached the code, excel sheet and converted pdf also for your reference. I need output like in the attached PDF.
Regards
Prabu R
Dear Fayyaz,
Any update on this.
Regards
Prabu R
Hi Prabu R,
Wb.getWorksheets().get(0).getPageSetup().setPrintArea(“A1:H10”);
Dear Fayyaz,
Thank you for your reply. I have already converted the excel sheet into images based on number of pages. Then I have created the number of slides and insert the images. While inserting the images ,the first image only inserting into the picture frame. Could you please refer the attached documents.
Regards
Prabu R
Hi Prabu R,
Hi Fayyaz,
Thanks for your response and it’s working fine.
Now I am trying to implement the OLE for multiple pages in excel. While doing the same, I am giving the ole size as particular row and column. But the resulted PPTX doesn’t the expected one.
Could you please provide the solution for this. Hereby I have attached code for your reference.
Regards
Prabu R
Hi Prabu R,
Hi Fayyaz,
I am not pointing that frame resize issue. I have already aware of that 35041 ticket.
We are not able to create the expected rows and columns slides as shown in the attached file. This is our issue.
The exact issue is that the single page has cut down horizontally and open in new slide. For example, in the attached file, the presention has only five columns in first slide and remaining two columns are in eighth slide. Could you please see the files.
Regards
Prabu R
Hi Prabu R,
I have worked with the sample code shared by you and have saved the images from excel sheets that are you adding as Ole frame image. The images are identical and Aspose.Slides is simply setting the provided image as Ole frame Image. For your kind reference, I have attached the generated images of excel sheet from your code along with generated presentation. You will find them identical. You need to look in to your code where you are working with worksheet to get desired image. Please share, if I may help you further in this regard.
Many Thanks,
Hi Fayyaz,
Thank you for your response. It’s working fine.
My new issue is resizing issue.
When we are having single page and implementing ole, the resizing issue is not occur. We are using EMF image format.
When we are having multiple pages and implementing ole for multiple pages, we are facing the resize issue. Here we are getting the number of rows and columns using the ChartArea[] and use that rows and columns as ole size.
My assumption is “imageOptions.setOnlyArea(true);” will be the problematic code.
Could you please provide the solution for this issue.
Note: We have already faced the resize issue, when we have used the Png image format and set the resolution. Then we have forced to change the image format as .emf to fix that issue by the aspose team. Now the issue has solved, but the image quality is very low.
Regards
Prabu R
Hi Prabu R,
Hi Prabu R,
Hi Fayyaz,
We are using the Aspose.cells only for converting images. After that we are putting that images in the slides using Aspose.slides jar. When we double click the image, the ole window is opening perfectly. When we close that ole frame the ole size has changed. This is the case when we are having multiple pages like that I have shared the document previously.
But when we are using the single page it’s working fine. (The similar kind of issue was there in single page when we were using .png format and setResolution () methods. It will be solved when we changed the image format into .emf )
Could you please execute the code from your side then only you get better idea about the issue.
The similar kind of issue already raised and logged the ticket from Aspose slides. So that I am believing that the issue from your side. Anyway I ll enquire in the Aspose.cells also.
Regards
Prabu R