PDA

View Full Version : how to say CR that a specific file.field is in ANSI and not OEM ?



Fred
17-Oct-2005, 08:44 AM
Because of accentuated characters in french and german, a field after a
ToAnsi function looks very bad at printing. I can't find in Crystal Report
where I can say that the value of a field is OEM or ANSI !?

The VDF database is OEM based and the euro sign is not supported, which is
really unacceptable 3 years later ! So what I'am trying to do is to use a
temporary printing file which fields are in ANSI character mode to accept
printing the euro sign (Alt+0128) in them. But I can't make it work
correctly in Crystal ...

Has somebody an idea how to make this ?

Regards

Frédéric THOMAS
Eicher B.C. (Belgique)

Baz
17-Oct-2005, 07:04 PM
Hi Fred,
mebbe a free font for it will help?

http://www.adobe.co.uk/type/eurofont.html

Baz.

Peter van Mil
18-Oct-2005, 02:53 AM
Fred,

I don't use Crystal Reports, yet. (I will use CR XI and RDC).
CrystalReport.pkg contains many ToAnsi functions. If you have an ANSI
string, just don't use ToAnsi anymore.

Procedure Set ReportTitle String sTitle
Integer iPrintJob iResult
Get PrintJob To iPrintJob
Move (ToANSI(sTitle+Character(0))) To sTitle
Move (PESetReportTitle(iPrintJob,sTitle)) To iResult
Send HandlePossibleError
End_Procedure // Set ReportTitle

You could try to cheat Chrystal:

Try to set the ReportTitle to "Test report with Ç". Maybe you get a €.

Peter van Mil




Fred Thomas schreef:
> Because of accentuated characters in french and german, a field after a
> ToAnsi function looks very bad at printing. I can't find in Crystal Report
> where I can say that the value of a field is OEM or ANSI !?
>
> The VDF database is OEM based and the euro sign is not supported, which is
> really unacceptable 3 years later ! So what I'am trying to do is to use a
> temporary printing file which fields are in ANSI character mode to accept
> printing the euro sign (Alt+0128) in them. But I can't make it work
> correctly in Crystal ...
>
> Has somebody an idea how to make this ?
>
> Regards
>
> Frédéric THOMAS
> Eicher B.C. (Belgique)
>
>
>
>

Fred
20-Oct-2005, 03:00 AM
It seems that it works just by choosing "RTF" or "HTML" interpretation, but
the problem is that all accentuated characters looks very bad with crazy
characters ... !? So I'am searching for a function wich mades a CORRECT
conversion, not like the ToAnsi function (for example, the "e grave" Alt+138
must give Alt+0232 in Ansi and not Alt+0138 !!!)

Fred

Peter van Mil
20-Oct-2005, 05:27 AM
Fred,

I don't have the time (at this moment) to make a working example. I did
a little experiment with the Report_Title of Crystal with VDF11.0 and
the old order entry sample.

I managed to get the euro sign in the Report title by removing some
ToOem and ToAnsi functions. (Seeing is believing). See screen shot and
reportview.

I has to be possible to use the same kind of trics to print the euro
sign with file.fiels. Don't use any translation and use (Character0128))
to insert or replace the euro sign.

Regards,

Peter van Mil


P.S.: DAW convinced me that ANSI or Unicode support isn't easy. If that
isn't possible on the short term, we have to find some trics to get the
desired end results.


Fred Thomas schreef:
> It seems that it works just by choosing "RTF" or "HTML" interpretation, but
> the problem is that all accentuated characters looks very bad with crazy
> characters ... !? So I'am searching for a function wich mades a CORRECT
> conversion, not like the ToAnsi function (for example, the "e grave" Alt+138
> must give Alt+0232 in Ansi and not Alt+0138 !!!)
>
> Fred
>
>
>


//AB/ Project Print Orders (Crystal)
//AB/ Object prj is a Report_Project
//AB/ Set Size to 138 217
//AB/ Set ProjectName to "Print Orders (Crystal)"
//AB/ Set ProjectFileName to "OrdrRpt1.rv"

// Project Object Structure
// oOrdrRpt1 is a ReportView
// oDestinationGroup is a RadioGroup
// oScreenRadio is a Radio
// oPrinter is a Radio
// oPrintButton is a Button
// oCancelButton is a Button
// oCrystalOrdrRpt1 is a CrystalReport

// Register all objects
Register_Object oCancelButton
Register_Object oCrystalOrdrRpt1
Register_Object oDestinationGroup
Register_Object oOrdrRpt1
Register_Object oPrintButton
Register_Object oPrinter
Register_Object oScreenRadio


//AB-StoreTopStart
Use DfAllRpt.pkg
//AB-StoreTopEnd

//AB-IgnoreStart
Use dfrptvw.pkg
Use dfRadio.pkg
Use Windows.pkg
//AB-IgnoreEnd


DEFERRED_VIEW Activate_oOrdrRpt1 FOR ;
;
Object oOrdrRpt1 is a ReportView

//AB-StoreTopStart

//AB-StoreTopEnd

Set Label to "Print Orders (Crystal)"
Set Location to 6 6
Set Size to 100 185

//AB-DDOStart


//AB-DDOEnd

Object oDestinationGroup is a RadioGroup
Set Size to 47 125
Set Location to 7 27
Set Label to "Output Destination"
Object oScreenRadio is a Radio
Set Label to "Preview"
Set Size to 10 42
Set Location to 15 18
Set Status_Help to "Preview the report to screen"
End_Object // oScreenRadio

Object oPrinter is a Radio
Set Label to "Printer"
Set Size to 10 37
Set Location to 30 18
Set Status_Help to "Send the report to the default printer"
End_Object // oPrinter


//AB-StoreStart

// Function : PrintDestination
// Purpose : This function returns the number of the selected destination radio.

Function PrintDestination Returns Integer
Integer iCurrentRadio
Get Current_Radio to iCurrentRadio
Function_Return iCurrentRadio
End_Function // PrintDestination
//AB-StoreEnd

End_Object // oDestinationGroup

Object oPrintButton is a Button
Set Label to "Print"
Set Location to 61 27
Set Status_Help to "Print the report"
Set Default_State to TRUE

//AB-StoreStart

// Procedure : OnClick
// Purpose : This procedure outputs the report by sending Run_Report.

Procedure OnClick
Send Run_Report of oCrystalOrdrRpt1
End_Procedure // OnClick

//AB-StoreEnd

End_Object // oPrintButton

Object oCancelButton is a Button
Set Label to "Cancel"
Set Location to 61 103
Set Status_Help to "Cancel this Panel"

//AB-StoreStart

// Procedure : OnClick
// Purpose : This procedure closes the view.

Procedure OnClick
Send Close_Panel
End_Procedure // OnClick

//AB-StoreEnd

End_Object // oCancelButton


//AB-StoreStart

// Function : PrintDestination
// Purpose : This function returns the number of the selected destination radio.

Function PrintDestination Returns Integer
Integer iDest
Get PrintDestination of oDestinationGroup to iDest
Function_Return iDest
End_Function // PrintDestination

// Object : oCrystalOrdrRpt1
// Purpose : This object handles the connection to Crystal.

Object oCrystalOrdrRpt1 Is A CrystalReport
Set Report_Name To "order1.rpt"
Set Report_View_Id To (Parent(Self))

// Procedure : OnInitializeReport
// Purpose : This is a hook message sent by the Open_report procedure. You may use this
// procedure to set selection values, print options, etc. This procedure is
// intended for augmentation; it has no action by default.

//////// TEST TEST TEST
//Doc/ Type=Property Interface=Public
Function ReportTitle Returns String
Integer iPrintJob iResult iTextHandle iTextLength
String sPETextStructure sReturn
Pointer pPETextStructure pReturn
Get PrintJob To iPrintJob
FillType PETextStructure With 0 To sPETextStructure
GetAddress Of sPETextStructure To pPETextStructure
Move (PEGetReportTitle(iPrintJob,pPETextStructure,pPETe xtStructure+4)) To iResult
Send HandlePossibleError
GetBuff From sPETextStructure At PETextStructure.textHandle To iTextHandle
GetBuff From sPETextStructure At PETextStructure.textLength To iTextLength
If iTextLength Gt 255 Move 255 To iTextLength
Move (Repeat(Character(0),255)) To sReturn
GetAddress Of sReturn To pReturn
Move (PEGetHandleString(iTextHandle,pReturn,iTextLength )) To iResult
Send HandlePossibleError
///////////// Function_Return (ToOEM(cString(sReturn)))

Function_Return (cString(sReturn)) // PvM
End_Function // ReportTitle

//Doc/ Type=Property Interface=Public
Procedure Set ReportTitle String sTitle
Integer iPrintJob iResult
Get PrintJob To iPrintJob
/////////// Move (ToANSI(sTitle+Character(0))) To sTitle
Move (sTitle+Character(0)) To sTitle
Move (PESetReportTitle(iPrintJob,sTitle)) To iResult
Send HandlePossibleError
End_Procedure // Set ReportTitle

//Doc/ Interface=Public
Procedure OutputToWindow String sTitle Integer iLeft Integer iTop Integer iWidth ;
Integer iHeight Integer iStyle Handle hParent
Integer iPrintJob iResult
Get PrintJob To iPrintJob
/////////////////////// Move (ToANSI(sTitle+Character(0))) To sTitle
Move (sTitle+Character(0)) To sTitle
Move (PEOutputToWindow(iPrintJob,sTitle,iLeft,iTop,iWid th,iHeight,iStyle,hParent)) To iResult
Send HandlePossibleError
Send StartPrintJob True
End_Procedure // OutputToWindow


///////// TEST TEST TEST


Procedure OnInitializeReport

// Handle the destination settings.
Set ReportTitle to ("Test with " * Character(128))

Integer iDestination
Get PrintDestination To iDestination
If (iDestination=0) Set Output_Destination To CRW_PRINT_TO_WINDOW
If (iDestination=1) Set Output_Destination To CRW_PRINT_TO_PRINTER

End_Procedure // OnInitializeReport

End_Object // oCrystalOrdrRpt1

//AB-StoreEnd

CD_End_Object // oOrdrRpt1


//AB-StoreStart

//AB-StoreEnd

//AB/ End_Object // prj