If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How to insert picture in Excel sheet using .asp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-14-04, 13:39
vsshah vsshah is offline
Registered User
 
Join Date: Oct 2002
Posts: 48
How to insert picture in Excel sheet using .asp

I am running .asp application, and writing employee data to excel sheet. I am able to do that, but I want to put Employee signature in excel sheet also. e.g. 100 Employees are there. I am able to capture 100 employees data in recordset in asp And able to push each row/column value in excel sheet also. But, not able to put binary signature(which is one column 'EmployeeSignature' of my table 'Employee_M') in to Excel sheet.

I want to copy signature in to Excel sheet using binary file of my recordset OR directly, I want to pickup .jpg file from operating system and want to insert into Excel sheet. All this I want to do using .asp.

Will you please help me ??

Thanks,
Reply With Quote
  #2 (permalink)  
Old 02-06-04, 04:18
j060204 j060204 is offline
Registered User
 
Join Date: Feb 2004
Posts: 1
Exporting Picture to Excel Sheet

Please check this code. I think this will work.

1. Place an image control on your form(Suppose Image1).
2.set the image url to the image path.
eg.Image1.ImageUrl=strGraphPath;
3. Use the following code

Response.ContentType ="image/pjpeg";
Response.AddHeader("Content-Disposition","attachment;filename=ExportExcel.xls" );
Response.Write(Image1);
Reply With Quote
  #3 (permalink)  
Old 02-06-04, 18:56
vsshah vsshah is offline
Registered User
 
Join Date: Oct 2002
Posts: 48
Thanks, I got solution by the way.

Dear Respondent,

I used following code of VBScript in .asp, and it is working fine. I opened Excel workbook, and then inserting picture and then setting its position in shell, and then setting height of picture also.

Thanks, please see below code.

Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Application.Visible = True

' Close all pending books
ExcelApp.Workbooks.Close

'Open the template
Set ExcelBook = ExcelApp.Workbooks.Open("\\DB_Server\DB\ExcelTemp\ TE_Template.XLS", , True)

lsFullFileName = "\\DB_Server\DB\ExcelTemp\TE_Template2.XLS"



If Not Isnull(Sponsor) then
str = "Select EmpFirstName+' '+EmpLastName as EmpName, left(EmpFirstName,1)+EmpLastName as Filename from employee_M Where EmpId = " & Sponsor
Rs.open str , conn
FileName = rs("FileName") & ".bmp"
Set mypic = ExcelBook.Worksheets(1).Pictures.Insert("\\db_serv er\db\exceltemp\dbs\" & FileName)
mypic.height = 18
mypic.Top = ExcelBook.Worksheets(1).Range("F7").Top
mypic.Left = ExcelBook.Worksheets(1).Range("F7").Left
ExcelBook.Worksheets(1).Cells(6, 5).Value = rs("EmpName")
Rs.close
End if


ExcelBook.SaveAs lsFullFileName

ExcelApp.WorkBooks.Close
ExcelApp.Application.Quit
Set ExcelApp = Nothing

Last edited by vsshah; 02-06-04 at 18:58.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On