Copy Range of Cells to Clipboard

Hi, I’m using VB.net. How can I copy the printable area or a range of cells in Cells (includes charts and such)? I need to copy them into the clipboard and paste them into a Words page as Enhanced Metafile. Thanks.

Hi,

Thanks for your inquiry.

Well, I think you may use Aspose.Cells API i.e.., Worksheet.SheetToImage() method to take the image of your desired range of cells and then paste this image file into Word page using Aspose.Words APIs.

Sample code:

Dim book As Workbook = New Workbook()
'Open your template file
book.Open("f:\test\testBook.xls")
'Get the first worksheet.
Dim mysheet As Worksheet = book.Worksheets(0)
'Specify the printable range of cells in the sheet.
mysheet.PageSetup.PrintArea = "A1:N31"
mysheet.SheetToImage("f:\test\myimage.emf", System.Drawing.Imaging.ImageFormat.Emf)
............

For reference, please check the documentation topic: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/converting-worksheet-to-image.html

Thank you.

Thanks for the quick answer. However, it does not copy the charts in the printable area. I uploaded an example of an existing Excel file that I’m trying to work with in Cells.

Hi,

Which version of Aspose.Cells for .NET you are using? Kindly try the attached version i.e.., latest fix (4.5.1.4).

Thank you.

I've installed version 4.5.1.4 and it does produce a picture, however, it has changed the charts. The color/pattern no longer matches the legend and the descriptions are jumbled/inside the chart. Try it with the attached Excel Sheet. Any Ideas?

Thanks for all your help.

Hi,

Thanks for providing us the template file.

Yes, we noticed some pattern (color) issues along with the data labels are placed inside the pie slices in the generated sheetimage.

We will figure it out soon.

Thank you.

Hi,

Please try the attached fix.

3D Pie chart do not support out side now. we will look into it.