If you don't want to change your existing scripts too much, you would need to find a technology that can convert html tables to xls or xlsx and utilize it in fw_exit.fwx. Your scripts would have to set the value of a public variable, indicating whether the output should stay as HTML or be converted to XLS (or XLSX). In cases where the output needs to be converted to XLSX, you will need to grab the output buffer (Response.OutputBuffer), extract the table element and its contents, and process it with the converter to create the Excel file. After that the code will need to replace the content of the output buffer with the new output.
A quick search on "convert html to excel command line" yielded HTMLConverter
, but I don't know anything about it and there may be other utilities that are better suited for your needs.
By the way, I see this solution as a hack. It should work fine, but it's pretty heavyweight in terms of server resources and does not give you too much control over the format of the Excel files. A better solution would be to create the files directly in each fwx script, rather than creating HTML and then converting it. The technology for this will vary, depending on whether you want to create XLS or XLSX (OpenXML) output.
|FoxWeb Support Team
Sent by Ali Koumaiha on 12/03/2014 06:04:16 AM:
Say i have this script: (just to make it simple)
Can i stream this to the browser as an excel file?
I know i can do copy to ... type xls and stream that file, but, i want to send it to the user as excel with the formatting.
i also know i can do excel automation, but, every one of my pages has different format and tables and labels etc.. so, that would require me to 'automate' excel for every page, (100s of them) all are reports etc..
<table width="400" border="0">