I have excel files which contains few charts, and I must display these charts on the web page. Additionally I can't install excel on server machine.
I've checked the following free libraries:
epplus, closedxml, spreadsheetlight.
But they are not support that kind of operation.
Do you know any free library which can help me with that?
I'm just going to put this here in case there are no other responses...
Without Excel and therefore interop -- you could have it extract the chart XML files from the XLXS (as if it were a ZIP) to parse/recreate the charts (possibly using System.Windows.Forms.DataVisualization.Charting?) and then save.
Related
I have been looking for a solution all over the last days and I found that this library EPPlus allows retrieving in the same time formatting besides the actual data, plus charts, if needed, from Excel files which is what I am aiming at the moment.
Could you please explain to me step by step how to read a Range of cells from an Excel (like A1:P34) file that resides at a certain path, via ASP.NET/C#?
PATH would be something like //ServerName/Folder1/Folder2/Folder3/ExcelFileName.xlsx
I looked over the web, but there is not explicit documentation for my level of C# expertise on this. I tried several examples but none displayed the Excel Range into the webpage. (e.g this one.)
Note: the three examples I have tried all included an File Upload Control, I do not need such. I want to read the Excel file from a specified location over the local network.
EPPlus library is available here.
If you can recommend me any simpler resources to understand EPPlus on:
-reading from Excel
-writing from Excel
-reading charts from Excel
This EPPlus does seem wonderful in its functionality.
To read a file off the server take a look at this:
Open ExcelPackage Object with Excel application without saving it on local file path
Just need to set the var path part for your file.
To actually put the excel data on a web page, that is not so easy. See this:
Generating a HTML table from an Excel file using EPPlus?
Response to Comment:
Hosting an actual excel sheet in web page is temperamental at best but there are ways to do it (I haven't tried it personally). SharePoint is probably your best option if you have it available. If not, you would have to use an iFrame or some kind of office web component. Check this out:
how to display excel sheet in html page
I have a small wpf product which requires exporting data to excel with out excel installed on the client machine.How to achieve this in C#.After exporting, this excel can be opened by Open office. All I wanted is to save excel file to the client hard disk. Even excel is not installed he should be able to save the file,he may not be read it without excel but should be able to save. I dont want to any 3rd party or some other open xmls.
Recently I downloaded a product which is able to export to excel without excel installed and able to open it with open office.
When i checked their binaries they contain office.dll ,Microsoft.Vbe.Interop.dll and Microsoft.Office.Interop.Excel.dll's only .I want to know how they are able to manage with these dlls.
I have already written code for this but its breaking when excel is not installed.
I have read many open xml and other stuff relating to this but not satisfied.
My requirement is too simple ,just exporting datatable data to excel,no reading back the data and no fancy oparations with excel.
Please give me suggestions and links will be appreciated.
Thanks in advance
Either work out with CSV format or you may like to use EPPlus library. See similar answer here
You can use CSV, XML, or ADO
How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
xslt transformation can also to the job. i use it to export wpf datagrid data.
I am writing an application that will live on a server I will not have access to.
My task is to build a web interface that will encapsulate some EXTENSIVE (200+ formulas) logic based in an Excel spreadsheet.
I will not be able to install any software on this server.
I do not want to recode all the formulas in C#.
What I would like is to use a standalone dll that will allow me to open an OpenXML formatted spreadsheet file, change the input cell values, and then extract the end values from cells containing formulas which have run on the new data.
Is there anything out there other than Excel interop (which requires Excel be installed) that will actually compute the formulas realtime?
Since you want to work with OpenXML files, you can use OpenXML SDK 2.0, which is available here: http://www.microsoft.com/download/en/details.aspx?id=5124. You should install it on your developer environment and it helps you to read and modify contents of OpenXML files in your .NET application.
I haven't tried to work with formulas using this SDK, but I suppose it's possible, however, it may require some work (like writing a parser) to recalculate the formulas with you program.
There is, however, a workaround for this, but I'm not sure if it's acceptable for you. You can make Excel reevaluate all the formulas itself when the file is opened by a user. You can find some information about it here: OpenXML SDK: Make Excel recalculate formula.
I also recommend you to use OpenXML SDK 2.0. Productivity Tool, which is a part of the SDK. It allows you to view the contents of an OpenXML file and even show you the c# code required to recreate it programmatically, so it can be really helpful.
I'm writing a program that reads a text file, extracts information, and outputs it to a template Excel spreadsheet that already exists.
I've managed to do this on my computer using the Microsoft.Office.Interop.Excel reference and its related methods, and it works fine. I have Excel 2010. However the computers that this program will be used on mostly have either Excel 2000 or Excel 2003, and it won't work on them.
Does anyone know a way to make a program target all versions of Excel from 2000 upwards?
Cheers,
Greg
If your needs are simple and you don't have $900 for Aspose.Cells to throw around, you can do any of the following:
Use NPOI to read, inject data into, and export your template.
Create a basic HTML file with a table and just named it *.xls. You can save your template in Excel as HTML and replace bits and pieces to insert your data.
Create an XML file using Office 2002/2003 XML format, it's pretty straightforward (caveat: can't be read in Excel 2000). As above, you can save your template in XML Spreadsheet format, read it in, and do some simple stuff to inject your data.
You really need to target 2000 or under. 2010 and 2003 will open a 2000 format document whereas 2000 will not open a 2010 document. Office has a single format for 97-2000 and that's what you need to create to make everybody happy.
Interop depends on the version you have installed and I personally have dodged using interop due to its "unmanaged" nature (and it seems to love file locks).
If you want hassle free and extremely fast/powerful creation of Excel documents, you really can not do better than Aspose.Cells in my opinion.
Find it here.
What is the best (free or paid for) to read Excel files (XLS and XLSX) using C# and populate a datagrid, I would also like to have any changes made in the datagrid be written back to the file.
I should also add that it needs to be high performing as the datagrid can contain a significant number of rows (10,000+).
This would be used for a commercial application so it would need to be distributable.
This is a Windows Forms application.
I recommend databinding the datagrid to a dataset/datatable populated via the ADO.NET OleDb provider.
You'll find an example at Read from Excel using OleDb in a Windows Service?
I also found How To Use ADO with Excel Data from Visual Basic or VBA and How To Use ADOX with Excel Data from Visual Basic or VBA to be useful in knowing how to create a table (sheet) and access sheets and ranges.
It works very well for xls files. I haven't tried using it for xlsx.
SmartXLS for .Net
It support read/write xls/xlsx files and can import/export workbook datas to/from a datagrid.
You don't define whether you speak about web or fat client application.
You can use Open XML SDK 2.0 for Microsoft Office for reading XLSX file. (see http://www.microsoft.com/downloads/details.aspx?FamilyID=c6e744e5-36e9-45f5-8d8c-331df206e0d0&displaylang=en and http://msdn.microsoft.com/en-us/library/cc850837(v=office.14).aspx for some examples and also on http://openxmldeveloper.org/default.aspx.)
You can display and allow to modify the content in a grid like jqGrid (see http://www.trirand.com/blog/?page_id=6) if you use a Web application. This grid is the best jQuery plugin which has a lot of different features and allow implement practical every scenario.
After all you can use Open XML SDK to save result in a modified XLSX file.
For xlsx :
http://msdn.microsoft.com/en-us/library/bb332058%28v=office.12%29.aspx
http://www.codeproject.com/KB/office/OpenXML.aspx