I'm using Asp.net to create a csv file that the user can open directly in excel.I want to make it possible to show the download popup and for the user to choose "Open with Excel" and that will open the file in excel.The code to create the csv:
[code]...
As I said what I need is to create a spreadsheet (it doesn't need to be csv),it should just be easy for the user to open in excel or whatever they are using to start working with it.
In my project I have to open excel application on click of a button without having ms-excel installed in server and the same case applies to word also. Please suggest me a solutions asap
We have a tab delimited file that we are making available for download. The file extension is txt, but the users want it to open automatically in Excel. The previous developer had used the following code:
[code]....
The ContentType is being set to Excel, but that doesn't seem to have any effect. I am guessing the txt file extension is causing it to be picked up by notepad or the like instead. I have tried just renaming it to a xls extension, which works but Excel complains that I am trying to trick it or it might be a corrupted file.
I'm trying to open Word & Excel docs in a new browser window. The windows opens and then closes straight away. I think I may need browser plugins. Can someone provide some advice on how I can achieve this?
We moved to a new SQL server and I started getting an error on one of my sps only when I ran it from a website. If I manually ran the sp it worked fine. The error I got was this System.Data.SqlClient.SqlException: OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode. I can tell you that this sp does some things, then calls another sp which writes some sql to open an excel file and insert the data. Here is the pseudo
SET @sql = 'INSERT INTO dbo.TempParts (partKey, partKeyNumeric, partKeyAlpha, PartNumber, [Description], Comment, notAvailable ,BatchID)
I tried simple code like this using href element. But it tries to open the sheet.xls in the browser window and says it can't find the file. I want the excel file to be opened in excel (not browser).
I'm exporting the GridView to Excel. It works fine and I receive a prompt to Save/Open/Cancel the file although I need the file to be saved automatically in the provided (passed to the Export function) location and opened in the same browser window where the Gridview was.
I have created a CSV file on the server and want to send it to the user using the following code:
Dim strPhysicalPath As String strPhysicalPath = Server.MapPath( "CSV/" & PathVirtual) Dim objFileInfo As System.IO.FileInfo = New System.IO.FileInfo(strPhysicalPath) Response.Clear() Response.ContentType = "application/vnd.ms-excel" Response.AddHeader("Content-Disposition", "attachment; filename=" & objFileInfo.Name) Response.AddHeader("Content-Length", objFileInfo.Length.ToString()) Response.WriteFile(strPhysicalPath) Response.Flush() Response.End()
This seems to work fine except when the downloaded file is viewed in Excell the html code behind the page from which it came is also appended to the file. Does anyone have any idea why it does this?
I have a web page with a gridview control and a button for Exporting to Excel
I get following error when exporting to Excel.
"The file you are trying to open, 'someFileName[1].xls, is in a different format than specified by the file extension. Verify that file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"
Clicking Yes opens the file. I would like to avoid showing the above error to the users.
Following code is used from the click event. I've left the commented code here to show what I've tried based on results from internet search. I have Microsoft Office Excel 2007 on local PC.
I have to create an excel sheet by reading data from the database and save this newly created excel to the server. I know how to create the excel, i do it by creating html table then changing the content header. But how can i save this as an excel file in the server.
On an .aspx page in a web site I need to retrieve some data from a sql server database and, instead of displaying it in a Gridview, I need to put the data in a spreadsheet and present the user with a Save As dialog.
I'd prefer to do it without using the Office / Excel / Interop com object - so, from what I've read so far, I can do this by returning XML data from SQL Server?
Normally I get data from SQL Server and populate a dataset or datareader with it - and then use this as the Datasource of a GridView.
If I run this in SQL Server ...
Code: SELECT UserID, UserName FROM tblUsers FOR XML Auto, Root('Users')
So, first question - how do I get the data from SQL Server into my .aspx page? (All data access is done with stored procedures - so, from my data access class normally I create, for example, a SQLDataReader and populate it by calling a stored procedure. What object would I populate with the results of a stored procedure that contains a select statement with 'FOR XML Auto'
Then, assuming I get the XML into the .aspx page - how do I get it into a spreadsheet so that there are two columns called UserID and UserName and 3 rows with 1, 2 and 3 in the first cell and Steve, Andrea and Zebedee in teh second cell?
I want to create an Excelfile on the click of a button in C# and when i click the button again it Creates another file with the same name(can add name changed from like Files to Files1) but i dont want to override the previous file.Like if i click button twice there should be two files with small change in the name.
Without using MySQL, I'm looking for a free (open source) DBMS.I found Firebird and and Postgresql, but I'm not sure about them; Is there any other powerful DBMS you've already used in this case ?
I need to build a Q&A module for a .net site. I need it to integrate with our .net membership system. We are happy to pay for it... but all I have found so far is php code and the QHub hosted system, which would be a problem to integrate with out members.
I have huge excel files that I have to open from web browser. It takes several minutes to load huge file. Is it possible to open a single worksheet (single tab) at a time from excel file that contains many worksheets? I have to do this using C# / asp.net MVC