Click here to Skip to main content
13,895,757 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Export Data In Excel Through database using Sp And Ado.net.
Field Name Of The Table.
1.Name 
2.Age
3.Address
4.Photo



Note: *-Photo Column in Base64 String
like this -/9j/4AAQSkZJRgABAAAAAQABAAD//gAUVlQtQ09NUFJFU1MgIHYyLjMg/9sAhAAQCwwOD.....
* given below code only export data without image ..
*GetMeetingListWithDetails -- This is A methodName that Provide The data from Database..
And Hold This Data In DataTable.

What I have tried:

try
        {


            DataTable dt = GetMeetingListWithDetails();
            XLWorkbook wbook = new XLWorkbook();
            wbook.AddWorksheet(dt, "sheet2");

            wbook.Worksheets.Add(dt, "tab1");


            HttpResponse httpResponse = Response;
            httpResponse.Clear();
            httpResponse.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Provide you file name here
            httpResponse.AddHeader("content-disposition", "attachment;filename=\"MeetingReportWithDetails.xlsx\"");

            Flush the workbook to the Response.OutputStream
            using (MemoryStream memoryStream = new MemoryStream())
            {

                wbook.SaveAs(memoryStream);
                memoryStream.WriteTo(httpResponse.OutputStream);
                memoryStream.Close();
            }

            httpResponse.End();

        }
        catch (Exception ex)
        {

        }
Posted
Updated 13-Jan-19 23:56pm
v3
Comments
OriginalGriff 12-Jan-19 2:07am
   
And?
What did it do that you didn't expect, or not do that you did?
Where are you stuck?
What help do you need?

Just dumping code on us and saying "I need ... " with no explanation of where you are now, or what you need to move on doesn't help anyone: remember that we can;t see your screen, access your HDD, or read your mind - we only get exactly what you type to work with!

Use the "Improve question" widget to edit your question and provide better information - help us to help you!
OriginalGriff 14-Jan-19 3:36am
   
If the question was clear, I wouldn't have asked for clarification, and you'd probably have had a solution two days ago! :laugh:

It's clear to you because you have all the context around it, and the rest of your project and data to enable you to use the code fragment you dumped on us; we don't, we only get exactly what you tell us.

So dumping a load of code here, with a description which says almost nothing because you have tried to type as little as possible doesn't constitute a "good question" - we have no idea is the code you show does what you want but there is a bug, doesn't do what you want at all, needs to be modified to add functionality, or is completely irrelevant! And we can't run it to find out, because it needs the rest of your project and your data - which we don't have any access to - to do anything at all!

So try to think about it from out point of view, and give us actual information.
Help us to help you!
Er.RajeshKumar 14-Jan-19 5:08am
   
I Update The Question ..
Please Read This ..
I hope you Understand the Question ..

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

See the decode example here: Base64 Encoding from C#[^]
var encodedTextBytes = Convert.FromBase64String(encodedText);
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190306.1 | Last Updated 14 Jan 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100