Export Multiple range as Image from excel to PowerPoint Slide

Hi Experts,

I am new in ASPOSE object and functionalities. Can
you please share me the instruction to export range as image to
PowerPoint Slide.

1. Single range say "H5:M:50 from a sheet XYZ.
2. Multiple range say “A2:D10”, “H1:J40”, “A50:J60” from sheet PQR


Regards,
Santosh

Hi,


Please see your other thread for reply here:
https://forum.aspose.com/t/22637

Thank you.

Hi Amjad,

Thanks for your time.

Yes there is a reply, but not complete, that not solves my queries. So I put my question under Aspose.Total group.

If you have concrete answer please help me.

Regards.
Santosh

Hi,


Well, your query has two parts:
1) Export range of cells/worksheet to image file via Aspose.Cells APIs.
2) Add the output image to a powerpoint slide via Aspose.Slides APIs.

1) Export a Range or Ranges to Image file(s). Please see the following sample code for your reference:



e.g
Sample code:

string filePath = “e:\test2\Book1.xlsx”;

// Create workbook from source file.



Workbook workbook = new Workbook(filePath);

// Access the first worksheet
Worksheet worksheet = workbook.Worksheets["Your_Sheet"];
// Set the print area with your desired single range
worksheet.PageSetup.PrintArea = "H5:M50";
//Or if you want multiple ranges from some other sheet
//worksheet.PageSetup.PrintArea = "A2:D10, H1:J40, A50:J60";

// Set all margins as 0 (if you want)

worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.ImageFormat = ImageFormat.Jpeg;
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
string dataDir = "e:\\test2\\output.out.jpg";
sr.ToImage(0, dataDir);

2) See the document/sections for your reference on how to add pictures to the slides:
Adding and Formatting Shapes
http://www.aspose.com/docs/display/slidesnet/Shape+Manipulations#ShapeManipulations-PictureFrameFormatting

Hope, this helps a bit.

Thank you.