views:

38

answers:

3

Hi, I would like to ask for a recommendation on offline form format which user can bring around. Once done, they will upload the file to the server and data will be extracted from there.

We are currently looking at Word and Excel 2003 since all users have it on their machine but it seems that using interops on server is something to avoid.

Suggestions?

A: 

A CSV file that could be opened in MS Excel is easy-to-program option. Its not chick though.

Vishal Seth
A: 

I think of Excel like duct-tape, it's the quick solution to all data problems. You don't need excel components to access the XLS/XLSX files, you just need to use OLEDB to open/read the files. This is really easy to do and you can create a upload/process tool within the web app to upload files to be processed on the server.

Example Code (c/p for google results):

String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + [Your Excel File Name Here] + ";" + "Extended Properties=Excel 8.0;";

OleDbConnection objConn = new OleDbConnection(sConnectionString);

objConn.Open();

OleDbCommand objCmdSelect =new OleDbCommand("SELECT * FROM [Sheet1$]", objConn);

OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();

objAdapter1.SelectCommand = objCmdSelect;

DataSet objDataset1 = new DataSet();

objAdapter1.Fill(objDataset1);

objConn.Close();

When I do this, I always provide a template for the user to use. You can create a template that has LOCKED fields to prevent data from going into the wrong place and to keep the users focused on what you want them to complete.

Zachary
Yes, I agree that this is a simple way to read and write as a data source. So you have a good answer on this. However, this will not be ideal for anything too complex. :)
Blithe
A: 

When it comes to storing data in files for users, CSV is a pretty safe bet. Your users will be able to open them with Excel, and parsing them server-side is quite pleasant compared to reading from Word documents. My recent question, How to serve a View as CSV in ASP.NET Web Forms, may be useful for you, depending on your implementation.

ChessWhiz