1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
<%@ Language=VBScript %>
<%
response.write("Tutorial 14<br>")
response.write("----------<br>")
Set workbook = Server.CreateObject("EasyXLS.ExcelDocument")
workbook.easy_addWorksheet_2("Sheet1")
Set xlsTab = workbook.easy_getSheet("Sheet1")
Set xlsTable = xlsTab.easy_getExcelTable()
for i=0 to 5
for j=0 to 3
if ( (i<2) and (j<2) ) then
xlsTable.easy_getCell(i, j).setValue("12")
else
if ( (j=2) and (i<2) ) then
xlsTable.easy_getCell(i, j).setValue("1000")
else
xlsTable.easy_getCell(i, j).setValue("9")
end if
end if
xlsTable.easy_getCell(i, j).setDataType(DATATYPE_NUMERIC)
next
next
xlsTab.easy_addConditionalFormatting_5 "A1:C3", CONDITIONALFORMATTING_OPERATOR_BETWEEN, _
"=9", "=11", true, true, Clng(COLOR_RED)
xlsTab.easy_addConditionalFormatting_9 "A6:C6", CONDITIONALFORMATTING_OPERATOR_BETWEEN, _
"=COS(PI())+2", "", Clng(COLOR_BISQUE)
xlsTab.easy_getConditionalFormattingAt_2("A6:C6").getConditionAt(0).setConditionType( _
CONDITIONALFORMATTING_CONDITIONAL_FORMATTING_TYPE_EVALUATE_FORMULA)
response.write("Writing file: C:\Samples\Tutorial14 - conditional formatting in Excel.xlsx<br>")
workbook.easy_WriteXLSXFile("C:\Samples\Tutorial14 - conditional formatting in Excel.xlsx")
if workbook.easy_getError() = "" then
response.write("File successfully created.")
else
response.write("Error encountered: " + workbook.easy_getError())
end if
workbook.Dispose
%>
|