https://bz.apache.org/ooo/show_bug.cgi?id=127726
Issue ID: 127726
Issue Type: DEFECT
Summary: MailMerge - "Failed to savetemporary file" exception
Product: App Dev
Version: 4.1.5
Hardware: PC
OS: All
Status: UNCONFIRMED
Severity: Critical
Priority: P5 (lowest)
Component: scripting
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 86361
--> https://bz.apache.org/ooo/attachment.cgi?id=86361&action=edit
Error message as shown in script editor
When running a MailMerge command using a Basic script such as this I most times
get the 'Failed to savetemporary file' error/exception on the .execute() call:
sub teste
doMerge "MERGES",
"D:\pedro\Avetmiss\3.0\server-install\deploy\TemplatesOL\DataSource\MERGES.odb",
"LETTER",
"file:///D:/pedro/Avetmiss/3.0/server-install/deploy/TemplatesOL/Letter/letter_template.odt"
end sub
Sub doMerge(dbAlias as string, dbPath as String, table as String, template as
string)
Dim mm as Object
dim conn as Object
dim oDC as Object
template = ConvertToURL(template)
oDC = createUnoService("com.sun.star.sdb.DatabaseContext")
if (not oDC.hasRegisteredDatabase(dbAlias)) then
oDC.registerDatabaseLocation(dbAlias, ConvertToURL(dbPath))
if (not oDC.hasRegisteredDatabase(dbAlias)) then
MsgBox("Datasource '" & dbAlias & "' is nod defined.")
exit sub
end if
end if
mm = CreateUnoService("com.sun.star.text.MailMerge")
Dim mergedDoc
With mm
.DocumentURL = template
.DataSourceName = dbAlias
.Command = table
.CommandType = 0
.OutputType = 2 ' 1=printer 2=file
.OutputUrl = "file:///C:/temp/" 'Having selected output to
file we choose the url of the result files
.FileNamePrefix = dbAlias & "_"
.SaveFilter = "writer_pdf_Export" ' use this to get an ODT instead:
"writer8"
'.SaveFilter = "writer8" '
.SaveAsSingleFile = True
mergedDoc = .OutputUrl & .FileNamePrefix & "0.pdf"
If FileExists(mergedDoc) Then
Kill(mergedDoc)
end if
if (.execute(Array())) then
'use this to open with OpenOffice
'StarDesktop.loadComponentFromURL(mergedDoc, "_blank", 0,
Array())
Dim oSvc as object
oSvc =
createUnoService("com.sun.star.system.SystemShellExecute")
oSvc.execute(mergedDoc, "", 0)
end if
.dispose()
end with
End Sub
Please not I have run this from a Delphi project too (using COM automation) and
have exactly the same error. All paths exist and are valid and I noticed it
uses the environmnet %temp% directory to write some temp files and this seems
to be the issue.
Would love to see this fixed...
Cheers,
Pedro
--
You are receiving this mail because:
You are the assignee for the issue.