FastReport 能不能打印角注

jspxnet 2006-05-02 06:53:32
有些化学元素要打印,比如 H2O (小2) 这样的如何打印
...全文
242 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jspxnet 2006-05-04
  • 打赏
  • 举报
回复
只能放在frxRichObject中吗?我想放在 Cross1 中,
或者能把 Cross1 表格中的内容替换成frxRichObject吗?
jspxnet 2006-05-03
  • 打赏
  • 举报
回复
就是 string 类型
jspxnet 2006-05-03
  • 打赏
  • 举报
回复
在数据库中就是 H2O 不过我想打印的时候替换成我想要的元素符号。
fastreport 3.20
jspxnet 2006-05-03
  • 打赏
  • 举报
回复
up
CACACACACA 2006-05-03
  • 打赏
  • 举报
回复
/************************************************************
如何在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
CACACACACA 2006-05-03
  • 打赏
  • 举报
回复
//---------------------------------------------------------------------------

#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
CACACACACA 2006-05-03
  • 打赏
  • 举报
回复
//---------------------------------------------------------------------------

#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) );
}
}
}
}
CACACACACA 2006-05-02
  • 打赏
  • 举报
回复
另外,H2O在数据库是如何存储的. 用CHAR还是别的方式.
CACACACACA 2006-05-02
  • 打赏
  • 举报
回复
fastreport版本?

1,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 数据库及相关技术
社区管理员
  • 数据库及相关技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧