.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to insert Binary Image data from XML To Excel using XSLT

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

Hi All,

I had created a XSLT which converts the XML file generated from the system to the excel format. The XSLT has the styles required for this transformation.

Now i am told to insert image in one of the excel columns using XSLT. The image is in binary code format in the XML file.

Tried to google but could not found the syntaxes for this. Let me know if anyone has done the image embedding in excel using XSLT.


View Complete Post

More Related Resource Links

Insert data to Excel using OLEDB



I am trying to insert data to Excel Document using OLEDB as follows:-

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 
values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";
myCommand.CommandText = sql;

 sql = "Insert into [MyFirstSheet$] (" + Title1 + "," +Title2 + "," + Title3 + ") 

values('" + Value1 + "','" + Value2 + "','" + Value2 + "')";

myCommand.CommandText = sql;


But, the Title1 ,Title2, Title3 are in the 3rd row of the Excel Document. So, the data is not inserted.

Create excel file from Binary data on SqlServer



My requirement is that i upload an excel file then i need to validate that data.


1. Uploading file using using upload control saving binary in SqlServer

2. Then i am creating file from binary data  on Sql Server using below command and then using OPENROWSET to dump data to Sql table

3. Then reading Sql Table row wise and validating data.


Alter Procedure spUploadExcelFile
  @PKID int,
  @BatchID int


	Declare @VarBin varbinary(max)
	Declare @FileName varchar(100)
	DECLARE @sql nvarchar(MAX)
                DECLARE @errMsg nvarchar(MAX)
	DECLARE @ObjectReturn INT
	DECLARE @ErrorSource VARCHAR(255)
	DECLARE @ErrorDesc VARCHAR(255)
	DECLARE @ObjectToken INT

	Select @VarBin  = Content , @FileName = [FileName] from MultilangBinaryData Where PKID = @PKID
	SET @FileName = 'C:\'  + @FileName
	EXEC sp_OACreate 'ADODB.Stream' @ObjectToken OUTPUT
	EXEC sp_OASetProperty @ObjectToken, 'Type', 1
	EXEC sp_OAMethod @ObjectToken, 'Open'
	EXEC sp_OAMethod @ObjectToken, 'Write', NULL, @VarBin
	EXEC sp_OAMethod @ObjectToken, 'SaveToFile', NULL, @FileName, 2
	EXEC sp_OAMethod @ObjectToken, 'Close'
	EXEC sp_OADestroy @ObjectToken  
	SET @sql = 'INSERT INTO dbo.UserBulkData SELECT 0,NULL,'+ @BatchI

Insert Excel Data via File Upload into sql server database???

Hi all, I have requirement that User can Upload the Excel Sheet Data to sql server Database at once. How i do that Any Article or hint is apperciated.   Regards 

How Do You Insert An Image From The Image Folder Into A Binary Column?

Hello Forum, How would I go about inserting an image that's in my images folder into a sql table column of datatype varbinary(MAX) ?    Thank you

How do I display excel, pdf and word binary data in a gridview?


Hello forum

I'm using the following code to upload images, pdf files, word files and excel to a sql table as binary data.  However, I can only figure out how to display the images but am clueless about the other type of files.  What adjustments do I need to make so that with a button click I can access the other files?  't By the way, I'm using an image control to display the binary data and I'm aware that that will only work to display images, I just don't how to access all the other types of files once uploaded. Thanks

Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient
Imports System.IO

Partial Class Uploads_UReceipts
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Request.QueryString("ImageID") IsNot Nothing Then

            Dim strQuery As String = "select Name, ContentType, Data from tblFiles where id=@id"

            Dim cmd As SqlCommand = New SqlCommand(strQuery)

            cmd.Parameters.Add("@id", SqlDbType.Int).Va

Writing image binary data to the Response


Hi there,

I've created 2 web user controls. A = User control that displays an image, and B is the user control that hosts A. I'm trying to stream an array of bytes to A, but it seems like the Response.BinaryWrite method completely overwrites any heirachial controls (I can't see any of B's other controls besides the image).

How do I get A to just display the image from the byte stream? It doesn't come from a database, it's an image I created on the fly.

A's code:

        public void UpdateImage(byte[] imgbytes)
            Response.ContentType = "image/jpg";


Binary Data Problem....save and retrive image data from sql database


hello friends...please help me to solve this problem....

i have created crud (create, retive, update and delete)form and it's running... here i want to add images for each record(sql database)....

i'm using image datatype in sql table for picture.....

Q 1: how to save and retrive binary data(image) from sql table in asp.net form using vb coding?

Q2: can i create sql table which store binary(image url) data direct?

thank you

Insert Data to table from excel file


guys, i am new to sql development

my question is how do i import data from an excel table,

i was trying to do it via a query and just paste the values, but received a syntax error. thanks

data structure is:


Insert data into Excel in an exact cell



If I do the following, I can update a cell in Excel from SQL Express 2008 with the data I want:

SET @strsql = 'UPDATE OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0;Database=' + @strFileName + ''',''SELECT * FROM [MySheet]'') SET [' + @Column + ']=''' + @Variable + ''' WHERE RowID=''' + @RowID + ''''

Is there a way to insert a range of data into Excel starting at a specific cell, rather than just updating one specific cell?



Adding bulleted data to Excel using XSLT


I had created a XSLT which converts the XML file generated from the system to the excel format. The XSLT has the styles required for this transformation.

Now i need to add data in bulleted format in the excel column. Is it possible to do using XSLT

can't insert a group of data into excel using OleDb connection

OleDbConnection MyConnection;
                OleDbCommand myCommand = new OleDbCommand();
                string sql = null;
                MyConnection = new System.Data.OleDb.OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Project\Sample1.xls;Persist Security Info=False;Extended Properties='Excel 8.0;HDR=YES'");
                myCommand.Connection = MyConnection;
                sql = "Insert into [first$] (Name,Group) values('jag','f');";
                myCommand.CommandText = sql;
this the code. and the error is- syntax error in insert into statement as it is not able to insert.
if i use "insert into [first$] (Name) values('jag');" its working..but the subsequent update statem

to insert a row of data in excel of specific font color through C#


i m using Oledb connection  to connect with excel.i wanted to insert a row of data in excel of specific color say - red..

how can i do programmatically in c#?

Convert MS Excel to XML and then insert all data records into MS SQL



I am developing a web page for users to input data records. I am seeking the fastest way that users can upload their MS Excel files and the system can help data insertion into one data table. I know XML can insert data records into SQL database easily. Could any one give me some ideas how to perform this issue? Thanks a lot.


ASP.Net Create physical image from binary data in Sybase


I want to extract an image from a third party Sybase table which has binary data in it.

To store images they use the following query:

SELECT xp_write_file('C:\photo-1.gz', col_name) FROM tbl_name

What I am trying to do is convert the binary data stored to a actual physical file using .Net

Any help would be appreciated.

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Creating an Excel Spreadsheet and Adding Data to It Programmatically

The Interoperability services make it veryeasy to work with COM Capable Applications such as Word and Excel. Thisarticle reveals using Excel from a managed application. Excel is thespreadsheet component of Microsoft Office 2000. The majority of Excelprogrammatic functionality is exposed through Automation via the typelibrary Excel9.olb. The intention of this article is to express that amanaged application can interrelate with Excel as a COM server.

delete data in excel sheet



           I have write the code for deleting the data in excel sheet. but we have got the error" Deleting data in a linked table is not supported by this ISAM."

     below I paste some code snippest.

string strDelete = "Delete  from [" + strSheetName + "$]";

            cmdExcel.Connection = con;
            cmdExcel.CommandType = CommandType.Text;
            cmdExcel.CommandText = strDelete;


Please can anybody this answer.It is urgent

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend