Copy range and paste as linked picture

Dear Flexcellers, is is possible to select a range of cells and paste it in a merged cell as a linked picture? Or can I make an image from a range?
Many thanks!
Peter

Hi,
You could use RenderCells to make an image from a range, then use AddImage to add the image in the merged cell. Some code like this:


            var img = xls.RenderCells(1, 1, 10, 10, true);
            xls.AddImage(img, new TImageProperties(new TClientAnchor(TFlxAnchorType.MoveAndDontResize, 11, 0, 1, 0, 21, 0, 10, 0), ""));



But this won't be linked to the original range: It will be an image of the file as it was when you took the photo: If you later change the range the image won't update.

If what you want is a picture that is linked, that is that changes when you change the values on the range, you can use Excel's "Camera Objects" which while not really documented in Excel, we support.

To enter a "camera object" in Excel, you insert a normal image, then with the image selected, you write the range you want to show inside the image in the formula bar:



So for example in the image above I wrote the range A1:C10 in the formula of the image, and then you can see that range inside the image.
If you change any cell value in the range, the image will update in real time. FlexCel will also calculate the current camera value when exporting to pdf or html.

This is how to create a camera object from Excel. FlexCel currently doesn't have a method to create a camera object because it is something you normally create in Excel and then use from FlexCel, but if you think you would benefit from having an AddCameraObject method let me know: It should be simple to add.

Dear Adrian, many thanks, I learned a lot. The RenderCells works perfectly and I can continue with my report. But the AddCameraObject would be very nice indeed! Thanks!