Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Copy range and paste as linked picture

 Post Reply Post Reply
Author
Bossier Edwin View Drop Down
New Member
New Member
Avatar

Joined: 15 Feb 2015
Posts: 3
Post Options Post Options   Quote Bossier Edwin Quote  Post ReplyReply Direct Link To This Post Topic: Copy range and paste as linked picture
    Posted: 12 Jan 2017 at 11:12pm
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
Back to Top
Adrian Gallero View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 1233
Post Options Post Options   Quote Adrian Gallero Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jan 2017 at 1:09am
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.

Back to Top
Bossier Edwin View Drop Down
New Member
New Member
Avatar

Joined: 15 Feb 2015
Posts: 3
Post Options Post Options   Quote Bossier Edwin Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jan 2017 at 4:48pm
Back to Top
Bossier Edwin View Drop Down
New Member
New Member
Avatar

Joined: 15 Feb 2015
Posts: 3
Post Options Post Options   Quote Bossier Edwin Quote  Post ReplyReply Direct Link To This Post Posted: 14 Jan 2017 at 4:49pm
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!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down