Click here to Skip to main content
15,900,429 members
Everything / Export

Export

export

Great Reads

by Amit Singh Baghel
A useful tip to export a Div to PDF (with Unicode support) with the help of NReco-PDF Generator for .NET (C#), JQuery and Handler in ASP.NET
by Sarvesh Kumar Gupta
Export to Excel from GridView in C#
by Pasan Eeriyagama
This article focuses on a Very simple and Robust way to export Data to EXCEL
by ASP.NET Community
Here am trying to show how we can export an image to excel file.References Used: Microsoft.Office.Interop.Excel;Link for downloading the dlls

Latest Articles

by ToughDev
How to fix PDF Export Issues while using a Scriptcase Grid app
by PascalLandau
How to setup git-secret to store secrets directly in the repository
by IvanFeng
With AutoExcel, you can quickly import and export Excel without hard coding, and embrace changes.
by Mubin M. Shaikh
Walkthrough of the process for one of the industry best practices to export all SQL tables in Flat file format

All Articles

Sort by Updated

Export 

24 Nov 2023 by PinkGoat_
So I have a button made from my xaml file (view), called Export. When the user clicks on it, the logs created during the run of the app get exported to Logs.txt. If there are Warnings, Errors or Exceptions, those will instead be created in...
24 Nov 2023 by Graeme_Grant
The best solution, IMHO, would be to create a custom log provider. You can then handle the logging as the log entries are added. I wrote an article for a custom Log Viewer control that has a custom Log Provider, one for each of the 4 common...
23 Nov 2023 by Richard MacCutchan
See my comment to your duplicate of this question.
23 Nov 2023 by PinkGoat_
I'm having some issues here. So I wrote this method in a class named MainWindow, that exports logs of an app to a txt. Honestly I dont know if its good but anyways we will see. public void exportLogs () { string logsFolder =...
7 May 2023 by ToughDev
How to fix PDF Export Issues while using a Scriptcase Grid app
1 May 2022 by PascalLandau
How to setup git-secret to store secrets directly in the repository
22 Mar 2022 by Alden Derf Fabro
System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=VBExportDataTableToExcel StackTrace: at VBExportDataTableToExcel.Form1.Button1_Click(Object sender, EventArgs e) in...
22 Mar 2022 by OriginalGriff
Read the error message: System.NullReferenceException HResult=0x80004003 Message=Object reference not set to an instance of an object. Source=VBExportDataTableToExcel This is one of the most common problems we get asked, and it's also the...
5 Jan 2022 by Member 11931581
After exporting SSRS report into Excel rendering format , Grid lines are not showing ,it is showing empty page. For example : If we have data for 10 rows ,Excel export Report is showing with Grid lines till 10 rows only ,after that export is...
17 Sep 2021 by Devendra Sarang
I am trying to maintain simple log file on button click on form. I am able to to do perfectly but there is one error when opening log excel file. Its is saying that "The file format and the extension of .xls don't match." My code is something...
17 Sep 2021 by CHill60
In response to your comment Quote: Still i want to ask. Is there is some logical or other issue in code. You are using Excel/Office 2016 so you should be using .xlsx files and not the old style .xls. Excel will still open the files, but in...
17 Sep 2021 by OriginalGriff
In addition to what Richard has said, I'll add this: Quote: On button click, it will check whether there is log file on "C:\" exists or not If it is exists then it will edit new log data ... Dim FilePath As String = "C:\1.xls" Never store...
17 Sep 2021 by Richard Deeming
Quote: If System.IO.File.Exists(FilePath) Then Else System.IO.File.Create(FilePath).Close() End If You have created an empty file, which is not a valid Excel .xls file. When you try to open that file, you will get a warning from Excel. ...
23 Aug 2021 by Patchanka68
Hello.I have a asp project with vb2008 and crystal reports XI. I designed a report wiht images embebed (OLE object linked with jpg files). The route of the file is in a field of database.In the preview of the crystal reports programs all is ok, but when i export this report to a pdf...
23 Mar 2021 by Rash24Agg
Hi, I have exported data into excel file using oledb since I cannot use interop or any third party library. Here is my code : ''' ''' Export datagridview's data contained in an datatable to excel file ''' '''
13 Jan 2021 by IvanFeng
With AutoExcel, you can quickly import and export Excel without hard coding, and embrace changes.
23 Oct 2020 by Member 10345165
dos cosas se necesitan : 1- usar un hilo con el cultureinfo 2 - castear a date el valor a poner en la celda del excel Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES"); xcelApp.Cells[i + 2, j + 1] =...
23 Oct 2020 by Member 14836421
Please help me: I can't format Date (dd/mm/yyyy), Text, Number of Columns in Datagridview C# when Export Excel. private void btnExportExcel_Click(object sender, EventArgs e) { if (dgvGF1111.Rows.Count > 0) { ...
27 Sep 2020 by Member 14836421
Richard MacCutchan: I don't know Format settings to the excel cells. Please send me your codes. Thanks!
27 Sep 2020 by Richard MacCutchan
You need to add the format settings to the Excel cell so it displays the date in the format that you want. If there is no format set, then Excel will use the system defaults.
24 Jul 2020 by GDBGDB
Good Morning! Just wondering if there is any tool that I can use to export a dataset to xlsx file without having to install latest MSOffice. That is different tables to multiple sheets in C# web app. Thanks What I have tried: ExcelLibrary dll...
24 Jul 2020 by CHill60
Have a look at this Codeproject article A free "Export to Excel" C# class, using OpenXML[^]
14 Jul 2020 by Mubin M. Shaikh
Walkthrough of the process for one of the industry best practices to export all SQL tables in Flat file format
21 May 2020 by Garth J Lancaster
Add a reference & 'using' statement for System.IO.Compression.FileSystem ref : ZipArchive Constructor (System.IO.Compression) | Microsoft Docs[^] - using the 'stream constructor' gets-around having to add an entire directory using (FileStream...
21 May 2020 by Usarsef
Hi i have windows form application where i generate an XML file and what i looking for is to save automatically the XML inside zip file You find below export button code: What I have tried: SaveFileDialog saveFileDialog1 = new...
19 Apr 2020 by Varun Sareen
I found the solution to it. The issue was due to another Response.Write() code was written on Page load due to which the issue in excel file was coming. Response.Write("" & Chr(10)) Response.Write("" &...
19 Apr 2020 by Varun Sareen
Hello Friends, I am trying to download an excel file template from my root Directory and the allowing user to edit the same and then upload the data entered into the modified excel sheet. But whenever i am downloading the template excel file, on...
19 Apr 2020 by OriginalGriff
We can't help you here: the most likely thing is that the file is corrupted, or you are trying to open it before it's fully downloaded, or ... There are a huge number of possible reasons. Start by doing a binary file compare between the original...
30 Dec 2019 by Ri Xu
This post shows you how to import and export Excel XLSX in Go language.
4 Dec 2019 by Richard MacCutchan
foreach (int i in arrRows) { for (int j = 0; j
4 Dec 2019 by Member 14649908
Hi When few rows of DataGridView are selected randomly means not sequentially then the exported excel file contains filled rows along with empty rows in between the filled rows. The empty rows are not desired. How to remove these empty/blank rows from the exported file through coding.Please...
26 Jul 2019 by Richard Deeming
Exporting a DataTable to Excel is trivial with EPPlus (GitHub[^], NuGet[^]): Private Sub ExportTableToExcel() Response.Clear() Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" Response.AddHeader("Content-Disposition", "attachment;...
25 Jul 2019 by Maideen Abdul Kader
Hi I tried to export the place Holder data which is fetched from Mssql database. Data are display in asp.net page. But if Click the Button to export, Excel is empty. Pls advice me Thank you Maideen What I have tried: Private Sub TruckMovementReport() Dim dt As DataTable =...
23 Jul 2019 by Dave Kreskowiak
Nowhere in that code do you export anything resembling an Excel sheet to a file. Writing an HTML table to a file with an extension of ".xls" does NOT make it an Excel workbook. You actually have to write Excel content to the file. You can do that with the OpenXML SDK, or ClosedXML SDK.
7 Apr 2019 by Member 9983063
I am working on attendance software and my project is almost done, I have just one issue while exporting Datagridview data in excel and it's also working fine just but it does not save the whole header of Datagridview columns please check out the screenshot and please help me how can I do this...
7 Apr 2019 by Gerry Schmitz
The debugger is your friend. Debug.WriteLine( sHeaders );
4 Apr 2019 by shah.nilang
I want to export some complex data into excel sheet which takes more time and block application so that user cannot proceed further until this task has completed so i have used backgroundworker for that but still it block application and user has to wait until export functionality will...
4 Apr 2019 by Richard Deeming
There's no point in using a BackgroundWorker for this. It won't make any difference - the browser will be stuck waiting for the response from the server until the server sends the response. Pushing the code that generates the response onto a background thread will just put more strain on the...
20 Feb 2019 by Gerry Schmitz
Change this line, if you want to save it somewhere else. After that, lookup / ask questions about "user input", or "passing parameters". workbook.SaveAs("Desktop:\\output.xls", Type.Missing);
20 Feb 2019 by Member 9983063
Hello Guys, i am facing an issue and that is i want to export Datagridview data in excel and i have code am getting this code from here Export DataGridView To Excel In C#[^] Export DataGridView To Excel In C#[^] but the issue is when I export so it's saved automatically I want it's asking me...
16 Jan 2019 by el_tot93
i have 2,000,000 record in my table and excel don't accept more than 1,040,000 record what should i do ????????? i use this code public void DumpTableToFile(SqlConnection connection, string tableName, string destinationFile) { using (var command = new...
20 Dec 2018 by Dave Kreskowiak
The bigger question is why are you putting all of this in an Excel workbook? It'll be practically unmanageable and unusable. If you're going to be manipulating data in Excel, the proper way to deal with such large data sets would be to have Excel connect to the database and grab the data it...
20 Dec 2018 by Mehdi Gholam
CSV is a text file format it is not an Excel file (although Excel can read it). CSV files have no limitations and can be as large as you need. Excel has a limit of 1 million rows per sheet. 1) Seriously reconsider importing large data into Excel by grouping and filtering your queries in SQL...
19 Dec 2018 by el_tot93
public void DumpTableToFile(SqlConnection connection, string tableName, string destinationFile) { using (var command = new SqlCommand("select * from table " , connection)) { using (var reader = command.ExecuteReader()) { using (StreamWriter sw = new...
19 Dec 2018 by el_tot93
i export a large table with big data to excel/.csv sheet with arabic letters. there is a problem i get when i open the sheet i get the arabic letters like that(/*0%&#@*!*$&@$^#@%*@#4) is there any problem with my code or i should use another code? public void...
8 Sep 2018 by Galarist_00
Hi I would like to save the Tree-view content to a TXT file. What is the easiest way to save it to txt? What I have tried: treeViewIn.Nodes.ToString(); TextWriter tw = new StreamWriter(@"InOrder.txt"); IList list = treeViewIn.Nodes; for (int i = 0; i
8 Sep 2018 by OriginalGriff
There are two problems here: the first is that a treeview is not a "flat" display, it can have branches, and the branches can have twigs: A |\ | B | |\ | | C | D | \ | E F So a simple loop is not a practical way to access all the nodes for storage. It's a recursive data structure, so you need...
23 Jul 2018 by Member 13923422
I am currently working on a project and I have been stuck in exporting a table from the servicenow website using the code below, it is returning a URL redirection instead of the CSV. Any help and suggestion is much appreciated. What I have tried: url = "https://url.service-now.com/nav_to.do?"...
17 Jun 2018 by Member 13757145
Hi John, after searching for a whole bunch of articles on the Internet, it seems like you have a really wide knowledge of WPF and some of your responses seem kinda right to my problem. So...I have a question and desperately need you. When I try export my DataGrid to Excel, it turns out to have...
5 Jun 2018 by alejandroGS
Hello everyone! I'm creating a program in WPF based on C #, which is filling rows of Excel in the same column, but the code on which I base the truth I could not make it work, so I ask a little help to guide me a bit. The example of filling in the data consists of row 15 to row 20 in the same...
4 Apr 2018 by Mish1337
Hi guys I have a query that retrieves data from the database through a Storedproceduer. The data is then stored into a DataTable and then to a session and afterwards export to excel through a button click. My issue is that my table has dozens of NUll values and I want them removed before...
4 Apr 2018 by Christiaan van Bergen
To replace the NULL values in your resultset, you could use the ISNULL() function. For example: SELECT [ID], [Name] FROM [People] would return something like 1 Chris 2 Null 3 Nancy You could easily change the Null values to the value 'unknown' using the following:SELECT [ID], ISNULL([Name],...
3 Apr 2018 by #realJSOP
Change your stored procedure to replace nulls with reasonable default values.
25 Feb 2018 by Frederic GIRARDIN
Hi. Creating a .NET DataSet is easy with Visual Studio, but there is no way to expose that object from a shared DLL. Indeed, when we use only one EXE, we have the same problem: dynamically changing the Dataset ConnectionString which is only a parameter does not seem natural: we traffic a value...
25 Feb 2018 by Frederic GIRARDIN
The fact is that I misunderstood the TableAdapterManager, so I tried to work directly with the table adapter. To do this, I operated a wide replacement of Friend to Public. An operation that was required after each change of the DataSet Designer! And of course, I was wrong. Last Friday, I found...
30 Dec 2017 by Muied Ahmad
Hello! I am exporting excel from gridview and after excel download, I press ctrl+p, then all columns are not fitting in print tab. I want to fit them in one page. Here is my code- HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true;...
30 Dec 2017 by Dave Kreskowiak
OK, the code you posted has nothing to do with how the client prints the Excel sheet. That code is just setting up the content headers, not the content, your Excel workbook, itself. But, typically, there's really nothing you can do on the server to generate a sheet that's guaranteed to print on...
17 Nov 2017 by planetz
Hi All, I am trying to export multiple gridviews into single pdf using iTextSharp. I am looping through the gridviews and then looping through the rows of the gridview. The looping is going ok. But after pdf download, only the last gridview can be seen. It seems the gridviews are overwriting...
17 Nov 2017 by planetz
OK...previously I was using GetInstance and Open methods inside for loop. This is my modified code. protected void btnExportToPDF_Click(object sender, EventArgs e) { GridView[] gvExcel = new GridView[] { gridvw1,gridvw2,gridvw3 }; Document pdfDoc = new...
17 Nov 2017 by raflouk
Hi everyone, I'm trying to make a todolist and it's several days I can't solve my problem. I've a module from which there is a todo class and its methods. I export the object and call its constructor in my main app. Also, in the main app, I try to use one of the object method (object.print())...
28 Sep 2017 by Asad baloch
Hi to all Experts and Gurus :) Dear all experts or gurus i need your help very baldy Please Please Please. First of all, can we install Any MS Office On Windows 2000?? If Yes then How?? 2nd there is a Database made on SQL server enterprise I want to copy data from it but i can't so please...
28 Sep 2017 by OriginalGriff
Starting with the Office question: Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here... A very quick search using part of your question as the search term gave over six million hits: MS Office On Windows 2000 - Google Search[^]...
21 Sep 2017 by Madhukar Krishna
My bad Fellow programmers. The problem has been solved. I was fetching the wrong datatable from database. Thank You for patience
3 Aug 2017 by Ganesh Kums
How can I save this bvh file using save file dialog with button in C#? And I am absolutely beginner for programming. It is saving automatically in Bin/release folder. I tried a lot ways but I didn't find results. Could anyone help? What I have tried: { if (BVHFile == null &&...
3 Aug 2017 by Member 10249362
private void button2_Click(object sender, System.EventArgs e) { // Displays a SaveFileDialog so the user can save the Image // assigned to Button2. SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif...
24 Jul 2017 by Member 13326376
I do not have access to the server since I am not an administrator. But I need to export the result of a query to a TXT file. I do not have access to BCP or the xp_cmdshell store procedure. I require a solution that does not involve requesting execution permissions on the server. What I have...
24 Jul 2017 by george bolovan
Hi, You have to connect as minimum in order to run something on the server. For this you need login (credentials) to authenticate : - windows - SQL user/password In the both cases you should have minimum SELECT permissions on the objects you want to query. If it is the case, no need xp_cmdshell...
6 Jul 2017 by Paula Segatelli
Hi I have a report with the structure below, but I would like there to be no blanks in the item whose title is "Transaction". I wanted the size to be correct depending on the size of the text and not leave those spaces blank. The problem occurs when I try to export a report (using Crystal...
6 Jul 2017 by mahendra pal25
Create three different section In first section place client and in second section "Transaction" and make ur transaction text object can grow and fit the section and rest in the third section.
9 May 2017 by Muhammad_Faraz
Take HTML structure of a table & export to a genuine Excel file - Sever side processing
29 Apr 2017 by Member 11011853
Hi... I'm trying export data from DataGrid to Excel file in visual studio 2002 windows application. I couldn't able to export data. I'm not getting any relevant information in any forum and also in youtube. Any help appreciated. Thank you... What I have tried: Referred many articles but...
29 Apr 2017 by Maciej Los
Follow the links provided in Sandeep Mewara[^] answer: export datagrid to excel [^] Note: you should export data instead of datagrid. Do you feel the difference?
9 Apr 2017 by Michelle Anne E. Rigor
I have two Export to CSV:
9 Apr 2017 by Michelle Anne E. Rigor
try adding below statement on page load and give try.. protected void Page_Load(object sender, EventArgs e) { System.Web.UI.ScriptManager.GetCurrent(this).RegisterPostBackControl(lnkExportWOCSV); } Solution by: vinod.jangle [^]
21 Mar 2017 by Member 9299744
good afternoon,i have a page aspx with image and label. I would like to export in PDF means a button.You have a solution Please.Thanks for nowBest regards
13 Mar 2017 by RKeyy Sii
I have an application that when I click Run Report the data will be generated and exported to excel.I posted a question already for this.My first problem is that I have a data in a column Requisition No. which is the value is for example like this 08-20 but when I export it on excel it will...
13 Mar 2017 by Michael_Davies
The default for cells is General format which means Excel looks at the data in the cell and tries to determine how best to display it. The easiest method is to set the column to Text, that way you do not need a prefix on numbers to force display as string.
12 Mar 2017 by CHill60
See my solution to your earlier question How to get the exact value from website to excel?[^] The character showing in your code is not a single quote (Ascii 39)
6 Mar 2017 by xpertzgurtej
I am trying to export gridview data to pdf using the code provided on www.webcodeexpert.com/2013/06/bind-and-export-gridview-data-to-pdf.html.Its working fine if i am not using master's content page. But on using content page it is showing error "A page can have only one server-side...
15 Feb 2017 by Member 13000170
Hi, I started studing MySQL in this week so I installed newest version of MySQL CLient for Windows . I'm getting to the point where I try to export database. I want to export my database and it' keeps warning me: "mysqldump Version Mismatch mysqldump.exe is version 5.7.12, but the MySQL...
15 Feb 2017 by Peter Leow
Check this out: MySQL :: Issue creating export (backups)[^]
26 Jan 2017 by markwhite1
Hi, I am trying to export crystal report in order to mail it. I have used : printbanqoute.ExportToDisk(ExportFormatType.PortableDocFormat, "E:\\ASD.pdf");However I get an error the "Missing Parameter Values".Without using ExportToDisc it works fine.I have used 4 parameters and...
26 Jan 2017 by markwhite1
I am able to solve my issue. I was writing all codes in `crystalviewer1_Load` event ie; exporting and email as well as populating data to crystal report. So I had to create a Button Email to export and email.Heres my code to export and email, Button1 is the email button on crystalviewer: ...
24 Jan 2017 by Vikas Hire
Hello,I want to get data from Excel sheet and insert into my database table.Is there any best option to do this.I am use ajax call to upload the file. and save data using web service.What I have tried:I want to export excel sheet data to ms sql database..
24 Jan 2017 by Member 9831003
Make a linked server from your sql server to excel and data will come in sql server using open row set command.
17 Jan 2017 by Vikas Hire
hi, I am convert my datatable in CSV format but I cant able to download the csv file,please see below my code. DataTable dt=new DataTable(); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString); ...
16 Jan 2017 by Daniel Jones
you can do this by Import and Export Wizard: Know How to Import Data From Excel Spreadsheet to SQL Server[^]
18 Dec 2016 by RydenChoi
I made a method about Export excel file from DataSet.I have a 5 Datables in DataSet and each name is belowtables[0] - Web Application, tables[1] - Content Database, tables[2] - Site Collection, tables[3] - Webs, tables[4] - ListsAnd after the export, the result is like...
19 Nov 2016 by H.AL
I have created a report on visual studio. The font needed was "Adobe Arabic" so I installed it and add it to fonts in my windows 7 control panel. Now the newly added font can be used in crystal reports Visual studio, word, excel etc... But when I was trying to export my report to PDF an internal...
10 Nov 2016 by TheRealProgrammer
Hello there. I want to export all selectedRows from a datagridview to a DataTable. When clicking (selecting) on more than 2 rows, the next error appears:"An exception error of type System.IndexOutOfRangeException occurred in System.Data.dll."What I have tried:DataTable table = new...
10 Nov 2016 by Karthik_Mahalingam
refer inline commentsDataTable dt = new DataTable(); // create a table for storing selected rows var dtTemp = dataGridView1.DataSource as DataTable; // get the source table object dt = dtTemp.Clone(); // clone the schema of the source table to new table ...
10 Nov 2016 by OriginalGriff
Why would you assume that i is valid for both dataGridView_auswahlen (row source) and table (row destination)?Since you are only transferring selected rows, unless your selection always starts with the first row and has no gaps, you will always get an exception.Instead of using an index,...
3 Oct 2016 by TheRealProgrammer
This would be the solution:MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable data = new DataTable(); sda.Fill(data); BindingSource aSource = new...
3 Oct 2016 by TheRealProgrammer
Hello there,I tried to export a MySQL Table to a .csv but there is something that isn't working and I can't find out what it is. I first tried to get the dates saved into a DataTable and then export them to the .csv using this function:* The error: "You have an error in your SQL syntax;...
14 Sep 2016 by Anti-Antidote
I have a program which takes user input, puts it in a certain format, then outputs it into files of different formats in a set hierarchy. I want the program to be able to zip the folders in a ready-to-use package. How would I achieve this?What I have tried:I have looked all over the...
14 Sep 2016 by KarstenK
Here is some information about 7-zip.Use the command line tool for compressing your written files.
9 Sep 2016 by pparya27
Here is the updated code for exporitng gridview to pdf along with the chartsStep 1: Place this gridview and button on your aspx page :
9 Sep 2016 by Member 11197134
I am trying to download the content of gridview1 to Excel and PDF file. Tried Lots of ways using iTextSharp. I tried rendering , also copying cell by cell creating pdfTable. None worked. Please HelpPlease help me as I am new to chart control in ASP.NETWhat I have...
6 Sep 2016 by pparya27
Hi, nice to see your question.I just created a sample code for your requirement. However I have not created chart inside a gridview. I have just quicky written code for exporting a chart control to pdf file. I have used iTextSharp library for creating pdf file.Step 1 : Place the...