2

I am exporting excel sheets through SSIS export, and creating excel sheet at run time using execute sql task. Now the client needs a logo(image) to be attached to the excel sheet on top of data part. Do we have any way out to do that.

NB: we cannot use "file system task" to copy a pre-existing excel file as we have to create the task on runtime. cannot copy a excel sheet from any other location.

Thanks

asked Jan 11, 2018 at 16:20
2
  • You can use a script task in ssis and write a VBA code to insert the logo to the cell. Commented Jan 11, 2018 at 16:42
  • @aman6496 i provided a c# script task code, you ignored my answer and asked the same question again!! Commented Jan 15, 2018 at 21:24

1 Answer 1

1

You can use a script task to achieve that, you can benefit from the Microsoft.Interop.Excel library to achieve that, you can copy the image from a file using the following code:

Image ExcelImage = Image.FromFile(strFilePath);
System.Windows.Forms.Clipboard.SetDataObject(ExcelImage ,true);

And paste it to excel sheet using the following code:

Excel.Worksheet ThisSheet = (Excel.Worksheet)ThisWorkBook.Sheets[1];
Excel.Range oRange = (Excel.Range)ThisSheet.Cells[10,1];
ThisSheet.Paste(oRange,ExcelImage);

Detailed code provided in the following link:

answered Jan 13, 2018 at 21:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.