procedure TForm1.btnExportClick(Sender: TObject);
var vSvcMgr, vDesktop, vEmptyParam, vDoc, vSaveParams,
vCoreReflection, vPropertyValue:OleVariant;
sFileName:
String;
begin
vEmptyParam:=VarArrayCreate([0, -1], varVariant);
vSvcMgr:=CreateOleObject(‘
com.sun.star.ServiceManager’);
vDesktop:=vSvcMgr.createInstance(‘
com.sun.star.frame.Desktop’);
vDoc:=vDesktop.LoadComponentFromURL(‘
private:factory/swriter’,’_blank’,0, vEmptyParam);
vsaveParams := VarArrayCreate([0, 0], varVariant);
vCoreReflection := vSvcMgr.createInstance(‘
com.sun.star.reflection.CoreReflection’);
vCoreReflection.forName(‘
com.sun.star.beans.PropertyValue’).createObject(vPropertyValue);
vPropertyValue.
Name := ‘FilterName’;
vPropertyValue.Value := ‘MS Word 97’;
vsaveParams[0] := vPropertyValue;
if SaveDialog1.Execute
then begin
sFileName:= KonvFileName(SaveDialog1.FileName);
vDoc.storeAsUrl(sFileName, vsaveParams);
end;
end;