FastReport 能不能打印角注
有些化学元素要打印,比如 H2O (小2) 这样的如何打印 问题点数:100、回复次数:9Top
1 楼jjwwang((空园歌独酌,春日赋闲居))回复于 2006-05-02 21:49:01 得分 0
fastreport版本?Top
2 楼jjwwang((空园歌独酌,春日赋闲居))回复于 2006-05-02 22:01:19 得分 0
另外,H2O在数据库是如何存储的. 用CHAR还是别的方式.Top
3 楼CAYU(中原)回复于 2006-05-03 00:48:39 得分 0
在数据库中就是 H2O 不过我想打印的时候替换成我想要的元素符号。
fastreport 3.20Top
4 楼CAYU(中原)回复于 2006-05-03 00:54:44 得分 0
就是 string 类型Top
5 楼CAYU(中原)回复于 2006-05-03 12:40:36 得分 0
upTop
6 楼jjwwang((空园歌独酌,春日赋闲居))回复于 2006-05-03 22:18:51 得分 100
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <locale>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "frxADOComponents"
#pragma link "frxClass"
#pragma link "frxDBSet"
#pragma link "fs_icpp"
#pragma link "fs_iadortti"
#pragma link "fs_ipascal"
#pragma link "frxRich"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
frxReport1->ShowReport(true);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::frxReport1BeforePrint(TfrxReportComponent *Sender)
{
TfrxRichView *r;
r = dynamic_cast<TfrxRichView *>(Sender);
if( r!=NULL )
{
String s = r->RichEdit->Text.Trim();
if( !s.IsEmpty() && s.Length()>=2 )
for(int i=1; i<s.Length(); i++)
{
if( isdigit(s[i]) )
{
r->RichEdit->SelStart = i-1;
r->RichEdit->SelLength = 1;
TCharFormat Format;
Format.cbSize = sizeof(Format);
Format.dwMask = CFM_OFFSET;
Format.yOffset = -90;
Format.yHeight = 0;
r->RichEdit->Perform( EM_SETCHARFORMAT, SCF_SELECTION, Longint(&Format) );
}
}
}
}Top
7 楼jjwwang((空园歌独酌,春日赋闲居))回复于 2006-05-03 22:19:34 得分 0
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "frxADOComponents.hpp"
#include "frxClass.hpp"
#include "frxDBSet.hpp"
#include <ADODB.hpp>
#include <DB.hpp>
#include "fs_icpp.hpp"
#include "fs_iadortti.hpp"
#include "fs_ipascal.hpp"
#include "frxRich.hpp"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TfrxADOComponents *frxADOComponents1;
TfrxDBDataset *frxDBDataset1;
TButton *Button1;
TADOTable *ADOTable1;
TfsCPP *fsCPP1;
TfsPascal *fsPascal1;
TfsADORTTI *fsADORTTI1;
TMemo *Memo1;
TfrxRichObject *frxRichObject1;
TfrxReport *frxReport1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall frxReport1BeforePrint(TfrxReportComponent *Sender);
private:
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endifTop
8 楼jjwwang((空园歌独酌,春日赋闲居))回复于 2006-05-03 23:20:52 得分 0
/************************************************************
如何在FastReport中打印下标 (FastReport3.18)
风归叶
1.建个表.
CREATE TABLE [test]
(
[ID] [int] NULL ,
[hxys] [char] (20)
)
2.测试数据
insert into test values(1,H2O)
insert into test values(2,H2B3D5G3)
insert into test values(3,H2OY7U8OP2)
3.操作过程的简单描述:
双击frxReport1,加上MasterData(主数据项), 在Masterdata上再拖入一个frxMemoView和
RichText Object.
设置好frxMemoView的DataSet及DataField分别为ADOTable1和ID. 而RichText Ojbect不用
设置,但最好把字体设置大一些.(其它的请自行设置).
4. 为了大家(尤其是新手)的方便,请保留文档完整信息.
**************************************************************/
//CPP文件
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <locale>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "frxADOComponents"
#pragma link "frxClass"
#pragma link "frxDBSet"
#pragma link "fs_icpp"
#pragma link "fs_iadortti"
#pragma link "fs_ipascal"
#pragma link "frxRich"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
frxReport1->ShowReport(true);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::frxReport1BeforePrint(TfrxReportComponent *Sender)
{
TfrxRichView *r;
r = dynamic_cast<TfrxRichView *>(Sender);
if( r!=NULL )
{
r->RichEdit->Text = ADOTable1->FieldByName("hxys")->AsString;
String s = r->RichEdit->Text.Trim();
if( !s.IsEmpty() && s.Length()>=2 )
for(int i=1; i<s.Length()+1; i++)
{
if( isdigit(s[i]) )
{
r->RichEdit->SelStart = i-1;
r->RichEdit->SelLength = 1;
TCharFormat Format;
Format.cbSize = sizeof(Format);
Format.dwMask = CFM_OFFSET;
Format.yOffset = -90;
r->RichEdit->SelAttributes->Height = 10;
r->RichEdit->Perform( EM_SETCHARFORMAT, SCF_SELECTION, Longint(&Format) );
}
}
}
}
//---------------------------------------------------------------------------
//.H文件
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "frxADOComponents.hpp"
#include "frxClass.hpp"
#include "frxDBSet.hpp"
#include <ADODB.hpp>
#include <DB.hpp>
#include "fs_icpp.hpp"
#include "fs_iadortti.hpp"
#include "fs_ipascal.hpp"
#include "frxRich.hpp"
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TfrxADOComponents *frxADOComponents1;
TfrxDBDataset *frxDBDataset1;
TButton *Button1;
TADOTable *ADOTable1;
TfsCPP *fsCPP1;
TfsPascal *fsPascal1;
TfsADORTTI *fsADORTTI1;
TMemo *Memo1;
TfrxRichObject *frxRichObject1;
TfrxReport *frxReport1;
void __fastcall Button1Click(TObject *Sender);
void __fastcall frxReport1BeforePrint(TfrxReportComponent *Sender);
private:
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Top
9 楼CAYU(中原)回复于 2006-05-04 12:05:06 得分 0
只能放在frxRichObject中吗?我想放在 Cross1 中,
或者能把 Cross1 表格中的内容替换成frxRichObject吗?Top




