请兜称疤·恰部蝗脱CFScript Copy HTML File毗ExcelWorkSheets泼年弄Sheet々
叉裁进糠Sheet喇根。芒谯恕 Copy HTML毗糠Sheet惧。身Code。
TestExcel.cfm
DIRECTORY="D:\htdocs\Lehman\test\"
FILENAME="test"
SHEETNAME="22"
LEAVEOPEN="NO"
>
test
HTML2Excel.cfm
ACTION="CONNECT"
CLASS="Excel.Application"
NAME="objExcel"
TYPE="COM">
ACTION="CREATE"
CLASS="Excel.Application"
NAME="objExcel"
TYPE="COM">
// open Excel in the background
objExcel.Visible = false;
// disable Alerts such as: 'Save this workbook?'
objExcel.DisplayAlerts =false;
// Define the workbooks object
objWorkBook = objExcel.Workbooks;
objWorkBook1=objWorkBook.Open("D:\htdocs\Lehman\Test\test3.xls");
objSheets1 = objWorkBook1.WorkSheets;
objSheet1 = objSheets1.Add();
objSheet1.Name ="newtest";
// open the Excel file */
objWorkBook2 = objWorkBook.Open(HTMLFilePath);
objSheets2 = objWorkBook2.WorkSheets;
// get the active worksheet - will have the same name as the HTML file
objSheet2 =objSheets2.Item(HTMLFileName);
objSheet1=objSheets1.Item(val(1));
objSheet1=objSheet2.copy();
// Save As does not work with workbooks / only with worksheets
objWorkBook1.save();
// Close the document
objWorkBook1.Close();
if(Attributes.LeaveOpen IS "No"){
// Quit Excel
objExcel.Quit();
}
//release the object
objExcel = "Nothing";
objExcel.Quit();
Error: This tag requires an end tag!!
Usage:
Dynamically generated HTML to convert to MS Excel format
Problems? Contact the author at: pstolz@usa.net