What is the best way to export your own data to Excel without introducing an Office dependency?

Our product has a requirement to export its own format (mainly an XML file) to Excel for viewing / editing. However, this is due to the dependency on Excel (or Office) for our product assembly β€” which we don’t want.

What we did was export data from our own format to a csv file that can be opened in Excel. If the user also selects the option to open the generated report, we (try) to run the Excel application to open it (of course, it requires that Excel is already present in the client system).

Data for the most part is a flat list of records.

Is there a better way (or even a better way) to fulfill this requirement? This is a common requirement for many products - how do you deal with this?

+3
source share
10 answers

Versions of Excel, both 2007 and several previous ones, have their own XML formats. 2007 is obviously XML by default, and earlier versions have the ability to save as XML. This SO question discusses the issue. I suppose a little inspection will give an idea of ​​what is required. I don't know if XSD / DTD exists for older versions, but a little creative Googling can do something.

+2
source

As other people have noted, it's easy enough to create Excel XML files. You can do this in several ways. For instance:

  • XML- Excel, XML DOM
  • Excel XML XSLT, XML XSLT.
+2

ExcelPackage . , ( , , ) , .

ExcelPackage OOXML ( .xslx), 2k7, MS.

+1

Excel (COM-) , CSV ( , ). html, Excel . [ sql] csv, , , xxxxx.xls - excel , csv. , .

CSV - ( ), . , XLS, , :)

+1

.csv , Excel VBA CSV . , .CSV .XLS .

, Excel .

+1

Java, POI APACHE. http://poi.apache.org/

, , , .

0

Office , . , , . , , Aspose (). , . csv .

0

FlexCel Studio . . 100% , . , "", Excel, volia, .

TMS

0

OleDB Interop. , Interop , , Office. OleDb , - Excel. Interop OleDb () , csv.

0

# VB.Net, DataSet, DataTable List < > , " Excel".

It uses free Microsoft OpenXML libraries (so you don’t need to have Excel on your server) and allows you to export your data to a β€œreal” .xlsx file with only one line of code, for example:

DataSet ds = CreateSampleData();
CreateExcelFile.CreateExcelDocument(ds, "C:\\Sample.xlsx");

All source code is provided on the next page along with a demo project, completely free (and pop-ups!)

http://mikesknowledgebase.com/pages/CSharp/ExportToExcel.htm

Hope this helps!

0
source

Source: https://habr.com/ru/post/1699369/


All Articles