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?
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.