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)