Hallo nochmal,
gencache und constants liefert leider auch keine Lösung:
In der mit makepy generierten cache-Datei ist die Methode ExportAsFixedFormat wie folgt definiert (wobei defaultNamedOptArg=pythoncom.Empty) ist:
Code: Alles auswählen
def ExportAsFixedFormat(self, Path=defaultNamedNotOptArg, FixedFormatType=defaultNamedNotOptArg, Intent=1, FrameSlides=0
, HandoutOrder=1, OutputType=1, PrintHiddenSlides=0, PrintRange=0, RangeType=1
, SlideShowName='', IncludeDocProperties=False, KeepIRMSettings=True, DocStructureTags=True, BitmapMissingFonts=True
, UseISO19005_1=False, ExternalExporter=defaultNamedOptArg):
return self._ApplyTypes_(2096, 1, (24, 32), ((8, 1), (3, 1), (3, 49), (3, 49), (3, 49), (3, 49), (3, 49), (9, 49), (3, 49), (8, 49), (11, 49), (11, 49), (11, 49), (11, 49), (11, 49), (12, 17)), 'ExportAsFixedFormat', None,Path
, FixedFormatType, Intent, FrameSlides, HandoutOrder, OutputType
, PrintHiddenSlides, PrintRange, RangeType, SlideShowName, IncludeDocProperties
, KeepIRMSettings, DocStructureTags, BitmapMissingFonts, UseISO19005_1, ExternalExporter
)
Ich habe mein Testscript wie folgt geändert:
Code: Alles auswählen
import win32com.client
import pythoncom
'''
Nur zur Info, Definition aus VB Objectbrowser:
Sub ExportAsFixedFormat(
Path As String,
FixedFormatType As PpFixedFormatType,
[Intent As PpFixedFormatIntent = ppFixedFormatIntentScreen],
[FrameSlides As MsoTriState],
[HandoutOrder As PpPrintHandoutOrder = ppPrintHandoutVerticalFirst],
[OutputType As PpPrintOutputType = ppPrintOutputSlides],
[PrintHiddenSlides As MsoTriState],
[PrintRange As PrintRange],
[RangeType As PpPrintRangeType = ppPrintAll],
[SlideShowName As String],
[IncludeDocProperties As Boolean = Falsch],
[KeepIRMSettings As Boolean = Wahr],
[DocStructureTags As Boolean = Wahr],
[BitmapMissingFonts As Boolean = Wahr],
[UseISO19005_1 As Boolean = Falsch],
[ExternalExporter]
)
'''
myPowerpoint = win32com.client.gencache.EnsureDispatch('Powerpoint.Application')
myPowerpoint.Activate()
myPresentation = myPowerpoint.Presentations.Open("C:\\testdokumente\\ppt\\Praesentation.ppt")
myPowerpoint.ActivePresentation.ExportAsFixedFormat(Path="c:\\mypdf.pdf",
FixedFormatType=win32com.client.constants.ppFixedFormatTypePDF,
Intent=win32com.client.constants.ppFixedFormatIntentScreen,
FrameSlides=0,
HandoutOrder=win32com.client.constants.ppPrintHandoutVerticalFirst,
OutputType=win32com.client.constants.ppPrintOutputSlides,
PrintHiddenSlides=0,
PrintRange=0,
RangeType=win32com.client.constants.ppPrintAll,
SlideShowName='',
IncludeDocProperties=False,
KeepIRMSettings=True,
DocStructureTags=True,
BitmapMissingFonts=True,
UseISO19005_1=False,
ExternalExporter=pythoncom.Empty
)
Das Ergebnis ist leider immer das Gleiche:
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Dokumente und Einstellungen\mgo\Desktop\test.py", line 44, in <module>
ExternalExporter=pythoncom.Empty
File "C:\Python25\lib\site-packages\win32com\gen_py\91493440-5A91-11CF-8700-00AA0060263Bx0x2x9.py", line 7866, in ExportAsFixedFormat
, KeepIRMSettings, DocStructureTags, BitmapMissingFonts, UseISO19005_1, ExternalExporter
File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 448, in _ApplyTypes_
dispid, 0, wFlags, retType, argTypes, *args),
ValueError: argument is not a COM object
Ich vermute, das der Value-Error sich auf FixedFormatType und Intent bezieht. Wenn ich dort Ints übergebe, ist das Resultat das Gleiche. True und False als 1 und 0 zu übergeben habe ich auch versucht. Was soll hier wie als Objekt übergeben werden ?
Gibt es jemand, mit Office 2007?