• 0

[c# .net] Converting a csv to an xls document


Question

Hey guys,

I'm thinking of developing a script for work, which basically allows any csv to be converted into a xls document.

How would i go about doing this, I can only seem to find details on how to convert xls to csv.

Is this a Big task to take on?

thanks

matt

1 answer to this question

Recommended Posts

  • 0

Well, you could do it a couple of ways:

1). If it is a client application and the user as Microsoft Excel installed, you can use the Excel COM objects to write to the file.

2). Regardless of environment (client or server), you could use the Microsoft JET OLEDDB provider to write to the file in a SQL like manner.

3). If you are doing it in a web application (ASP.NET), you could simply convert the CSV file into a HTML table, and write out the response stream as ContentType "application/vnd.ms-excel"

The last option does afford you limited formatting options, as Excel does respect any styling you've applied in HTML/CSS (to its best ability).

Does that help?

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.