Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Crystal Reports with Office XP
Message
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00612908
Message ID:
00612937
Views:
19
It's an optional install when you install Word.

>>Crystal exports to an older version of Word. Sounds like you need to install the conversion template for Word.
>>
>
>Hello Craig,
>
>Thanks for answering.
>
>I'm not familiar with the converion template you mention.
>
>How would I go about finding out how to do this.?
>
>Here's the code I'm using:
>
>***hsfrmmaresbooked.m_toword()
>wait window at 25,50 "Please be patient, creating report..." nowait
>*thisform.lockscreen = .t.
>local lc_word, lc_dbf, lc_crreport
>lc_dbf = fullpath("") + substr(sys(2015),3,10) + ".dbf"
>lc_word = fullpath("") + substr(sys(2015),3,10) + ".doc"
>lc_crreport = sys(5) + "\foxdat\crystalreports\cr_marebook.rpt"
>*********************
>with thisform.hscntmaresbooked
> with .hsoptpage
> if .option1.value = 1
> mreport = " hsrpmarebooknewpage "
> else
> mreport = " hsrpmarebook "
> endif
> endwith
>*********************
> with .hsoptcategory
> do case
> case .option1.value = 1
> mcategory = " category <> ' ' "
> case .option2.value = 1
> mcategory = " category = 'F' "
> case option3.value = 1
> mcategory = " category = 'O' "
> otherwise
> mcategory = " category <> ' ' "
> endcase
> endwith
>*********************
> with .hsoptorder
> do case
> case .option1.value = 1
> morder = " BOOKED_TO,NAME "
> case .option2.value = 1
> morder = " BOOKED_TO, accounts.lname_comp, accounts.fname, name "
> case .option3.value = 1
> morder = " name "
> case .option4.value = 1
> morder = " accountys.lname_comp, accounts.fname, name "
> case .option5.value = 1
> morder = " syn_mem.lname, syn_mem.fname, name "
> otherwise
> morder = " name "
> endcase
> endwith
>**************************
> if .hscmbstallions.value <> " "
> mbookedto = " booked_to = [" + alltrim(.hscmbstallions.value ) + "] "
> else
> mbookedto = " ! inlist(booked_to,'CANCEL','UNKNOW','RETIRE','SELL','DELETE',' ') "
> endif
>**************************
> myear = " yr_bred = " + str(.hslstyear.value)
>**************************
> select ;
> master.yr_foaled, ;
> master.p_b, ;
> master.last_bred, ;
> master.category, ;
> master.type, ;
> master.p_s_c, ;
> master.acct_no as acct_no, ;
> master.name, ;
> master.booked_to, ;
> master.yr_bred, ;
> master.syn_acct as syn_acct, ;
> master.age_rec, ;
> master.life_earn, ;
> master.sire1, ;
> master.dam1, ;
> iif(accounts.fname = " ",alltrim(accounts.lname_comp),alltrim(accounts.fname) + ;
> " " + alltrim(accounts.lname_comp)) as owner, ;
> iif(syn_mem.fname = " ",alltrim(syn_mem.lname),alltrim(syn_mem.fname) + ;
> " " + alltrim(syn_mem.lname)) as synmember ;
> from ;
> master ;
> left outer join ;
> accounts ;
> on master.acct_no = accounts.acct_no ;
> left outer join ;
> syn_mem ;
> on master.syn_acct = syn_mem.syn_acct ;
> where ;
> &mbookedto ;
> and ;
> &mcategory ;
> and ;
> &myear ;
> and ;
> type = "B" ;
> order by ;
> &morder ;
> into cursor sys(2015) noconsole
> copy to &lc_dbf type fox2x
> with thisform
> .r_crystalapp = createobject("crystalruntime.application")
> .r_crreport = .r_crystalapp.openreport(lc_crreport)
> .odatabase = .r_crreport.database
> .otables = .odatabase.tables
> .otable = .otables.item(1)
> .otable.location = lc_dbf
> .r_crreportoptions = .r_crreport.exportoptions
> with .r_crreportoptions
> .formattype = (14)
> .destinationtype = (1)
> .diskfilename = (lc_word)
> endwith
> .r_crreport.export(.f.)
> .otable = " "
> .otables = " "
> .odatabase = " "
> .r_crreport = " "
> .r_crystalapp = " "
> endwith
> erase(lc_dbf)
> oword = createobject("word.application")
> oword.visible = .t.
> oword.documents.open(lc_word)
> oword.selection.wholestory
> #define autoinchestopoint 72
> with oword.selection.pagesetup
> .orientation = 1
> endwith
> thisform.refresh
> messagebox("You may now edit your document." + chr(13) + "Please do a 'SAVE AS' in ;
>'Word' before continuing, otherwise your file will not be saved","'Save As' and Close 'Word'")
> on error do errtrap with error()
> oword.documents.close(0)
> oword.application.quit()
> erase(lc_word)
> on error
> with .hsoptcategory
> .option1.value = 0
> .option2.value = 0
> .option3.value = 0
> endwith
> with .hsoptorder
> .option1.value = 0
> .option2.value = 0
> .option3.value = 0
> .option4.value = 0
> .option5.value = 0
> endwith
> with .hsoptdestination
> .option1.value = 0
> .option2.value = 0
> .option3.value = 0
> endwith
> with .hsoptpage
> .option1.value = 0
> .option2.value = 0
> endwith
> .hschknotbred.value = 0
> .hslstyear.value = 0
> wait clear
>* thisform.lockscreen = .f.
>endwith
>thisform.refresh
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform