I have always dynamically created MS Word/Excel docs by creating a HTML/CSS-laden string, adding a few MS tags where needed (eg page setup stuff) and then giving it a .xls or .doc extension to force/create a file, but this seems to be dying out as the standard way of doing this.
I’ve tried to investigate what the latest way is that supersedes this tried and trusted method, but all I can find is a method where you try to zip-add an xml file into an docx/xlsx (zip archive) file, which looks mightily messy.
Could somebody please advise on what the latest method is to do this without using any form of bought-in component.
I use Classic ASP (.asp) pages, which are executed on the server, to build up a string of HTML/CSS tags and then this is sent to a web page with an excel or word app type header so that the browser sends it to the user as an .xls or .doc file rather than just showing the HTML/CSS in the web browser.
Lots of people seemed to use this format, but even MS seem to want to bin it and force devs to create .xlsx or .docx files. My problem is what is the best method to create these types of files without buying in a COM/object that might have a limitation (ie no formatting capabilities or render speed issues) or might incur a high price. Hopefully I just want to keep creating the files myself.
I doubt that that is possible the way you describe. I know that the original Word file type has binary data. I also know that the original Word file type was never fully documented by Microsoft because it is not logical. I assume it is possible to generate an original-format Word file that does not use undocumented features but it seems highly unlikely that you can generate a Word file instead of a HTML file from ASP output.
See the following. The xlsx and docx formats are XML documents in a standard format.