473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

embedding a attachment using vb.net

Hi,

I'm providing a link button in my page(which contains a datagrid) so that when the user clicks on it they will be able to see the contents of the datagrid in a separate excel file.I provide the user with the option of attaching documents while they use my application.I would want that particular attachment to be embedded into excel document along with other contents.Is there a way to do this?

Note:I don't want to specify the link(location) where the attachment is present.Instead I would need the attached document itself to be embedded into the excel file.
Apr 15 '09 #1
3 1613
iam_clint
1,208 Expert 1GB
@niklesh
I really don't get what you are trying to accomplish

So you have a datagrid exporting to excel.. what documents are going to be attached? where will they go? You say embedded into the excel document so I assume its a table/grid type layout attachment?
Apr 16 '09 #2
I have a excel file created,whose contents are generated by exporting contents from a datagrid, when the user clicks on a link provided.I want to append a document present in my server into the excel file created.
Apr 17 '09 #3
aryanbs
42
Sample code below, please add reference to Microsoft.Office.Interop.Excel

Imports Microsoft.Office.Interop


Expand|Select|Wrap|Line Numbers
  1.   Dim MyExcel As New Excel.Application
  2.         Dim wb As Excel.Workbook
  3.         wb = MyExcel.Workbooks.Open("c:\backup\text.xls")
  4.         Dim oleobjs = CType(wb.ActiveSheet.OleObjects, Excel.OLEObjects)
  5.         oleobjs.Add(Link:=False, Filename:="c:\backup\test.doc")
  6.  
  7.         wb.Close(True)
  8.         MyExcel.Quit()
  9.         Try
  10.             System.Runtime.InteropServices.Marshal.ReleaseComObject(source)
  11.             System.Runtime.InteropServices.Marshal.ReleaseComObject(wb)
  12.             System.Runtime.InteropServices.Marshal.ReleaseComObject(MyExcel)
  13.             GC.Collect()
  14.             GC.WaitForPendingFinalizers()
  15.  
  16.         Catch ex As Exception
  17.             MyExcel = Nothing
  18.             wb = Nothing
  19.         End Try
Apr 18 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
3
by: Tim T | last post by:
Hi, I hope there is someone reading this that has the answer, Please Help! I have the need to send a html email via asp.net. its easy enough to send an html email and add attachments. My...
0
by: hq4000 | last post by:
Given AStyleSheet.xsl : <AStyleSheet> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mytest.mytest2.mytest3.com" version="1.0"> <xsl:output method="xml"...
1
by: theWizard1 | last post by:
The following sends my email, but the attachment is empty. The attachment should contain the data that is in the string that was created from the xmlReader. I have a stored procedure written...
6
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python...
3
by: TomislaW | last post by:
I am sending word document with e-mail from asp.net 2.0 application. I read doc file like this:FileStream fs = System.IO.File.Open(docPath,FileMode.Open,FileAccess.Read,FileShare.Read); Then...
1
by: MissMarie | last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into...
1
by: openuser | last post by:
Hello, I've been researching how to embed python into C/C++. And, I learned how to write c/c++ code that, in threory, should do its job in embedding Python module into itself. Here is what I have.....
2
by: Mathew Coleman | last post by:
Hi All, I would like to send emails through an application. Body and attachment have to be encrypted as well as digitally signed. I could able to sign it and send when it does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.