functions.vbs 46.8 KB
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835
'**************************************************
'		文件菜单
'**************************************************
'新建
Public Sub mnuFileNew_click()
	'If CellWeb1.IsModified() Then '文档已经被更改
	language=7
	if language=8 then
		rtn = MsgBox( "Whether create new format?", vbYesNo)
	else
	    rtn = MsgBox( "是否真的要新建一个模版?", vbYesNo)
	end if
		If rtn = vbNo Then
			Exit Sub
		End If
	'End If
	CellWeb1.SetMaxRows(0)
	CellWeb1.SetMaxRows(20)
	CellWeb1.SetMaxCols(10)
	CellWeb1.FormProtect = false
	CellWeb1.SetShowPopupMenu false
	menu_init
End Sub

'打开本地文档
Public Sub mnuFileOpen_click()
	CellWeb1.OnFileOpen
	CellWeb1.SetShowPopupMenu false
	menu_init
End Sub

Public Sub mnuExcelFileOpen_click()
	CellWeb1.OnOpenExcelFile
	CellWeb1.SetShowPopupMenu false
	menu_init
End Sub

'打开远程文档
Public Sub mnuFileWebOpen_click()
    language=7
	if language=8 then
	strFilename = InputBox( "Please intput report file name of server", "open report file", "HTTP://" )
	else
	strFilename = InputBox( "请输入远程服务器上的超级报表文件名", "打开超级报表文件", "HTTP://" )
	end if
	If strFilename <> "" Then CellWeb1.ReadHttpTabFile strFilename
	CellWeb1.SetShowPopupMenu false
	menu_init
End Sub

Public Sub mnuXMLFileWebOpen_click()
    language=7
	if language=8 then
	strFilename = InputBox( "Please input XML report file name of server", "open XML report file", "HTTP://" )
	else
	strFilename = InputBox( "请输入远程服务器上的XML超级报表文件名", "打开XML超级报表文件", "HTTP://" )
	end if
	If strFilename <> "" Then CellWeb1.ReadHttpXMLFile strFilename
	CellWeb1.SetShowPopupMenu false
	menu_init
End Sub

Public Sub mnuSaveDataAsString_click()
	With CellWeb1
		strValue = .SaveDataAsString()
		MsgBox strValue, vbExclamation
	End With
End Sub

'保存
Public Sub mnuFileSave_click()
    strFilename = CellWeb1.FilePathName
	If strFilename <> "" then
		CellWeb1.SaveFile strFilename
	else
		CellWeb1.OnFileSave
	end if
End Sub

'另存为
Public Sub mnuFileSaveAs_click()
	CellWeb1.OnFileSave
End Sub

Public Sub mnuFileSaveXMLFile_click()
	CellWeb1.OnSaveXMLFile
End Sub

'打印预览
Public Sub mnuFilePrintPreview_click()
	CellWeb1.OnFilePrintPreview
End Sub

'打印设置
Public Sub mnuFilePrintSetup_click()
	CellWeb1.OnPrintSetup
End Sub

'打印页设置
Public Sub mnuPrintPaperSet_click()
	CellWeb1.OnPrintPaperSet
End Sub

'打印
Public Sub mnuFilePrint_click()
	CellWeb1.OnFilePrint
End Sub

'退出
Public Sub mnuFileExit_click()
	If CellWeb1.IsModified() Then
	    language=7
	    if language=8 then
		rtn = MsgBox( "file changed,whether save?", vbExclamation or vbYesNoCancel)
		else
		rtn = MsgBox( "文档已被更改,是否保存?", vbExclamation or vbYesNoCancel)
		end if
		If rtn = vbYes Then
			mnuFileSave_click
		ElseIf rtn = vbCancel Then
			Exit Sub
		End If
	End If
	window.parent.close
End Sub

'**************************************************
'		编辑菜单
'**************************************************
'撤消操作
Public Sub mnuEditUndo_click()
	CellWeb1.Undo
End Sub

'重新操作
Public Sub mnuEditRedo_click()
	CellWeb1.Redo
End Sub

'剪切操作
Public Sub mnuEditCut_click()
 	CellWeb1.OnEditCut
End Sub

'复制操作
Public Sub mnuEditCopy_click()
 	CellWeb1.OnEditCopy
End Sub

'粘贴操作
Public Sub mnuEditPaste_click()
 	CellWeb1.OnEditPaste
End Sub

'查找
Public Sub mnuEditFind_click()
	CellWeb1.OnGoToCell
End Sub

'清除单元文字
Public Sub mnuClearCellText_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.ClearCellText StartRow,StartCol,EndRow,EndCol
	End With
End Sub

'选中区域升序排序
Public Sub mnuOnSortRowAsc_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortCol .Col,StartRow,StartCol,EndRow,EndCol,true
	End With
End Sub

'选中区域降序排序
Public Sub mnuOnSortRowDec_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortCol .Col,StartRow,StartCol,EndRow,EndCol,false
	End With
End Sub

'升序排序-整行交换
Public Sub mnuOnSortRowAscAll_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortCol .Col,StartRow,1,EndRow,.GetMaxCol,true
	End With
End Sub

'降序排序-整行交换
Public Sub mnuOnSortRowAscAll_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortCol .Col,StartRow,1,EndRow,.GetMaxCol,false
	End With
End Sub

'选中区域升序排序
Public Sub mnuOnSortColAsc_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortRow .Row,StartRow,StartCol,EndRow,EndCol,true
	End With
End Sub

'选中区域降序排序
Public Sub mnuOnSortColDec_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortRow .Row,StartRow,StartCol,EndRow,EndCol,false
	End With
End Sub

'升序排序-整列交换
Public Sub mnuOnSortColAscAll_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortRow .Row,1,StartCol,.GetMaxRow,EndCol,true
	End With
End Sub

'降序排序-整列交换
Public Sub mnuOnSortColDecAll_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SortRow .Row,1,StartCol,.GetMaxRow,EndCol,false
	End With
End Sub

'超级链接
Public Sub mnuEditHyperlink_click()
    language=7
	if language=8 then
	strUrl = InputBox( "Please input URL:", "link", "HTTP://" )
	else
	strUrl = InputBox( "请输入超级链接地址:", "超级链接", "HTTP://" )
	end if
	CellWeb1.SetCellURLType CellWeb1.Row,CellWeb1.Col,strUrl
End Sub

'设置粗体
Public Sub cmdBold_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.Bold = not CellWeb1.Bold	
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'设置斜体
Public Sub cmdItalic_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.Italic = not CellWeb1.Italic
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'设置下划线
Public Sub cmdUnderline_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.Underline = not CellWeb1.Underline
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'设置背景色
Public Sub cmdBackColor_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.OnSetCellBkColor
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'设置前景色
Public Sub cmdForeColor_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.OnSetTextColor
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'自动折行
Public Sub cmdWordWrap_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	language=7
	if CellWeb1.AutoWrap then
		CellWeb1.AutoWrap false
		nMenuID = MenuOcx.GetMenuID("AutoWrap")
		MenuOcx.SetMenuChecked nMenuID,false
	    if language=8 then
		MsgBox "change over not line wrap.", vbExclamation
		else
		MsgBox "已经取消自动折行.", vbExclamation
		end if
	else
		CellWeb1.AutoWrap true
		nMenuID = MenuOcx.GetMenuID("AutoWrap")
		MenuOcx.SetMenuChecked nMenuID,true
		if language=8 then
		MsgBox "change over line wrap.", vbExclamation
		else
		MsgBox "设置为自动折行.", vbExclamation
		end if
	end if
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'居左对齐
Public Sub cmdAlignLeft_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.HorzTextAlign = 1
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'居中对齐
Public Sub cmdAlignCenter_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.HorzTextAlign = 2
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'居右对齐
Public Sub cmdAlignRight_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.HorzTextAlign = 3
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'居上对齐
Public Sub cmdAlignTop_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.VertTextAlign = 1
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'垂直居中对齐
Public Sub cmdAlignMiddle_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.VertTextAlign = 2
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'居下对齐
Public Sub cmdAlignBottom_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.VertTextAlign = 3
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'画边框线
Public Sub cmdDrawBorder_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.DrawCellBorder  StartRow, StartCol, EndRow, EndCol, BorderTypeSelect.value,BorderColor.value,DrawTypeSelect.value
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'抹框线
Public Sub cmdEraseBorder_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.ClearCellBorder  StartRow, StartCol, EndRow, EndCol,EraseTypeSelect.value
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'货币符号
Public Sub cmdCurrency_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.SetCellDigitShowStyle StartRow, StartCol, EndRow, EndCol,2,2
	language=7
	if language=8 then
	MsgBox "show ¥", vbExclamation
	else
	MsgBox "人民币符号显示.", vbExclamation
	end if
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'百分号
Public Sub cmdPercent_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.SetCellDigitShowStyle StartRow, StartCol, EndRow, EndCol,4,2
	language=7
	if language=8 then
	MsgBox "show %", vbExclamation
	else
	MsgBox "百分号显示.", vbExclamation
	end if
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'千分位
Public Sub cmdThousand_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.SetCellDigitShowStyle StartRow, StartCol, EndRow, EndCol,5,2
	language=7
	if language=8 then
	MsgBox "show kilocharacter", vbExclamation
	else
	MsgBox "千分位显示.", vbExclamation
	end if
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next
End Sub

'关于超级报表插件
Public Sub cmdAbout_click()
	CellWeb1.AboutBox
End Sub

'插入列
Public Sub cmdInsertCol_click()
	CellWeb1.OnInsertBeforeCol
End Sub

'插入行
Public Sub cmdInsertRow_click()
	CellWeb1.OnInsertBeforeRow
End Sub

'插入单元
Public Sub cmdInsertCell_click()
	CellWeb1.OnInsertCell
End Sub

'删除单元
Public Sub cmdDeleteCell_click()
	CellWeb1.OnDeleteCell
End Sub

'删除列
Public Sub cmdDeleteCol_click()
	CellWeb1.OnDeleteCol
End Sub

'删除行
Public Sub cmdDeleteRow_click()
	CellWeb1.OnDeleteRow
End Sub

'设置表格行列数
Public Sub mnuMaxRowCol_click
	strValue = CellWeb1.GetMaxRow
	language=7
	if language=8 then
	strRow = InputBox( "Please input max line number", "set table line number", strValue )
	else
	strRow = InputBox( "请输入最大行数:", "设置表格行列数", strValue )
	end if
	if strRow ="" then strRow = strValue
	strValue = CellWeb1.GetMaxCol
	if language=8 then
	strRow = InputBox( "Please input max col number", "set table col number", strValue )
	else
	strCol = InputBox( "请输入最大列数:", "设置表格行列数", strValue )
	end if
	if strCol ="" then strCol = strValue
	lMaxRow = strRow
	lMaxCol = strCol
	CellWeb1.SetMaxRows lMaxRow
	CellWeb1.SetMaxCols lMaxCol
	CellWeb1.FormProtect = false
End Sub

'设置行高自动调整
public sub mnuSetRowAutoSize_click()
	with CellWeb1
		.SetRowAutoSize NOT .IsRowAutoSize
		nMenuID = MenuOcx.GetMenuID("SetRowAutoSize")
		MenuOcx.SetMenuChecked nMenuID,.IsRowAutoSize
	end with
end sub

'自动跳转到下一列
public sub mnuJumpNextCol_click()
	with CellWeb1
		.JumpNextCol
		nMenuID = MenuOcx.GetMenuID("JumpNextCol")
		MenuOcx.SetMenuChecked nMenuID,true
		nMenuID = MenuOcx.GetMenuID("JumpNextRow")
		MenuOcx.SetMenuChecked nMenuID,false
	end with
end sub

'自动跳转到下一行
public sub mnuJumpNextRow_click()
	with CellWeb1
		.JumpNextRow
		nMenuID = MenuOcx.GetMenuID("JumpNextCol")
		MenuOcx.SetMenuChecked nMenuID,false
		nMenuID = MenuOcx.GetMenuID("JumpNextRow")
		MenuOcx.SetMenuChecked nMenuID,true
	end with
end sub

'头尾单元自动换行和列
Public Sub mnuSetAutoJumpNextRowCol_click()
	With CellWeb1
		nFlag = not .IsAutoJumpNextRowCol
		.SetAutoJumpNextRowCol nFlag
		nMenuID = MenuOcx.GetMenuID("SetAutoJumpNextRowCol")
		MenuOcx.SetMenuChecked nMenuID,.IsAutoJumpNextRowCol
	End With
End Sub

'在按键时跳过该单元
Public Sub mnuSetCellKeyNotFocus_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		nFlag = not .IsCellKeyNotFocus(StartRow,StartCol)
		.SetCellKeyNotFocus StartRow, StartCol, EndRow, EndCol,nFlag
		nMenuID = MenuOcx.GetMenuID("SetCellKeyNotFocus")
		MenuOcx.SetMenuChecked nMenuID,.IsCellKeyNotFocus(StartRow,StartCol)
	End With
End Sub

'是否显示错误提示
Public Sub mnuShowErrorMsgBox_Click()
	CellWeb1.ShowErrorMsgBox = not CellWeb1.ShowErrorMsgBox
	nMenuID = MenuOcx.GetMenuID("ShowErrorMsgBox")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.ShowErrorMsgBox
End Sub

'设计模式
Public Sub mnuDesignMode_Click()
	CellWeb1.DesignMode = not CellWeb1.DesignMode
	nMenuID = MenuOcx.GetMenuID("DesignMode")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.DesignMode
End Sub

'显示表格线
Public Sub mnuShowGrid_Click()
	CellWeb1.ShowGrid = not CellWeb1.ShowGrid
	nMenuID = MenuOcx.GetMenuID("ShowGrid")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.ShowGrid
End Sub

'显示行列头
Public Sub mnuShowHeader_Click()
	CellWeb1.ShowHeader = not CellWeb1.ShowHeader
	nMenuID = MenuOcx.GetMenuID("ShowHeader")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.ShowHeader
End Sub

'报表只读
Public Sub mnuFormProtect_click()
	With CellWeb1
		.FormProtect = not .FormProtect
		nMenuID = MenuOcx.GetMenuID("FormProtect")
		MenuOcx.SetMenuChecked nMenuID,CellWeb1.FormProtect
		If .FormProtect Then
			language=7
	        if language=8 then
			MsgBox "Table protected", vbExclamation
			else
			MsgBox "报表已经整表保护.", vbExclamation
			end if
		Else
		    language=7
	        if language=8 then
			MsgBox "Table unprotected.", vbExclamation
			else
			MsgBox "报表已经取消整表保护.", vbExclamation
			end if
		End If
	End With
End Sub

'组合单元中的非主单元参于计算
Public Sub cmdSetCCInCells_click()
	With CellWeb1
		.SetCalculateCombinationInCells( not .IsCalculateCombinationInCells)
		If .IsCalculateCombinationInCells Then
			language=7
	        if language=8 then
			MsgBox "no-main cell of combined cell attend calculate", vbExclamation
			else
			MsgBox "组合单元中的非主单元参于计算", vbExclamation
			end if
		Else
		    language=7
	        if language=8 then
			MsgBox "no-main cell of combined cell don't attend calculate", vbExclamation
			else
			MsgBox "取消了组合单元中的非主单元参于计算.", vbExclamation
			end if
		End If
	End With
End Sub

'报表保护时是否出现光标
Public Sub mnuSetProtectFormShowCursor_Click()
	CellWeb1.SetProtectFormShowCursor not CellWeb1.GetProtectFormShowCursor
	nMenuID = MenuOcx.GetMenuID("SetProtectFormShowCursor")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.GetProtectFormShowCursor
End Sub

'是否显示弹出菜单
Public Sub mnuSetShowPopupMenu_Click()
	CellWeb1.SetShowPopupMenu not CellWeb1.GetShowPopupMenu
	nMenuID = MenuOcx.GetMenuID("SetShowPopupMenu")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.GetShowPopupMenu
End Sub

'是否允许鼠标对行高进行调整
Public Sub mnuSetAllowRowResizing_Click()
	CellWeb1.SetAllowRowResizing not CellWeb1.IsAllowRowResizing
	nMenuID = MenuOcx.GetMenuID("SetAllowRowResizing")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.IsAllowRowResizing
End Sub

'是否允许鼠标对列宽进行调整
Public Sub mnuSetAllowColResizing_Click()
	CellWeb1.SetAllowColResizing not CellWeb1.IsAllowColResizing
	nMenuID = MenuOcx.GetMenuID("SetAllowColResizing")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.IsAllowColResizing
End Sub

'是否允许双击表头进行排序
Public Sub mnuSetDClickLabelCanSort_Click()
	CellWeb1.SetDClickLabelCanSort not CellWeb1.GetDClickLabelCanSort
	nMenuID = MenuOcx.GetMenuID("SetDClickLabelCanSort")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.GetDClickLabelCanSort
End Sub

'单元格只读、隐藏
Public Sub mnuReadOnly_click()
	CellWeb1.OnSetCellHideProtect
End Sub

'单选框
Public Sub mnuSetCellCheckBoxType_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		for row = StartRow to EndRow
			for col = StartCol to EndCol
				.SetCellCheckBoxType row,col		
			next
		next
	End With
End Sub

'大文本
Public Sub mnuSetCellLargeTextType_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SetCellLargeTextType StartRow, EndRow, .Col
	End With
End Sub

'设置超级链接
Public Sub mnuSetCellUrlType_click()
    language=7
	if language=8 then
	strURL = InputBox( "Please input URL", "links", "HTTP://" )
	else
	strURL = InputBox( "请输入URL", "超级链接", "HTTP://" )
	end if
	If strURL <> "" Then
		With CellWeb1
			.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
			for row = StartRow to EndRow
				for col = StartCol to EndCol
					.SetCellURLType row,col,strURL		
				next
			next
		End With
	End If
End Sub

'设置数字输入控件
Public Sub mnuSetCellNumericType_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		for row = StartRow to EndRow
			for col = StartCol to EndCol
				.SetCellNumericType row,col		
			next
		next
	End With
End Sub


'设置复合单元
Public Sub mnuSetCellComplexType_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		.SetCellComplexType StartRow,StartCol,EndRow,EndCol
	End With
End Sub

'删除控件
Public Sub mnuSetCellNormalType_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		for row = StartRow to EndRow
			for col = StartCol to EndCol
				.SetCellNormalType row,col		
			next
		next
	End With
End Sub

'财务表头
Public Sub mnuFinanceHeader_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
			CellWeb1.SetCellFinanceHeadType i,j,i,j
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
		next
	next
End Sub

'财务表览
Public Sub mnuFinance_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
			CellWeb1.SetCellFinanceType i, j, i, j
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
		next
	next
End Sub

'财务大写
Public Sub mnuFinanceDaXie_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
			CellWeb1.SetCellDigitShowStyle i,j,i,j,7,2
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
		next
	next
End Sub

'设置/取消单元3维显示
Public Sub mnuShape3D_click()
	With CellWeb1
        .GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		if .IsCellShape3D(.Row,.Col) then
			.SetCellShape3D StartRow,StartCol,EndRow,EndCol,false
		else
			.SetCellShape3D StartRow,StartCol,EndRow,EndCol,true
		End if
	End With
End Sub

'设置行隐藏
Public Sub mnuSetRowHide_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetRowHide StartRow,EndRow,true
End Sub

'设置行取消隐藏
Public Sub mnuSetRowUnHide_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetRowHide StartRow,EndRow,false
End Sub

'设置最合适的行高
Public Sub mnuAutoSizeRow_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.AutoSizeRow StartRow,EndRow,true
End Sub

'自动调整高度太小的行高
Public Sub mnuAutoSizeRow1_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.AutoSizeRow StartRow,EndRow,false
End Sub

'设置列隐藏
Public Sub mnuSetColHide_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetColHide StartCol,EndCol,true
End Sub

'设置列取消隐藏
Public Sub mnuSetColUnHide_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetColHide StartCol,EndCol,false
End Sub

'设置最合适的列高
Public Sub mnuAutoSizeCol_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.AutoSizeCol StartCol,EndCol,true
End Sub

'自动调整高度太小的列高
Public Sub mnuAutoSizeCol1_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.AutoSizeCol StartCol,EndCol,false
End Sub

'导出自定义函数
Public Sub mnuExportUserFunctions_click()
    language=7
	if language=8 then
	strFilename = InputBox( "Please input export file path name:", "export user-defined function", "" )
	else
	strFilename = InputBox( "请输入导出的文件路径名:", "导出自定义函数", "" )
	end if
	If strFilename <> "" Then CellWeb1.ExportUserFunctions strFilename
End Sub

'导入自定义函数
Public Sub mnuImportUserFunctions_click()
    language=7
	if language=8 then
	strFilename = InputBox( "Please input import file path name:", "import user-defined function", "" )
	else
	strFilename = InputBox( "请输入导入的文件路径名:", "导入自定义函数", "" )
	end if
	If strFilename <> "" Then CellWeb1.ImportUserFunctions strFilename
End Sub

'插入图片
Public Sub mnuFormatInsertPic_click()
	CellWeb1.InsertImageFile false
End Sub

'插入单元图片
Public Sub mnuFormatInsertCellPic_click()
	CellWeb1.InsertImageFile true
End Sub

'设置单元格组合
Public Sub mnuFormatMergeCell_click()
	CellWeb1.OnCellCombiNation true
End Sub

'取消单元格组合
Public Sub mnuFormatUnMergeCell_click()
	CellWeb1.OnCellCombiNation false
End Sub

'函数列表
Public Sub mnuFunctionList_click
	With CellWeb1
		.OnFunctionList
	End With	
End Sub

'自定义函数向导
Public Sub mnuUserFunctionGuide_click()
	CellWeb1.UserFunctionGuide
End Sub

'水平求和
Public Sub cmdFormulaSumH_click()
	With CellWeb1
		StartCol = 0: StartRow = 0: EndCol = 0: EndRow = 0
		.GetSelectRegionWeb StartRow,StartCol,EndRow,EndCol
		.AutoSum StartRow,StartCol,EndRow,EndCol,2
	End With
End Sub

'垂直求和
Public Sub cmdFormulaSumV_click()
	With CellWeb1
		StartCol = 0: StartRow = 0: EndCol = 0: EndRow = 0
		.GetSelectRegionWeb StartRow,StartCol,EndRow,EndCol
		.AutoSum StartRow,StartCol,EndRow,EndCol,1
	End With
End Sub

'双向求和
Public Sub cmdFormulaSumHV_click()
	With CellWeb1
		StartCol = 0: StartRow = 0: EndCol = 0: EndRow = 0
		.GetSelectRegionWeb StartRow,StartCol,EndRow,EndCol
		.AutoSum StartRow,StartCol,EndRow,EndCol,3
	End With
End Sub


'重算全表
Public Sub mnuFormulaReCalc_click()
	CellWeb1.ReCalculate '重算全表
	language=7
	if language=8 then
	MsgBox "Calculate complete", vbExclamation
	else
	MsgBox "计算完毕", vbExclamation
	end if
End Sub

'图表向导
Public Sub mnuDataWzdChart_click()
	CellWeb1.OnChartWizard
End Sub

'设置图片为原始大小
Public Sub mnuSetCellImageOriginalSize_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		for row = StartRow to EndRow
			for col = StartCol to EndCol
				.SetCellImageSize row,col,true		
			next
		next
		.Refresh
	End With
End Sub

'设置图片为单元大小
Public Sub mnuSetCellImageCellSize_click()
	With CellWeb1
		.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
		for row = StartRow to EndRow
			for col = StartCol to EndCol
				.SetCellImageSize row,col,false		
			next
		next
		.Refresh
	End With
End Sub

'删除图片
Public Sub mnuDeleteCellImage_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.DeleteCellImage StartRow, StartCol, EndRow, EndCol
End Sub

'设置/取消行表头
Public Sub mnuRowLabel_click()
	with CellWeb1
		if .GetRowLabel >0 Then
			.SetRowLabel(0)
		else
			.SetRowLabel(.Row)
		End if
	End With
	nMenuID = MenuOcx.GetMenuID("SetRowLabel")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.GetRowLabel
End Sub

'设置/取消列表头
Public Sub mnuColLabel_click()
	with CellWeb1
		if .GetColLabel >0 Then
			.SetColLabel(0)
		else
			.SetColLabel(.Col)
		End if
	End With
	nMenuID = MenuOcx.GetMenuID("SetColLabel")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.GetColLabel
End Sub

'设置打印页前脚行数
Public Sub mnuSetPagePreFooterRows_click()
	nPagePreFooterRows = CellWeb1.GetPagePreFooterRows
	language=7
	if language=8 then
	nRow = InputBox( "Comments: Page PreFooter begin to worthwhile one from report form page footer, without the page footer, begin from the last line. For instance: Report form have 20 in all, page footer that set up competent to it counts to be 0, page that set up 2 the moment, belong to page the moment 19, 20, for instance: The report form has 20 lines in all, it is that 2 walks that page footer set up is counted competently, the page set up is that 2 is all right the moment, belong to lower margin 19, 20, belong to page the moment 17, 18.Please input set up for print page prefooter line number:", "set print page prefooter line number", nPagePreFooterRows )
	else
	nRow = InputBox( "说明:页前脚的行是从报表页脚前一行开始向上算起,如果没有页脚,则从最后一行开始。 如:报表共有20行,设置的页脚行数是0行,设置的页前脚是2行,则属于页前脚的是第19,20行,如:报表共有20行,设置的页脚行数是2行,设置的页前脚是2行,则属于页脚的是第19,20行,属于页前脚的是第17,18行。         请输入设置为打印页前脚行数:", "设置打印页前脚行数", nPagePreFooterRows )
	end if
	If nRow <> "" Then CellWeb1.SetPagePreFooterRows nRow
End Sub

'设置打印页脚行数
Public Sub mnuSetPageFooterRows_click()
	nPageFooterRows = CellWeb1.GetPageFooterRows()
	language=7
	if language=8 then
	nRow = InputBox( "Comments: Page Footer competent from the last of report form to worthwhile one.For instance: Report form have 20 in all, page footer that set up competent to it counts to be 2, belong to page the moment 19, 20.Please input set up for print page footer line number:", "set print page footer line number", nPageFooterRows )
	else
	nRow = InputBox( "说明:页脚的行从报表最后一行向上算起。   如:报表共有20行,设置页脚行数是2行,则属于页脚的是第19,20行。                 请输入设置为打印页脚行数:", "设置打印页脚行数", nPageFooterRows )
	end if
	If nRow <> "" Then CellWeb1.SetPageFooterRows nRow
End Sub

'设置每页打印的行数
Public Sub mnuSetOnePrintPageDetailZoneRows_click()
	nPageRows = CellWeb1.GetOnePrintPageDetailZoneRows()
	language=7
	if language=8 then
	nRow = InputBox( "Comments: When being print walk count whom page each reveal,ex table header and table footer and page prefooter line(if 0 lines, show and has not set up page each what printed walked and counting, the system carries on paging according to defaulting).Please input page each print line number:", "set page each print line number", nPageRows )
	else
	nRow = InputBox( "说明:打印时每页显示的行数,不包括表头和表尾页脚、页前脚的行数(如果为0行,则表示没有设置每页打印的行数,系统按缺省进行分页)。 请输入每页打印的行数:", "设置每页打印的行数", nPageRows )
	end if
	If nRow <> "" Then CellWeb1.SetOnePrintPageDetailZoneRows nRow
End Sub

'设置不打印单元格
Public Sub mnuSetCellCanPrint_click()
	bPrint = not CellWeb1.IsCellCanPrint(CellWeb1.Row,CellWeb1.Col)
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetCellCanPrint StartRow, StartCol, EndRow, EndCol,bPrint
	bPrint = CellWeb1.IsCellCanPrint(CellWeb1.Row,CellWeb1.Col)
	nMenuID = MenuOcx.GetMenuID("SetCellCanPrint")
	MenuOcx.SetMenuChecked nMenuID,bPrint
End Sub

'设置只打印单元格文字
Public Sub mnuSetCellOnlyPrintText_click()
	bPrint = not CellWeb1.IsCellOnlyPrintText(CellWeb1.Row,CellWeb1.Col)
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	CellWeb1.SetCellOnlyPrintText StartRow, StartCol, EndRow, EndCol,bPrint
	bPrint = CellWeb1.IsCellOnlyPrintText(CellWeb1.Row,CellWeb1.Col)
	nMenuID = MenuOcx.GetMenuID("SetCellOnlyPrintText")
	MenuOcx.SetMenuChecked nMenuID,bPrint
End Sub

'*****************************************************************
'**********      下拉列表框中的事件
'*****************************************************************
'设置字体
Public Sub changeFontName( ByVal value )
	lFontName = value
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.CellFontName = lFontName
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'设置字号
Public Sub changeFontSize( ByVal value )
	lFontSize = value
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.CellFontSize = lFontSize
	arrayprotect=Split(protectstr,",")
	num=0
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			if arrayprotect(num) then
				CellWeb1.SetCellProtect i,j,i,j,true
			end if
			num=num+1
		next
	next	
End Sub

'设置单元能够输入的最多字符数
Public Sub munSetCellEditMaxInputNumber_click()
	CellWeb1.GetSelectRegionWeb StartRow, StartCol, EndRow, EndCol
	protectstr=""
	for i=StartRow to EndRow
		for j=StartCol to EndCol
			isprotect=CellWeb1.IsCellProtect(i,j)
			if protectstr="" then 
				protectstr=isprotect
			else
				protectstr=protectstr&","&isprotect
			end if
			if isprotect then
				CellWeb1.SetCellProtect i,j,i,j,false
			end if
		next
	next
	CellWeb1.OnSetCellEditMaxInputNumber
End Sub

'菜单
Sub MenuOcx_MenuItemClick(name, nID)
	'   Call MsgBox(name)
	name = ucase(name)
	select case name
	case "ONFILENEW"
	   mnuFileNew_click
	case "ONFILEOPEN"
	   mnuFileOpen_click
	case "ONFILESAVE"
	   mnuFileSave_click
	case "ONFILESAVEAS"
	   mnuFileSaveAs_click
	case "ONFILESAVEASHTML"
	   CellWeb1.OnSaveAsHtmlFile
	case "ONFILEPRINT"
	   mnuFilePrint_click
	case "ONFILEPRINTPREVIEW"
	   mnuFilePrintPreview_click
	case "ONPROPERTY"
	   CellWeb1.OnProperty
	case "TESTSAVE"
		testsave()
    case "STYLECHECK"
        mnuStyleCheck_click

	'编辑菜单
	case "ONCOPY"
	   mnuEditCopy_click
	case "ONCUT"
	   mnuEditCut_click
	case "ONPASTE"
	   mnuEditPaste_click
	case "ONGOTOCELL"
	   CellWeb1.OnGoToCell
	case "ONINSERTBEFOREROW"
	   CellWeb1.OnInsertBeforeRow
	case "ONINSERTNEXTROW"
	   CellWeb1.OnInsertNextRow
	case "ONINSERTFORMATROWS"
	   CellWeb1.OnInsertFormatRows
	case "ONCOPYFORMATROW"
	   CellWeb1.OnCopyRowCellFormat
	case "ONINSERTBEFORECOL"
	   CellWeb1.OnInsertBeforeCol
	case "ONINSERTNEXTCOL"
	   CellWeb1.OnInsertNextCol
	case "ONINSERTFORMATCOLS"
	   CellWeb1.OnInsertFormatCols
	case "ONCOPYFORMATCOL"
	   CellWeb1.OnCopyColCellFormat
	case "ONINSERTCELL"
	   CellWeb1.OnInsertCell
	case "ONINSERTCELLDOWN"
	   CellWeb1.OnInsertCellDown
	case "ONINSERTCELLRIGHT"
	   CellWeb1.OnInsertCellRight
	case "ONCLEARCELLALL"
	   CellWeb1.OnClearCell
	case "ONCLEARCELLTEXT"
	   mnuClearCellText_click
	case "ONDELETEROW"
	   CellWeb1.OnDeleteRow
	case "ONDELETECOL"
	   CellWeb1.OnDeleteCol
	case "ONDELETECELL"
	   CellWeb1.OnDeleteCell
	case "ONDELETECELLUP"
	   CellWeb1.OnDeleteCellUp
	case "ONDELETECELLLEFT"
	   CellWeb1.OnDeleteCellLeft
	case "ONSORTROWASC"
	   mnuOnSortRowAsc_click
	case "ONSORTROWDEC"
	   mnuOnSortRowDec_click
	case "ONSORTROWASCALL"
	   mnuOnSortRowAscAll_click
	case "ONSORTROWDECALL"
	   mnuOnSortRowDecAll_click
	case "ONSORTCOLASC"
	   mnuOnSortCOLAsc_click
	case "ONSORTCOLDEC"
	   mnuOnSortColDec_click
	case "ONSORTCOLASCALL"
	   mnuOnSortCOLAscAll_click
	case "ONSORTCOLDECALL"
	   mnuOnSortColDecAll_click
	   
	'设置菜单
	case "ONSETMAXROWCOL"
	   mnuMaxRowCol_click
	case "ONSETPAPERCOLOR"
	   CellWeb1.OnSetPaperColor
	case "ONSETSYSGRIDLINE"
	   CellWeb1.OnSetSysGridLine
	case "ONSETCELLUSERVALUE"
	   CellWeb1.OnSetCellUserValue
	case "ONSETCELLUSERSTRINGVALUE"
	   CellWeb1.OnSetCellUserStringValue
	case "ONSETCELLVARNAME"
	   CellWeb1.OnSetCellVarName
	case "ONSETCELLHIDEPROTECT"
	   CellWeb1.OnSetCellHideProtect
	case "SETROWAUTOSIZE"
	   mnuSetRowAutoSize_click
	case "JUMPNEXTCOL"
	   mnuJumpNextCol_click
	case "JUMPNEXTROW"
	   mnuJumpNextRow_click
	case "SETAUTOJUMPNEXTROWCOL"
	   mnuSetAutoJumpNextRowCol_click
	case "SETCELLKEYNOTFOCUS"
	   mnuSetCellKeyNotFocus_click   
	case "SHOWERRORMSGBOX"
	   mnuShowErrorMsgBox_Click
	case "DESIGNMODE"
	   mnuDesignMode_Click
	case "SHOWGRID"
	   mnuShowGrid_Click
	case "SHOWHEADER"
	   mnuShowHeader_Click
	case "FORMPROTECT"
	   mnuFormProtect_click
	case "SETPROTECTFORMSHOWCURSOR"
	   mnuSetProtectFormShowCursor_Click
	case "SETSHOWPOPUPMENU"
	   mnuSetShowPopupMenu_Click
	case "SETALLOWROWRESIZING"
	   mnuSetAllowRowResizing_Click
	case "SETALLOWCOLRESIZING"
	   mnuSetAllowColResizing_Click
	case "SETDCLICKLABELCANSORT"
	   mnuSetDClickLabelCanSort_Click
	   
	'格式主菜单
	case "ONTEXTALIGN"
	   CellWeb1.OnTextAlign
	case "ONSETCELLTEXTSPAN"
	   CellWeb1.OnSetCellTextSpan
	case "ONSETCELLEXCELFORMAT"
	   CellWeb1.OnSetCellExcelFormat
	case "SETCELLCHECKBOXTYPE"
	   mnuSetCellCheckBoxType_click
	case "ONSETCELLCOMBOTYPE"
	   CellWeb1.OnSetCellComboType
	case "SETCELLLARGETEXTTYPE"
	   mnuSetCellLargeTextType_click
	case "ONSETCELLDATETIMETYPE"
	   CellWeb1.OnSetCellDateTimeType
	case "SETCELLURLTYPE"
	   mnuSetCellUrlType_click
	case "SETCELLNUMERICTYPE"
	   mnuSetCellNumericType_click
	case "SETCELLCOMPLEXTYPE"
	   mnuSetCellComplexType_click
	case "SETCELLNORMALTYPE"
	   mnuSetCellNormalType_click
	case "SETCELLFINANCEHEADTYPE"
	   mnuFinanceHeader_click
	case "SETCELLFINANCETYPE"
	   mnuFinance_click
	case "SETCELLFINANCEDAXIE"
	   mnuFinanceDaXie_click
	case "SETCELLSHAPE3D"
	   mnuShape3D_click
	case "AUTOWRAP"
	   cmdWordWrap_click
	case "ONSETLINESTYLE"
	   CellWeb1.OnSetLineStyle
	case "ONSETTEXTCOLOR"
	   CellWeb1.OnSetTextColor
	case "ONCHOOSEFONT"
	   CellWeb1.OnChooseFont
	case "ONSETCELLBKCOLOR"
	   CellWeb1.OnSetCellBkColor
	case "ONDATABINDCELLCOLOR"
	   CellWeb1.OnDataBindCellColor
	case "ONSETCELLSHOWSTYLE"
	   CellWeb1.OnSetCellShowStyle
	case "ONSETROWSIZE"
	   CellWeb1.OnSetRowSize
	case "SETROWHIDE"
	   mnuSetRowHide_click
	case "SETROWUNHIDE"
	   mnuSetRowUnHide_click
	case "AUTOSIZEROW"
	   mnuAutoSizeRow_click
	case "AUTOSIZEROW1"
	   mnuAutoSizeRow1_click
	case "ONSETCOLSIZE"
	   CellWeb1.OnSetColSize
	case "SETCOLHIDE"
	   mnuSetColHide_click
	case "SETCOLUNHIDE"
	   mnuSetColUnHide_click
	case "AUTOSIZECOL"
	   mnuAutoSizeCol_click
	case "AUTOSIZECOL1"
	   mnuAutoSizeCol1_click
	case "ONCELLCOMBINATION"
	   CellWeb1.OnCellCombiNation true
	case "ONCELLUNCOMBINATION"
	   CellWeb1.OnCellCombiNation false
	case "ONSLASHSET"
	   CellWeb1.OnSlashSet
	case "ONDEFAULTSET"
	   CellWeb1.OnDefaultSet
	   
	'公式脚本
	case "ONFUNCTIONLIST"
	   CellWeb1.OnFunctionList
	case "USERFUNCTIONGUIDE"
	   CellWeb1.UserFunctionGuide
	case "EXPORTUSERFUNCTIONS"
	   mnuExportUserFunctions_click
	case "IMPORTUSERFUNCTIONS"
	   mnuImportUserFunctions_click
	case "AUTOSUMVERT"
	   cmdFormulaSumV_click
	case "AUTOSUMHORZ"
	   cmdFormulaSumH_click
	case "AUTOSUMALL"
	   cmdFormulaSumHV_click
	case "ONSETFORMLOADSCRIPT"
	   CellWeb1.OnSetFormLoadScript
	case "ONRUNSCRIPT"
	   CellWeb1.OnRunScript
	case "RECALCULATE"
	   CellWeb1.ReCalculate
	   
	 '图形图表
	 case "ONCHARTWIZARD"
	    CellWeb1.OnChartWizard
	 case "ONDRAWLINE"
	    CellWeb1.OnDrawLine
	 case "ONDRAWRECT"
	    CellWeb1.OnDrawRect
	 case "ONDRAWROUNDRECT"
	    CellWeb1.OnDrawRoundRect
	 case "ONDRAWELLIPSE"
	    CellWeb1.OnDrawEllipse
	 case "ONOBJECTLINECOLOR"
	    CellWeb1.OnObjectLineColor
	 case "ONOBJECTFILLCOLOR"
	    CellWeb1.OnObjectFillColor
	 case "ONOBJECTMOVETOFRONT"
	    CellWeb1.OnObjectMoveToFront
	 case "ONOBJECTMOVETOBACK"
	    CellWeb1.OnObjectMoveToBack
	 case "ONOBJECTMOVEFORWARD"
	    CellWeb1.OnObjectMoveForward
	 case "ONOBJECTMOVEBACK"
	    CellWeb1.OnObjectMoveBack
	 case "REFRESHALLOBJECTDATA"
	    CellWeb1.RefreshAllObjectData
	    
	 '图片菜单
	 case "INSERTIMAGEFILE"
	    CellWeb1.InsertImageFile false
	 case "INSERTCELLIMAGE"
	    CellWeb1.InsertImageFile true
	 case "SETCELLIMAGEORIGINALSIZE"
	    mnuSetCellImageOriginalSize_click
	 case "SETCELLIMAGECELLSIZE"
	    mnuSetCellImageCellSize_click
	 case "DELETECELLIMAGE"
	    mnuDeleteCellImage_click
	 case "ONINSERTBACKGROUNDIMAGEORIGINALSIZE"
	    CellWeb1.OnInsertBackgroundImage true
	 case "ONINSERTBACKGROUNDIMAGEFORMSIZE"
	    CellWeb1.OnInsertBackgroundImage false
	 case "SETBACKGROUNDIMAGEORIGINALSIZE"
	    CellWeb1.SetBackgroundImageSize true
	 case "SETBACKGROUNDIMAGEFORMSIZE"
	    CellWeb1.SetBackgroundImageSize false
	 case "DELETEBACKGROUNDIMAGE"
	    CellWeb1.DeleteBackgroundImage
	    
	 '统计
	 case "ONSTATWEBWIZARD"
	    CellWeb1.OnStatWebWizard
	 
	 '打印设置
	 case "SETROWLABEL"
	    mnuRowLabel_click
	 case "SETCOLLABEL"
	    mnuColLabel_click
	 case "SETPAGEPREFOOTERROWS"
	    mnuSetPagePreFooterRows_click
	 case "SETPAGEFOOTERROWS"
	    mnuSetPageFooterRows_click
	 case "SETONEPRINTPAGEDETAILZONEROWS"
	    mnuSetOnePrintPageDetailZoneRows_click
	 case "ONPRINTPAPERSET"
	    CellWeb1.OnPrintPaperSet
	 case "ONPRINTSETUP"
	    CellWeb1.OnPrintSetup
	 case "SETCELLCANPRINT"
		mnuSetCellCanPrint_click
	 case "SETCELLONLYPRINTTEXT"
		mnuSetCellOnlyPrintText_click
	 case "SETPRINTFORMBACKGROUND"
	    CellWeb1.SetPrintFormBackground true
    	nMenuID = MenuOcx.GetMenuID("SetPrintFormBackground")
		MenuOcx.SetMenuChecked nMenuID,CellWeb1.IsPrintFormBackground()
    	nMenuID = MenuOcx.GetMenuID("SetNotPrintFormBackground")
		MenuOcx.SetMenuChecked nMenuID,not CellWeb1.IsPrintFormBackground()
	 case "SETNOTPRINTFORMBACKGROUND"
	    CellWeb1.SetPrintFormBackground false
    	nMenuID = MenuOcx.GetMenuID("SetPrintFormBackground")
		MenuOcx.SetMenuChecked nMenuID,CellWeb1.IsPrintFormBackground()
    	nMenuID = MenuOcx.GetMenuID("SetNotPrintFormBackground")
		MenuOcx.SetMenuChecked nMenuID,not CellWeb1.IsPrintFormBackground()

	 case "GETCURRENTVER"	
	    mnuCurrentVer_click
     case "GETSYSTEMVER"
	    mnuSystemVer_click
	 case "SHOWHELP"
	    mnuShowHelp_click   
	 case "CELLEDITMAXINPUTNUMBER"
	    munSetCellEditMaxInputNumber_click
   end select
End Sub

Sub CellWeb1_ShowCellChanged(Row, Col)
	bPrint = CellWeb1.IsCellCanPrint(CellWeb1.Row,CellWeb1.Col)
	nMenuID = MenuOcx.GetMenuID("SetCellCanPrint")
	MenuOcx.SetMenuChecked nMenuID,bPrint

	bPrint = CellWeb1.IsCellOnlyPrintText(CellWeb1.Row,CellWeb1.Col)
	nMenuID = MenuOcx.GetMenuID("SetCellOnlyPrintText")
	MenuOcx.SetMenuChecked nMenuID,bPrint

	nMenuID = MenuOcx.GetMenuID("AutoWrap")
	MenuOcx.SetMenuChecked nMenuID,CellWeb1.AutoWrap
	
	FontSizeSelect.Value = CellWeb1.CellFontSize
	FontNameSelect.value = CellWeb1.CellFontName
End Sub