We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Insert images based on excel co-ordinates

Thread ID:

Created:

Updated:

Platform:

Replies:

98173 Feb 10,2011 09:58 PM UTC Sep 27,2016 01:12 PM UTC ASP.NET Web Forms (Classic) 6
loading
Tags: XlsIO
Ram Thatikonda
Asked On February 10, 2011 09:58 PM UTC

Syncfusion-Team,

I have a requirement to create an excel file with tabular data at the top and images at the bottom.

The tabular data has around 20 columns.

I would like to drop images at the end of the tabular data just like someone doing it manually by going into "Insert  Picture  From File" menu. I want the images to sit next each other horizontally and may be 10 images per line.

“AddPicture” method allow to add images. My images don’t fit and size with cell.

How do I find where to insert the next picture based on the width and height of the previous image?

Is there a way to determine the co-ordinates (x, y) for a cell?

Is there a way to insert images based on excel co-ordinates?

I would appreciate help from Syncfusion and some samples to do the same?

Thanks!


Sridhar [Syncfusion]
Replied On February 11, 2011 05:56 AM UTC

Hi Ram,

Thank you for using Syncfusion products.

The insertion of image in XlsIO is based on the Row and Column indexes. The AddPicture()method insert the image at the particular row and column with the specidfie width and height.

The following codesnippet shows to insert an image

C#:
sheet.Pictures.AddPicture(21, 3, @"XlsIO.gif", 22, 33);

The syntax is follows:
Addpicture(TopRow,LeftColumn,"FileName",ScaleWidth,ScaleHeight)

By default with MSExcel,WE are not able to fit the image with the cell.We can manually contol by modifying the height and width of the image to fit within a cell.

Please let us know if you have any clarifications.

Thanks,
Sridhar.S


Ram Thatikonda
Replied On February 11, 2011 01:59 PM UTC

Hi Sridhar,

Thank you for your prompt response.

I think my questions are still not answered.

1) Is there a way or an API to find the co-oridinates (x, y) given the row and column index?

2) Is there a way or an API to insert images given the (x, y) co-ordinates?

I would appreciated your response!

Thanks


Sridhar [Syncfusion]
Replied On February 14, 2011 11:31 AM UTC

Hi Ram,

Thanks for the update.

Currently XlsIo does not support to find the X and Y co-ordinates from the given row and column indexes .
We are preparing the workaround for you on the same.
We willget back to you with the workaround in two business days(ie., 16th February 2011).We regret for the inconvenience.

Please let us know if you have any queries.

Thanks,
Sridhar.S


Sridhar [Syncfusion]
Replied On February 16, 2011 01:29 PM UTC

Hi Ram,

We highly regret for the inconvenience.

we will get back to you with the code snippet , once we got from the development team.

Please let us know if you have any queries.

Thanks,
Sridhar.S


jlavos
Replied On September 26, 2016 01:59 PM UTC

Hi, I'm having a similar issue.

I'm adding images dynamically to the spreadsheet but they overalap as all are being placed in row 0, column 0.

I would like to add each image below the previous one.

Is there a way to know the last row that the previous image is over?

If not, is there another way to do this?

Abirami Varadharajan [Syncfusion]
Replied On September 27, 2016 01:12 PM UTC

Hi Joaquim, 
 
Thank you for contacting syncfusion support. 
 
We request to typecast adding the image to worksheet as bitmapshapeImpl  to get the image coordinates and to insert the another image based on the previous image's bottom position. Kindly refer below code to insert the image one below another using bitmapshapeImpl  to find the coordinates of previously inserted image. 
 
Code Example: 
  
  
            //Inserting first image 
            Image firstImage = Image.FromFile("image1.jpg");            
            BitmapShapeImpl bitmap =  worksheet.Pictures.AddPicture(1, 1, firstImage) as BitmapShapeImpl; 
            //Getting the bottom row and right column 
            int row = bitmap.BottomRow; 
            int column = bitmap.RightColumn; 
            //Inserting the second image after first image 
            Image secondImage = Image.FromFile("image2.jpg"); 
            worksheet.Pictures.AddPicture(row, 1, secondImage); 
  
You can also insert the image one below the another row using template marker. 
 
Kindly refer below documentation to know more about template marker. 
 
 
We have also prepared sample to insert images with above mentioned scenarios and shared it for your reference. The sample can be downloaded from following location. 
 
 
Kindly refer and let us know if this helps. 
 
Regards, 
Abirami. 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;