Per Delphi-OLE PDF über mehrere Excel-Arbeitsblättern erstellen
Hallo zusammen,
ich speichere per
Delphi-Quellcode:
ein Excel-Dokument als PDF ab.
var
ovExcelApp, ovDoc, ovSheet: OLEVariant; begin ovExcelApp := CreateOLEObject('Excel.Application'); ovExcelApp.Visible := False; ovDoc := ovExcelApp.Workbooks.Open(sDocument, EmptyParam, true, EmptyParam, sPW, sPW, EmptyParam, EmptyParam, EmptyParam, EmptyParam); ovDoc.Sheets[2].Select; ovSheet := Doc.ActiveSheet; ovSheet.ExportAsFixedFormat(0, sVersDoc, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, //set to True to open Acrobat EmptyParam ); Wie kann ich in dem Excel-Dokument alle Arbeistblätter (und nicht nur wie oben Arbeitsblatt 2) selektieren, so dass alle als PDF gespeichert werden. Ich habe alle Sicherheitsabfragen und den Schließvorgang aus obigem Code mal weggelassen. Danke Gerd |
AW: Per Delphi-OLE PDF über mehrere Excel-Arbeitsblättern erstellen
Nicht nur das Sheet. Du kannst auch das ganze Workbook (Arbeitsmappe) darin sind die Sheets enthalten exportieren
https://msdn.microsoft.com/de-de/lib...v=vs.100).aspx Du kannst auch einzelne Seiten exportieren und sie später mit pdftk zusammenfügen. Der beste Weg ist aber wahrscheinlich einfach die Sheets zu selektieren und die Auswahl dann exportieren mit
Code:
:thumb:
selection.exportasfixedformat()
|
AW: Per Delphi-OLE PDF über mehrere Excel-Arbeitsblättern erstellen
Hallo,
genau das sind eigentlich die zwei Wege, die ich probiert habe. Als Workbook
Delphi-Quellcode:
kommt die Fehlermeldung
var
ovExcelApp, ovDoc: OLEVariant; begin ovExcelApp := CreateOLEObject('Excel.Application'); ovExcelApp.Visible := False; ovDoc := ovExcelApp.Workbooks.Open(sDocument, EmptyParam, true, EmptyParam, sPW, sPW, EmptyParam, EmptyParam, EmptyParam, EmptyParam); ovDoc.Workbooks.ExportAsFixedFormat(0, sVersDoc, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, //set to True to open Acrobat EmptyParam ); Zitat:
Delphi-Quellcode:
wird eben nur Blatt 2 selektiert und ein Array wird nicht akzeptiert. Oder ich gebe es falsch an.
ovDoc.Sheets[2].Select;
Noch ein Tip der mir weiter hilft? Gerd |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:02 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz