FastReport中国社区FastReport联系电话 联系电话:023-68661681

可视化报告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存图像

来源:   发布时间:2020-08-20   浏览:次

报表生成器FastReport VCL是用于在软件中集成商务智能的现代解决方案。它提供了可视化模板设计器,可以访问最受欢迎的数据源,报告引擎,预览,将过滤器导出为30多种格式,并可以部署到云,Web,电子邮件和打印中。

近日,FastReport VCL更新至v6.7,在新版本中,添加了对最新版本IDE的支持,简化了用于付款标准的条形码的创建,新增从预览窗口直接编辑RichView的功能,同时修复了多个Bug问题。欢迎下载体验。(点击下方按钮下载)

点击下载最新版FastReport VCL

我们先来看看有哪些光栅图像格式。

BMP

首先,你应该知道,由于BMP是一个老的图像格式,它不是很流行的互联网用户,只有位图图像保存在这种格式不支持向量。

bmp文件的大小可能不同,这取决于图像的质量。尽管用户认为BMP格式已经过时,但它在许多领域都被积极地使用。例如,所有的Windows界面都基于这种格式。为什么BMP呢?因为它是方便使用时,创建图像,不失去质量后,编辑他们。BMP是Photoshop中编辑图片时经常使用的格式,这种格式也很容易上传到社交网络和各种网站上。

当然,最好使用现代的图像格式,因为它们是多层次的,而且您可以将它们上传到任何网站而不存在技术问题。同时,有许多选项来编辑这些图像,它们有一个较小的文件大小。

JPEG

JPEG是存储图像的常用格式。它具有良好的压缩质量,可以观看图片。这种格式有很多好处,因为用户具有许多优点,例如:更改文件质量和大小的能力,在任何浏览器中轻松打开图像,在任何图形编辑器中编辑该文件以及较小的尺寸,在计算机和其他数据存储设备上不会占用太多空间。如果压缩不多,将完全保存图像质量。

这种格式有几个缺点:与PNG不同,没有透明度;如果压缩(调整大小)JPG图像,则其失真(或完全丢失)将非常明显;不建议在压缩后编辑恢复的JPG文件,因为它可能会降低质量。

尽管存在这些缺点,但该格式仍被认为是Internet上最受欢迎的格式,并且人们经常使用它。

TIFF

这是一种众所周知的栅格格式,几乎支持所有已知的色彩空间。未经压缩的图像几乎已成为印刷行业的标准。有多种压缩算法,甚至有或没有损失。TIFF文件可以包含以索引颜色模式以及灰度存储在CMYK,RGB,Lab颜色模型中的图像。这允许使用这种格式来存储各种图像,用于准备Web图形和版式。除图像本身外,TIFF还包含透明通道,通过它们可以保存图像的透明区域或在工作会话之间突出显示对象。

TIFF格式的另一个功能是能够将多个具有各自属性和属性(标签)的图像保存在一个文件中。尽管TIFF没有创建动画图像的功能,但这使其类似于GIF。这种格式的普及使得在程序和硬件平台之间轻松传输图像成为可能。

GIF

GIF文件尺寸较小,并且支持简单的动画,即在一个文件中更改帧。

GIF格式广泛用于创建横幅以及视频内容的图形外壳。主要优点是数据压缩在多达256色的深度处不会明显损失质量。动画图像包括许多静态帧以及有关帧演示所需时间的数据。

人们在许多领域中使用GIF格式。例如,在其网站的设计中,在社交网络上以广告标语,用于存储照片等形式在撰写文章或书籍时进行网页设计,图形设计。使用这种格式,您可以减小图像的大小,这会积极影响Internet网站页面的加载速度。

SVG

这种格式是矢量。简而言之,网站是在其帮助下进行编译的。SVG是带有标签的XML文本文件。缩放和裁剪时,这种格式不会丢失图像质量

现在我们知道什么时候使用哪种格式更好。

如何从Delphi / Lazarus应用程序导出为这些格式?

首先,我们必须创建一个文档。

然后,在我们创建了想要变成插图的对象之后,启动并查看。

在预览窗口中,我们选择保存报告的格式。 例如,我们需要导出到BMP图像。选择并单击。

可视化报告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存图像

将出现导出设置窗口。配置并保存。

可视化报告生成器FastReport VCL功能指南:从Delphi / C ++ Builder / Lazarus保存图像
如何直接从Delphi / C ++ Builder / Lazarus代码中保存BPM / JPEG / TIFF / GIF?

保存为BMP

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}
 frxBMPExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxBMPExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxBMPExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxBMPExport1.CropImages := False;
 {Set the resolution, DPI}
 frxBMPExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxBMPExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxBMPExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxBMPExport1.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}
 frxBMPExport1.FileName := 'C:\Output\test.bmp';
 {Export the report}
 frxReport1.Export(frxBMPExport1);
end;

保存为JPEG

procedure TForm1.Button2Click(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}
 frxJPEGExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxJPEGExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxJPEGExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxJPEGExport1.CropImages := False;
 {Set the quality of JPEG}
 frxJPEGExport1.JPEGQuality := 90;
 {Set the resolution, DPI}
 frxJPEGExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxJPEGExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxJPEGExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxJPEGExport1.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}
 frxJPEGExport1.FileName := 'C:\Output\test.jpg';
 {Export the report}
 frxReport1.Export(frxJPEGExport1);
end;

保存为TIFF

procedure TForm1.Button3Click(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}
 frxTIFFExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxTIFFExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxTIFFExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxTIFFExport1.CropImages := False;
 {Set the resolution, DPI}
 frxTIFFExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxTIFFExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxTIFFExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxTIFFExport1.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}
 frxTIFFExport1.FileName := 'C:\Output\test.tif';
 {Export the report}
 frxReport1.Export(frxTIFFExport1);
end;

保存为GIF

procedure TForm1.Button4Click(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}
 frxGIFExport1.PageNumbers := '2-3';
 {Set whether to export each page to a separate file.}
 {.N will be added to the file name, where N is the serial number of the page}
 frxGIFExport1.SeparateFiles := True;
 {Set whether to export to monochrome image}
 frxGIFExport1.Monochrome := False;
 {Set whether to crop empty edges (page margins)}
 frxGIFExport1.CropImages := False;
 {Set the resolution, DPI}
 frxGIFExport1.Resolution := 96;
 {Set whether to open the resulting file after export}
 frxGIFExport1.OpenAfterExport := False;
 {Set whether to display export progress (show which page is currently being exported)}
 frxGIFExport1.ShowProgress := False;
 {Set whether to display the export filter dialog box}
 frxGIFExport1.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}
 frxGIFExport1.FileName := 'C:\Output\test.gif';
 {Export the report}
 frxReport1.Export(frxGIFExport1);
end;

Fastreport在线下单立享85折起!赶紧加入购物清单吧!

还想要更多吗?您可以点击阅读【FastReport 报表2020最新资源盘点】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入FastReport技术交流群(783996712),我们很高兴为您提供查询和咨询。

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:FastReport控件中文网 [https://www.fastreportcn.com/]
本文地址:https://www.fastreportcn.com/post/2871.html

联系我们
  • 重庆总部 023-68661681
购买
  • sales@evget.com
合作
  • business@evget.com


在线
客服
微信
QQ 电话
023-68661681
返回
顶部