表生成器
富文本格式(RTF)是微软在1982年开发的一种高级文本格式。RTF通常用于创建电子书,不太常见的文档。最初,这种格式的目的是创建一个便于使用图书和文档的文件。这是通过内置的meta标签完成的,它允许您快速浏览文档。
这种格式是很容易访问的。此外,Windows通常包含一个DLL来呈现和显示RTF。
从Delphi和Lazarus以RTF格式保存的三种典型方法
1、可以自己生成RTF文件。维基百科中有一个简单的RTF文本的可爱例子:
{rtf1ansi{fonttblf0fswiss Helvetica;}f0pardThis is some {b bold} text.par}
3、当然,使用FastReport是最好的方法!毕竟,不仅需要制作“任何” RTF(通常需要使用数据,不同的对象),而且这里有许多FastReport工具可以帮助我们不仅创建格式化的文本和表格,还可以插入插图,条形码,图形,指示器,图形基元等。
在Delphi中创建RTF,而无需编写任何代码!
因此,编译项目并使用“导出到RTF”组件实现FastReport。生成 告,启动它,然后在预览窗口中单击“保存”。然后从预览中调用导出(下面我将描述如何使用Delphi代码以RTF格式保存)。出现导出到RTF设置的窗口。


我们可以选择将文档的哪些页面发送到Excel,某些页面或某个范围。
导出设置——是否将图片插入到RTF中,设置与原始版本更好的视觉对应(WYSIWYG)和使用分页符。还可以在每个页面上重复列标题。
RFT是——种逐页的文本格式,当然,它支持页眉和页脚。可以在结果文档中设置页眉和页脚的导出(是将它们导出为页眉和页脚、文本还是将它们从文件中排除)。
导出后打开——生成的文件将在与RTF文件关联的任何软件导出后立即打开。

与往常一样,可以指定将RTF文件保存在何处(在本地存储中,以电子邮件发送,上传到FTP或云存储)。
直接从Delphi / Lazarus以RTF格式保存的代码
procedure TForm1.Button1Click(Sender: TObject);begin {Generate a report. The report must be generated before exporting} frxReport1.PrepareReport(); {Set the range of pages to export. By default, all pages of the generated report are exported} frxRTFExport1.PageNumbers := '2-3'; {Set whether to export pictures} frxRTFExport1.ExportPictures := True; {Set whether to export the page breaks so that when printing the pages correspond to the pages of the generated report} frxRTFExport1.ExportPageBreaks := True; {Set whether to generate a continuous document which skips headers and footers.} frxRTFExport1.SuppressPageHeadersFooters := True; {Set WYSIWYG} frxRTFExport1.Wysiwyg := True; {Set export mode for page headers and footers hfText – as text; hfPrint – as headers and footers. SuppressPageHeadersFooters is automatically set to True; hfNone - skip} frxRTFExport1.HeaderFooterMode := hfText; {Set whether to open the resulting file after export} frxRTFExport1.OpenAfterExport := False; {Set whether to display export progress (show which page is currently being exported)} frxRTFExport1.ShowProgress := False; {Set whether to display the export filter dialog box} frxRTFExport1.ShowDialog := False; {Set the name of the resulting file.} {Please note that if you do not set the file name and disable the export filter dialog box,} {the file name selection dialog will still be displayed} frxRTFExport1.FileName := 'C:Outputtest.rtf'; {Export the report} frxReport1.Export(frxRTFExport1);end;
Fastreport在线购买价更低!赶紧加入购物清单吧!
还想要更多吗可以点击阅读【FastReport 表2020最新资源盘点】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入FastReport技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!