Entwickler-Ecke
Windows API - Word Export in Dll auslagern....
cscp - Sa 22.01.05 00:34
Titel: Word Export in Dll auslagern....
Hallo,
hab mir eine Prozedur geschrieben die was in Word exportiert... mein Problem nun: Ich hab die Prozedur in ne DLL ausgelagert und jetzt kommt immer wenn ich word.free ausführe eine Fehlermeldung... im Hauptprogramm jedoch funktionierts prächtig... Weiss jemand rat?
hier der code meiner dll...
Delphi-Quelltext
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:
| library oleLibrary;
uses ShareMem, SysUtils, ComObj, Dialogs, DBTables, Classes;
var wordApplication: Variant; workdir: String;
{$R *.res} procedure CreateInitOle; begin try wordApplication:= CreateOleObject('Word.Application'); wordApplication.visible:=true; wordApplication.documents.add; wordApplication.selection.font.name:='Verdana'; wordApplication.selection.font.size:=10; wordApplication.selection.font.bold:=true; wordApplication.selection.paragraphFormat.Alignment:=0; wordApplication.selection.typetext(Text:='Bibliotheca - Listenexport'); wordApplication.selection.typeParagraph; wordApplication.selection.font.bold:=false; except MessageDlg('Konnte Word nicht starten!!', mtError, [mbCancel], 0); Exit; end; end;
procedure exportLendings; var wrdtbl: TTable; begin
CreateInitOle;
wordApplication.selection.typetext(Text:='Stand ('+DateToStr(now)+' / '+TimeToStr(now)+')'); wordApplication.selection.typeParagraph; wordApplication.selection.typeParagraph; wordApplication.selection.typeParagraph; wrdtbl:=TTable.Create(nil); GetDir(0,workdir); wrdtbl.TableName:=workdir+'\database\lendings.db'; wrdtbl.active:=true; wrdtbl.Open; wrdtbl.first; while not wrdtbl.eof do begin wordApplication.selection.typetext(Text:=IntToStr(wrdtbl.FieldValues['MemberId'])+' leiht aus '+IntToStr(wrdtbl.FieldValues['BookId'])+' // Ausgabedatum: '+DateToStr(wrdtbl.FieldValues['Date'])); wordApplication.selection.typeParagraph; wrdtbl.next; end; wrdtbl.close; wrdtbl.Active:=false; wrdtbl.Free;
wordApplication.free; end;
exports exportLendings; begin end. |
bis11 - So 23.01.05 15:38
Ich muss nochmal nachschauen, aber vielleicht hilft Dir dieser Tipp, hast Du mal nachgeschaut ob Du vielleicht nicht unter Uses eine Unit vergessen hast ? Probiere mal diese beiden Units in der Uses Klausel aus OleServer, WordXP. Wobei die Unit WordXP abweichen kann, genachdem, welches Office Du installiert hast.
cscp - So 23.01.05 16:10
hmm wenn ich das wordapplication.free weglasse und das programm nicht in delphi laufen lasse dann läufts problemlos...
in delphi kommt aber: es traten zu viele exceptions auf... das macht mir angst... noch irgendne idee?
ase - Do 27.01.05 16:17
Nimm mal die Unit ShareMem raus.
-EN
Entwickler-Ecke.de based on phpBB
Copyright 2002 - 2011 by Tino Teuber, Copyright 2011 - 2026 by Christian Stelzmann Alle Rechte vorbehalten.
Alle Beiträge stammen von dritten Personen und dürfen geltendes Recht nicht verletzen.
Entwickler-Ecke und die zugehörigen Webseiten distanzieren sich ausdrücklich von Fremdinhalten jeglicher Art!