We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Embedded Excel Image issue in PPT

Hi! Aspose team,
I have the requirement where I want to add embedded Excel OLE object in PPT.
When I am creating the image with aspose cells classes I am getting the number in ###### in the image for the number columns, if it is exceeding more than 9 digits.
How we can manage this scenario in aspose image. Could you please help me this?
I have attached the sample code, Could you help me sample code of aspose image
//Create a workbook
Workbook workbook = new Workbook(“Example.xlsx”);

//set visible rows and columns count
int chartRows = 25;
int chartCols = 11;
Worksheet dataSheet =workbook.getWorksheets().get(0);

//Set chart print area
dataSheet.getPageSetup().setPrintArea(dataSheet.getCells().get(0, 0).getName() + “:” +
dataSheet.getCells().get(chartRows + 1, chartCols).getName());
//Set chart ole size
workbook.getWorksheets().setOleSize(0, chartRows, 0, chartCols);

// Get the chart worksheet as an image
ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
imageOptions.setImageType(ImageType.EMF);
imageOptions.setOnlyArea(true);
imageOptions.setOnePagePerSheet(true);
SheetRender sheetRender = new SheetRender(dataSheet, imageOptions);
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
sheetRender.toImage(0, imageStream);
byte[] imageByteArray = imageStream.toByteArray();

//Save the workbook to stream
ByteArrayOutputStream bout=new ByteArrayOutputStream();
workbook.save(bout, com.aspose.cells.SaveFormat.XLSX);

//Create a presentation
Presentation pres = new Presentation();
ISlide sld = pres.getSlides().get_Item(0);

//Add the workbook to the slide
IOleEmbeddedDataInfo dataInfo = new OleEmbeddedDataInfo(bout.toByteArray(), “xlsx”);
IOleObjectFrame oof = sld.getShapes().addOleObjectFrame(1f, 1f,
(float)pres.getSlideSize().getSize().getWidth()-2,
(float)pres.getSlideSize().getSize().getHeight()-2, dataInfo);
oof.getSubstitutePictureFormat().getPicture().setImage(pres.getImages().addImage(imageByteArray));

//Write the presentation to disk
pres.save(“Example-out.pptx”, com.aspose.slides.SaveFormat.Pptx);

Example.zip (10.6 KB)

@Rohan_Wankar, please ask this question in related product forum Aspose.Cells https://forum.aspose.com/c/cells/9 Thanks.

Hi! @samer.el-khatib4aspose
I want to create image for worksheet using aspose image,
Could you help me on this with sample code?
thanks!

@Rohan_Wankar, Aspose.Imaging can be used to create images example can be found here https://docs.aspose.com/imaging/net/creating-opening-and-saving-images/ But related to usage Aspose.Imaging with Cells its better to ask related product on related forum as they may support such behaviour and use Aspose.Imaging for such interactions but we do not support Aspose.Cells in Aspose.Imaging.

Hi! @samer.el-khatib4aspose
I am creating image with aspose cells API in my snippet code.
I want to create the image with aspose image after aspose cells image creation.
Can you help me with some snippet code for the same?
thanks!

@Rohan_Wankar, you can use example from docs https://docs.aspose.com/imaging/net/creating-opening-and-saving-images/#creating-by-setting-path to create image using Aspose.Imaging.