If you use
SWF Studio to build the EXE for your CD then you can make use of our ADO plugin to read XLS files like this...
Code:
ssCore.init();
ssDefaults.synchronousCommands = true;
function showResult(f, r)
{
ssDebug.trace(f + ": " + r.success);
if (r.success)
{
if (r.result != undefined)
ssDebug.trace("result: " + r.result);
}
else
{
ssDebug.trace("error: " + r.Error.code + ":" + r.Error.description);
ssDebug.trace("adoError: " + r.adoError);
}
ssDebug.trace("");
}
s = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+ssGlobals.ssStartDir+"\\test.xls; Extended Properties=\"Excel 8.0;HDR=No\"";
r = ssCore.ADO.setConnectString({connectString: s});
showResult("ADO.setConnectString", r);
r = ssCore.ADO.setSQL({sql: "SELECT * FROM [sheet1$]"});
showResult("ADO.setSQL", r);
r = ssCore.ADO.setRowFormat({format:"DLM"})
showResult("ADO.setRowFormat", r);
r = ssCore.ADO.open();
showResult("ADO.open", r);
r = ssCore.ADO.moveFirst({});
showResult("ADO.moveFirst:", r);
if (r.success)
{
results.text = r.result;
}
I've attached an example. You'll need to download SWF Studio to try this (there's a FREE trial version). The ZIP file contains an SPX file (SWF Studio self-extracting project) which contains the source FLA and an example XLS file. Just install SWF Studio and then double click on the SPX file to open the project, press the Build button and you can test the new EXE that reads the XLS file.