von Hago » Do, 06.03.2008 13:55
Hallo,
ich hab's inzwischen raus bekommen.
Christian Winter aus der Perl-Newsgroup hat's gewusst:
Code: Alles auswählen
use strict;
my $dir = ("-Pfad zu OO-Calc-");
my $file = "-Pfad zur DBF-Datei-";
my $enc = "IBMPC_850"; 'das ist der wesentliche Zeichensatz, den dBase verwendet
my @cmd = (
$dir."scalc.exe",
qq[macro:///Standard.Module1.openDBFwithEnc("$file","$enc")]
);
system( @cmd );
Im "Standard.Module1" braucht man dann dieses Makro mit der Funktion(auch von Christian Winter):
Code: Alles auswählen
Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
sub openDBFwithEnc( iFile As String, inputCharset As String )
' dim document as object
dim oDoc as object
inURL = ConvertToURL( "-Pfad zur DBF-Datei-" )
oDesk = createUNOService("com.sun.star.frame.Desktop")
oDoc = oDesk.loadComponentFromURL( inURL, "_blank", 0, Array(_
MakePropertyValue("FilterOptions", inputCharset),_
MakePropertyValue("FilterName", "dBase"),_
MakePropertyValue("Hidden", False) ) )
end sub
Vielleich interessiert es ja jemanden.
Gruß, Hago
Hallo,
ich hab's inzwischen raus bekommen.
Christian Winter aus der Perl-Newsgroup hat's gewusst:
[code]use strict;
my $dir = ("-Pfad zu OO-Calc-");
my $file = "-Pfad zur DBF-Datei-";
my $enc = "IBMPC_850"; 'das ist der wesentliche Zeichensatz, den dBase verwendet
my @cmd = (
$dir."scalc.exe",
qq[macro:///Standard.Module1.openDBFwithEnc("$file","$enc")]
);
system( @cmd );[/code]
Im "Standard.Module1" braucht man dann dieses Makro mit der Funktion(auch von Christian Winter):
[code]Function MakePropertyValue( Optional cName As String, Optional uValue ) As com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
sub openDBFwithEnc( iFile As String, inputCharset As String )
' dim document as object
dim oDoc as object
inURL = ConvertToURL( "-Pfad zur DBF-Datei-" )
oDesk = createUNOService("com.sun.star.frame.Desktop")
oDoc = oDesk.loadComponentFromURL( inURL, "_blank", 0, Array(_
MakePropertyValue("FilterOptions", inputCharset),_
MakePropertyValue("FilterName", "dBase"),_
MakePropertyValue("Hidden", False) ) )
end sub[/code]
Vielleich interessiert es ja jemanden.
Gruß, Hago