如何打印Access数据库中的Unicode字符!(高分悬赏急救!)(200分)

  • 主题发起人 seawater
  • 开始时间
S

seawater

Unregistered / Unconfirmed
GUEST, unregistred user!
小弟有一中文WinXp下的系统,其中一个表一个字段为中文、一个字段为葡萄牙文!
我需要把这个报表打印出来,但葡萄牙文就是打不出!兄弟我要怎么办!
我用的是Report Builder做的,如果在设计期使用ppRichText设计ppRichText.richtext则正常。
但如果是打印数据表中的内容(有个ppDbRichText),则葡萄牙文不能正常打印!我用ppRichText也不行!
ppRichText在程序运行时,能从RTF文档中读入葡萄牙文,并且能正常打印,但却不能从TXT文档中读入葡萄牙
文,虽然在文件是以Unicode存储的,并且在NotePad里也也能正常地显示!
哞,兄弟我就是搞不明白,这边又急着又要交货!急啊!
 
我的QQ是27138698
 
字集问题…

 
不是字集问题,我试过了!其实不管哪种字集,只要我设为Default_charset就没问题了,
我在简体中文下如果要显示繁体字符,只要把字符集设为Default_charset就可以了!
并且我也试了一下,我输入士耳其文,然后把ppDbtext的字符集也设为士耳其字符,但就是不能
打印!
 
我知道你是谁了…
你老在表面上想:你想几天都都不出来的…,和这种人打工:真是………``
 
Delphi的VCL是不支持Unicode的,我查了很多!
后来我用一组叫TntUnicodeControls的控件就能解决输入和显示的问题了,但还是不能打印我就把QRLable改了一下
,我能修改它的Caption为Unicode字符了,但却显示不了! 我把代码贴出来,大家帮我改改!

unit QQRCustomLabel1;

interface

uses
Windows, Messages, SysUtils, Classes, Controls, QuickRpt, QRCtrls, Graphics,
TntControls,TntWideStrPropHelper;

type
TtntQRCustomLabel = class(TQRCustomLabel)
private
FSettingWideCaption: Boolean;
FCaption: TWideCaption;
function IsCaptionStored: Boolean;
procedure SetInheritedCaption(const Value: AnsiString);
procedure WMSetText(var Message: TWMSetText); message WM_SETTEXT;
function GetCaption: TWideCaption;
procedure SetCaption(const Value: TWideCaption);
procedure CMDialogChar(var Message: TCMDialogChar); message CM_DIALOGCHAR;
protected
procedure DefineProperties(Filer: TFiler); override;
procedure DoDrawText(var Rect: TRect; Flags: Longint); dynamic;
function GetLabelText: WideString; reintroduce; virtual;
property Caption: TWideCaption read GetCaption write SetCaption stored IsCaptionStored;
published

end;

TtntQRLabel = class(TtntQRCustomLabel)
private

protected

published
property Alignment;
property caption;
property AutoStretch;
property Color;
property Font;
property onprint;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Tnt', [TtntQRLabel]);
end;

procedure TtntQRCustomLabel.SetInheritedCaption(const Value: AnsiString);
begin
inherited Caption := Value;
end;

procedure TtntQRCustomLabel.WMSetText(var Message: TWMSetText);
begin
if not FSettingWideCaption then
FCaption := Message.Text;
inherited;
end;

procedure TtntQRCustomLabel.DoDrawText(var Rect: TRect; Flags: Longint);
var
Text: string;
begin
Text := GetLabelText;
if (Flags and DT_CALCRECT <> 0) and ((Text = '') and
(Text[1] = '&') and (Text[2] = #0)) then Text := Text + ' ';
// if not FShowAccelChar then Flags := Flags or DT_NOPREFIX;
Flags := DrawTextBiDiModeFlags(Flags);
Canvas.Font := Font;
if not Enabled then
begin
OffsetRect(Rect, 1, 1);
Canvas.Font.Color := clBtnHighlight;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
OffsetRect(Rect, -1, -1);
Canvas.Font.Color := clBtnShadow;
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
end
else
DrawText(Canvas.Handle, PChar(Text), Length(Text), Rect, Flags);
end;

function TtntQRCustomLabel.GetCaption: TWideCaption;
begin
Result := GetWideNonWinControlCaption(WideString(FCaption), inherited Caption);
end;

procedure TtntQRCustomLabel.SetCaption(const Value: TWideCaption);
begin
FSettingWideCaption := True;
try
SetWideNonWinControlCaption(Value, WideString(FCaption), inherited Caption, SetInheritedCaption);
finally
FSettingWideCaption := False;
end;
end;

procedure TtntQRCustomLabel.DefineProperties(Filer: TFiler);
begin
inherited;
DefineWideProperties(Filer, Self);
end;

function TtntQRCustomLabel.GetLabelText: WideString;
begin
result := Caption;
end;

function TtntQRCustomLabel.IsCaptionStored: Boolean;
begin
result := TntIsCaptionStored(Self)
end;

procedure TtntQRCustomLabel.CMDialogChar(var Message: TCMDialogChar);
begin
{ if (FocusControl <> nil) and Enabled and ShowAccelChar and
IsWideCharAccel(Message.CharCode, Caption) then
with FocusControl do
if CanFocus then
begin
SetFocus;
Message.Result := 1;
end; }
end;

end.
 
有哪位兄弟知道怎么将数据库中的字符写入RTF字符流吗?
 
楼主,你的打印弄好了么?
我也碰到困难了。。。
 
楼上的,知道是unicode的问题,但具体怎么解决呢?
 

Similar threads

D
回复
0
查看
847
DelphiTeacher的专栏
D
D
回复
0
查看
816
DelphiTeacher的专栏
D
D
回复
0
查看
891
DelphiTeacher的专栏
D
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
992
SUNSTONE的Delphi笔记
S
顶部