srcanamdw/codescanner/pyinstaller/e2etests/win32/testMSOffice.py
author noe\swadi
Thu, 18 Feb 2010 12:29:02 +0530
changeset 1 22878952f6e2
permissions -rw-r--r--
Committing the CodeScanner Core tool This component has been moved from the StaticAnaApps package. BUG : 5889 (http://developer.symbian.org/webbugs/show_bug.cgi?id=5889).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     1
# Copyright (C) 2005, Giovanni Bajo
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     2
# Based on previous work under copyright (c) 1999, 2002 McMillan Enterprises, Inc.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     3
#
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     4
# This program is free software; you can redistribute it and/or
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     5
# modify it under the terms of the GNU General Public License
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     6
# as published by the Free Software Foundation; either version 2
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     7
# of the License, or (at your option) any later version.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     8
#
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
     9
# This program is distributed in the hope that it will be useful,
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    12
# GNU General Public License for more details.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    13
#
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    14
# You should have received a copy of the GNU General Public License
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    15
# along with this program; if not, write to the Free Software
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    17
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    18
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    19
# Test MSOffice
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    20
#
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    21
# Main purpose of test is to ensure that Dynamic COM objects
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    22
# work as expected.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    23
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    24
# Assumes Word and Excel installed on your machine.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    25
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    26
import win32com, sys, string, win32api, traceback
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    27
import win32com.client.dynamic
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    28
from win32com.test.util import CheckClean
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    29
import pythoncom
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    30
from win32com.client import gencache
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    31
from pywintypes import Unicode
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    32
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    33
error = "MSOffice test error"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    34
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    35
# Test a few of the MSOffice components.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    36
def TestWord():
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    37
	# Try and load the object exposed by Word 8
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    38
	# Office 97 - _totally_ different object model!
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    39
	try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    40
		# NOTE - using "client.Dispatch" would return an msword8.py instance!
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    41
		print "Starting Word 8 for dynamic test"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    42
		word = win32com.client.dynamic.Dispatch("Word.Application")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    43
		TestWord8(word)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    44
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    45
		word = None
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    46
		# Now we will test Dispatch without the new "lazy" capabilities
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    47
		print "Starting Word 8 for non-lazy dynamic test"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    48
		dispatch = win32com.client.dynamic._GetGoodDispatch("Word.Application")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    49
		typeinfo = dispatch.GetTypeInfo()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    50
		attr = typeinfo.GetTypeAttr()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    51
		olerepr = win32com.client.build.DispatchItem(typeinfo, attr, None, 0)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    52
		word = win32com.client.dynamic.CDispatch(dispatch, olerepr)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    53
		dispatch = typeinfo = attr = olerepr = None
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    54
		TestWord8(word)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    55
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    56
	except pythoncom.com_error:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    57
		print "Starting Word 7 for dynamic test"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    58
		word = win32com.client.Dispatch("Word.Basic")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    59
		TestWord7(word)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    60
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    61
	try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    62
		print "Starting MSWord for generated test"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    63
		# Typelib, lcid, major and minor for the typelib
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    64
		try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    65
			o = gencache.EnsureModule("{00020905-0000-0000-C000-000000000046}", 1033, 8, 0, bForDemand=1)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    66
		except TypeError:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    67
			o = gencache.EnsureModule("{00020905-0000-0000-C000-000000000046}", 1033, 8, 0)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    68
		if o is None :
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    69
			raise ImportError, "Can not load the Word8 typelibrary."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    70
		word = win32com.client.Dispatch("Word.Application.8")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    71
		TestWord8(word)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    72
	except ImportError, details:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    73
		print "Can not test MSWord8 -", details
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    74
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    75
def TestWord7(word):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    76
	word.FileNew()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    77
	# If not shown, show the app.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    78
	if not word.AppShow(): word._proc_("AppShow")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    79
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    80
	for i in xrange(12):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    81
		word.FormatFont(Color=i+1, Points=i+12)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    82
		word.Insert("Hello from Python %d\n" % i)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    83
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    84
	word.FileClose(2)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    85
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    86
def TestWord8(word):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    87
	word.Visible = 1
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    88
	doc = word.Documents.Add()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    89
	wrange = doc.Range()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    90
	for i in range(10):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    91
		wrange.InsertAfter("Hello from Python %d\n" % i)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    92
	paras = doc.Paragraphs
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    93
	for i in range(len(paras)):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    94
		paras[i]().Font.ColorIndex = i+1
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    95
		paras[i]().Font.Size = 12 + (4 * i)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    96
	# XXX - note that
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    97
	# for para in paras:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    98
	# 	para().Font...
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
    99
	# doesnt seem to work - no error, just doesnt work
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   100
	# Should check if it works for VB!
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   101
	doc.Close(SaveChanges = 0)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   102
	word.Quit()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   103
	win32api.Sleep(1000) # Wait for word to close, else we
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   104
	# may get OA error.
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   105
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   106
def TestWord8OldStyle():
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   107
	try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   108
		import win32com.test.Generated4Test.msword8
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   109
	except ImportError:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   110
		print "Can not do old style test"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   111
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   112
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   113
def TextExcel(xl):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   114
	xl.Visible = 0
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   115
	if xl.Visible: raise error, "Visible property is true."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   116
	xl.Visible = 1
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   117
	if not xl.Visible: raise error, "Visible property not true."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   118
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   119
	if int(xl.Version[0])>=8:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   120
		xl.Workbooks.Add()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   121
	else:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   122
		xl.Workbooks().Add()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   123
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   124
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   125
	xl.Range("A1:C1").Value = (1,2,3)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   126
	xl.Range("A2:C2").Value = ('x','y','z')
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   127
	xl.Range("A3:C3").Value = ('3','2','1')
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   128
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   129
	for i in xrange(20):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   130
		xl.Cells(i+1,i+1).Value = "Hi %d" % i
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   131
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   132
	if xl.Range("A1").Value <> "Hi 0":
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   133
		raise error, "Single cell range failed"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   134
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   135
	if xl.Range("A1:B1").Value <> ((Unicode("Hi 0"),2),):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   136
		raise error, "flat-horizontal cell range failed"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   137
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   138
	if xl.Range("A1:A2").Value <> ((Unicode("Hi 0"),),(Unicode("x"),)):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   139
		raise error, "flat-vertical cell range failed"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   140
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   141
	if xl.Range("A1:C3").Value <> ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   142
		raise error, "square cell range failed"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   143
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   144
	xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   145
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   146
	if xl.Range("A1:C3").Value  <> ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   147
		raise error, "Range was not what I set it to!"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   148
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   149
	# test dates out with Excel
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   150
	xl.Cells(5,1).Value = "Excel time"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   151
	xl.Cells(5,2).Formula = "=Now()"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   152
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   153
	import time
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   154
	xl.Cells(6,1).Value = "Python time"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   155
	xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   156
	xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   157
	xl.Columns("A:B").EntireColumn.AutoFit()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   158
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   159
	xl.Workbooks(1).Close(0)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   160
	xl.Quit()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   161
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   162
def TestAll():
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   163
	try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   164
		TestWord()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   165
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   166
		print "Starting Excel for Dynamic test..."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   167
		xl = win32com.client.dynamic.Dispatch("Excel.Application")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   168
		TextExcel(xl)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   169
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   170
		try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   171
			print "Starting Excel 8 for generated excel8.py test..."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   172
			try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   173
				mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   174
			except TypeError:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   175
				mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   176
			xl = win32com.client.Dispatch("Excel.Application")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   177
			TextExcel(xl)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   178
		except ImportError:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   179
			print "Could not import the generated Excel 97 wrapper"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   180
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   181
		try:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   182
			import xl5en32
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   183
			mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   184
			xl = win32com.client.Dispatch("Excel.Application.5")
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   185
			print "Starting Excel 95 for makepy test..."
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   186
			TextExcel(xl)
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   187
		except ImportError:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   188
			print "Could not import the generated Excel 95 wrapper"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   189
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   190
	except KeyboardInterrupt:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   191
		print "*** Interrupted MSOffice test ***"
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   192
	except:
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   193
		traceback.print_exc()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   194
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   195
if __name__=='__main__':
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   196
	TestAll()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   197
	CheckClean()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   198
	pythoncom.CoUninitialize()
22878952f6e2 Committing the CodeScanner Core tool
noe\swadi
parents:
diff changeset
   199