I need to save reports in Word (RTF) format. The reports have images that are critical to the final product. I'm saving in "Advanced RTF" mode, as it formats better than "Full RTF". The reports work perfectly in V11 developer version. But when I open the shadow database with the runtime version, my report images are missing and some of the formatting is off. I think it's printing in "Formatted Text" mode.
I am currently using V11 developer and V12 runtime. Of course, the shadow database has been refreshed, etc. Did I miss something?
The print code follows:
' Report production:
'--------------------
t = table.current()
'''''''''''''''''''DIM GLOBAL vLayout as C = "PrintEndorsements"
DIM GLOBAL vReport_name as C
DIM GLOBAL vLayout as C
dim global vsavename as C = t.INVOICENBR
var->vLayout = var->vreport_name
if vReport_name <> ""
record_number = current_record_number()
query.filter = "recno() = " + record_number
query.order = ""
end if
A5.Get_Path()
Trace.clear()
Dim Global vNetwork as L
Dim Global vLocal as L
DIM GLOBAL vReport_name as C 'to use in the file name
DIM GLOBAL vAcct_no as C
DIM GLOBAL vBasepath as C
DIM GLOBAL vLocalpath as C
DIM GLOBAL vNetpath as C
DIM vLocalDrive as C
DIM GLOBAL vNetDrive as C
Dim GLOBAL vPath as C
DIM vFilename as C
DIM GLOBAL vLayout as C 'the actual layout name
DIM Global vLocalDir as C
DIM Global vNetDir as C
query.filter = ""
query.order = ""
var->vPath=""
var->vBasePath = A5.Get_Path()
vLocalDir=""
vNetDir=""
''If empty get vBasepath from defaults table as this is the first run of the script
''If not null script has already run so use selected path
t=table.open("defaults",FILE_RO_SHARED)
t.fetch_first()
while .not. t.fetch_eof()
if t.Active = .T. then
vNetDrive = alltrim(t.Net_drive)
vLocalDrive = alltrim(t.Local_Drive)
'---------
vLocalpath = alltrim(t.Local_path)
vNetpath = alltrim(t.Net_path)
'---------
vReport_name = t.Report_name
END if
t.fetch_next()
END While
t.close()
trace.WriteLn("vBasePath=" + var->vBasePath)
trace.WriteLn("----------------------")
trace.WriteLn("vnetdrive=" + var->vNetDrive)
trace.WriteLn("vlocaldrive=" + var->vLocalDrive)
trace.WriteLn("vLocalpath=" + var->vLocalpath)
trace.WriteLn("vNetpath=" + var->vNetpath)
trace.WriteLn("vReport_name=" + vReport_name)
var->vLocalDir = alltrim(var->vLocalDrive) + alltrim(var->vLocalpath)+ Chr(92) + alltrim(vReport_name)
trace.WriteLn("vLocalDir=" + vLocalDir)
var->vNetDir = alltrim(var->vNetDrive) + alltrim(var->vNetpath) + Chr(92) + alltrim(vReport_name)
trace.WriteLn("vNetDir=" + vNetDir)
result = file.exists(var->vLocalDir)
if result = .f. THEN
dir_create (var->vLocalDir)
ui_msg_box("Note", "Upload Directory Created")
else
'ui_msg_box("Note", "Upload Directory Already Exists")
end if
If alltrim(vPath) = "" then ' get it from the defaults table
vPath = vLocalDrive + var->vLocalpath
end if
vFilename = vPath+ Chr(92)+alltrim(vendnum)+" "+ alltrim(Endorsement_Select.endorsement_name)+".rtf"
trace.WriteLn("vFilename=" + vFilename)
vFilename = ui_get_file("Save file as","Word *.rtf",vFilename,"f")
delete PrintOptions
DIM PrintOptions as P
With PrintOptions
.MultilingualSupport = .f.
.Colors2GrayScale = .f.
.RTFType = "Advanced RTF"
.JpegQuality = "Medium"
End with
''Print report to Word RTF
report.saveas(vlayout,"RTF","","",vFilename,.f.,PrintOptions)
I am currently using V11 developer and V12 runtime. Of course, the shadow database has been refreshed, etc. Did I miss something?
The print code follows:
' Report production:
'--------------------
t = table.current()
'''''''''''''''''''DIM GLOBAL vLayout as C = "PrintEndorsements"
DIM GLOBAL vReport_name as C
DIM GLOBAL vLayout as C
dim global vsavename as C = t.INVOICENBR
var->vLayout = var->vreport_name
if vReport_name <> ""
record_number = current_record_number()
query.filter = "recno() = " + record_number
query.order = ""
end if
A5.Get_Path()
Trace.clear()
Dim Global vNetwork as L
Dim Global vLocal as L
DIM GLOBAL vReport_name as C 'to use in the file name
DIM GLOBAL vAcct_no as C
DIM GLOBAL vBasepath as C
DIM GLOBAL vLocalpath as C
DIM GLOBAL vNetpath as C
DIM vLocalDrive as C
DIM GLOBAL vNetDrive as C
Dim GLOBAL vPath as C
DIM vFilename as C
DIM GLOBAL vLayout as C 'the actual layout name
DIM Global vLocalDir as C
DIM Global vNetDir as C
query.filter = ""
query.order = ""
var->vPath=""
var->vBasePath = A5.Get_Path()
vLocalDir=""
vNetDir=""
''If empty get vBasepath from defaults table as this is the first run of the script
''If not null script has already run so use selected path
t=table.open("defaults",FILE_RO_SHARED)
t.fetch_first()
while .not. t.fetch_eof()
if t.Active = .T. then
vNetDrive = alltrim(t.Net_drive)
vLocalDrive = alltrim(t.Local_Drive)
'---------
vLocalpath = alltrim(t.Local_path)
vNetpath = alltrim(t.Net_path)
'---------
vReport_name = t.Report_name
END if
t.fetch_next()
END While
t.close()
trace.WriteLn("vBasePath=" + var->vBasePath)
trace.WriteLn("----------------------")
trace.WriteLn("vnetdrive=" + var->vNetDrive)
trace.WriteLn("vlocaldrive=" + var->vLocalDrive)
trace.WriteLn("vLocalpath=" + var->vLocalpath)
trace.WriteLn("vNetpath=" + var->vNetpath)
trace.WriteLn("vReport_name=" + vReport_name)
var->vLocalDir = alltrim(var->vLocalDrive) + alltrim(var->vLocalpath)+ Chr(92) + alltrim(vReport_name)
trace.WriteLn("vLocalDir=" + vLocalDir)
var->vNetDir = alltrim(var->vNetDrive) + alltrim(var->vNetpath) + Chr(92) + alltrim(vReport_name)
trace.WriteLn("vNetDir=" + vNetDir)
result = file.exists(var->vLocalDir)
if result = .f. THEN
dir_create (var->vLocalDir)
ui_msg_box("Note", "Upload Directory Created")
else
'ui_msg_box("Note", "Upload Directory Already Exists")
end if
If alltrim(vPath) = "" then ' get it from the defaults table
vPath = vLocalDrive + var->vLocalpath
end if
vFilename = vPath+ Chr(92)+alltrim(vendnum)+" "+ alltrim(Endorsement_Select.endorsement_name)+".rtf"
trace.WriteLn("vFilename=" + vFilename)
vFilename = ui_get_file("Save file as","Word *.rtf",vFilename,"f")
delete PrintOptions
DIM PrintOptions as P
With PrintOptions
.MultilingualSupport = .f.
.Colors2GrayScale = .f.
.RTFType = "Advanced RTF"
.JpegQuality = "Medium"
End with
''Print report to Word RTF
report.saveas(vlayout,"RTF","","",vFilename,.f.,PrintOptions)
Comment