Rp2 mit Unicode

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

MSZoll
Posts: 8
Joined: Fri Jan 19, 2018 8:31 am

Rp2 mit Unicode

Post by MSZoll »

Hallo,
Ich habe meine Vo in XSharp übernommen und muß jetzt Unicode nutzen,
hat wer einen Plan, wie ich einfach in RP2 Unicode nutzen kann?
Oder gibt es eine genauso einfachen Report-Generator mit DBF der Unicode kann?
LG Michael
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Rp2 mit Unicode

Post by wriedmann »

Hallo Michael,

mit RP2 dürfte das nicht so einfach funktionieren, da intern ANSI-basierte Windows-API-Aufrufe genutzt werden.

Leider kann ich Dir auch keinen Report-Generator nennen, der DBF und Unicode unterstützt, und ich habe meine Zweifel, ob es sowas überhaupt gibt.
Aber an und für sich ist das DBF-Format doch auch nicht Unicode-fähig.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
MSZoll
Posts: 8
Joined: Fri Jan 19, 2018 8:31 am

Rp2 mit Unicode

Post by MSZoll »

Hallo Wolfgang,
Ich habe unicode mit dbf mit code64 umgesetzt,
Das funktioniert wunderbar.
Wie könnt ich am einfachsten einen normalen
Druck programmieren?
Gruss Michael
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Rp2 mit Unicode

Post by wriedmann »

Hallo Michael,

da hast Du einen Sonderweg gefunden, den vermutllich kein Tool so von Haus aus unterstützen dürfte.
Phil Hepburn hat Artikel drüber geschrieben, wie man mit .NET Bordmitteln das Drucken angehen kann: http://enotes.xsharp.it/enotes/ReportsNPrinting_81b.chm

Ansonsten fällt mir nur ein Drucktool ein, das die Datenbeschaffung komplett dem Programmierer überlässt: List&Label. Ist nicht ganz billig, aber doch leistungsfähig.

Ich habe meinen eigenen Reportwriter geschrieben, der aber VPE von Ideal Software nutzt. Daher bin ich, was Drucken betrifft, vielleicht nicht ganz die richtige Person.

Ich würde mal warten, ob sich vielleicht Robert dazuzmeldet und eine Lösung für ReportPro hat.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Rp2 mit Unicode

Post by robert »

Wolfgang, Michael,

When the fields are specially encoded in the DBF with Base64 encoding you need at least to manually decode that.
W.r.t. ReportPro and Unicode:
- RP2 and RP3 are programmed against ANSI API Calls. They both use an ANSI UI Layer (VO GUI for RP2 and Classmate GUI for RP3).
Once we have a new VO compatible UI based on winforms I will have a look at how much work it is to migrate the RP2 reporting code (which uses DrawText, DrawLine and similar API calls) to Windows Forms.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
MSZoll
Posts: 8
Joined: Fri Jan 19, 2018 8:31 am

Rp2 mit Unicode

Post by MSZoll »

Hello Robert,
Could you tell me the way to Decode manualy within rp2?
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Rp2 mit Unicode

Post by robert »

Michael,
How are you encoding ?
I would replace the access to the field (Alias.FieldName) with an expression MyDecode(Alias.FieldName).
To allow that in the designer you need to create a UDF library.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
MSZoll
Posts: 8
Joined: Fri Jan 19, 2018 8:31 am

Rp2 mit Unicode

Post by MSZoll »

Hello Robert,
I use for Encode / Decode the following:
PUBLIC PARTIAL CLASS WindlgEingabe ;
INHERIT System.Windows.Forms.Form

PRIVATE editText := "" AS STRING
public property Editedtext as string
get
var bytes := Encoding.Unicode:GetBytes(editText)
var base64 := Convert.ToBase64String(bytes)
return base64
end get
set
try
var bytes := System.Convert.FromBase64String(value)
editText := Encoding.Unicode:GetString(bytes)
editor:Text := editText
catch
editor:Text := value
end try
end set
end property
User avatar
robert
Posts: 4225
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Rp2 mit Unicode

Post by robert »

Michael,
So you need to create a function that does the same. Something like

Code: Select all

FUNCTION MyBase64Decode(cSource AS STRING) AS STRING
VAR bytes := System.Convert.FromBase64String(cSource )
RETURN Encoding.Unicode:GetString(bytes)
Create a RP UDF DLL and include this function in this DLL and in your report use something like this as expression for a field:
MyBase64Decode(Client.LastName)

The only problem that I see is that when the decoded field contains a character that is not in your current codepage. This character will be displayed as a question mark (?) in the ansi output of ReportPro.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
MSZoll
Posts: 8
Joined: Fri Jan 19, 2018 8:31 am

Rp2 mit Unicode

Post by MSZoll »

Hallo Robert,
I have now build a new class to do This:
and use it in my program with:

var winBase64 := UMS_Base64{}
winBase64:Editedtext := RTrim (self:owner:server:FIELDGET (#REF_NR))
oDCsleREF_NR:value := winBase64:Editedtext


USING System
USING System.Collections.Generic
USING System.Text

CLASS UMS_Base64

PRIVATE editText := "" AS STRING
public property Editedtext as string
get
var bytes := Encoding.Unicode:GetBytes(editText)
var base64 := Convert.ToBase64String(bytes)
return base64
end get
set
try
var bytes := System.Convert.FromBase64String(value)
editText := Encoding.Unicode:GetString(bytes)
catch
editText := value
end try
end set
end property

CONSTRUCTOR()
RETURN

END CLASS
Post Reply