Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002

    Unanswered: 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 ??


  2. #2
    Join Date
    Feb 2004

    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.
    3. Use the following code

    Response.ContentType ="image/pjpeg";
    Response.AddHeader("Content-Disposition","attachment;filename=ExportExcel.xls" );

  3. #3
    Join Date
    Oct 2002

    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

    '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 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")
    End if

    ExcelBook.SaveAs lsFullFileName

    Set ExcelApp = Nothing
    Last edited by vsshah; 02-06-04 at 19:58.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts