Printing Multiple Pages using FlexReport (Flex打印转载)

本文介绍了一款开源项目FlexReport,它能有效解决Flex应用程序中的打印预览、报告布局及多页文本打印等问题。尽管FlexReport存在一些局限性,如处理复杂的垂直与水平混合布局时可能出现问题,但对于大多数基本打印任务来说,它仍是一个很好的解决方案。

What is the problem

In the previous tutorial, we saw How to Print Multiple Pages Using Flex PrintDataGrid. It works fine when your application just contains one big DataGrid. In the real world, however, you often need a combination of contains and controls like VBox, HBox, Text, Image, plus DataGrid. Then guess what? You still have trouble with the Flex print job.

In fact, this is not the only challenge you are facing… How about the Print Preview function? Why do you need it? Because we are in recession! Oh, yeah, your boss would try to squeeze every penny for the sake of Cost Reduce. No one likes to see you print 100 pages then realize it is a wrong report. Plus saving paper is good for our mother earth.

Unfortunately,  till Flex 3,  Adobe has not provided a good solution to either Multiple Pages Printing or Print Preview (without client-side installation like PDF Printer).

FlexReport

As I mentioned before, my first Flex job was to find a better way to print multiple pages. So I did a lot of research on the 3rd party solutions. I was quite frustrated at that time. It seemed like everyone was focusing on Flex Layout, Animation, and Backend System Integration. Nobody cared about such a lower level job – Print. No wonder Adobe is not in hurry to provide a better support for Flex Print.

Finally, there was one open source project got my attention. It’s called FlexReport. After thoroughly reviewed its source code and demo application, I would have to say FlexReport is by far the closet solution to the Flex Print problem.

You can find the information about the FlexReport from the following URLs:

1. FlexReport Introduction
   http://www.kemelyon.com/bts/2008/01/14/flexreport/

2. FlexReport Demo Application
   http://www.kemelyon.com/flexreport/0_2rc1/

3. FlexReport Source File Download
   http://www.kemelyon.com/flexreport/srcview/FlexReport.zip

   Notes:
   If you counter any troubles to run the original FlexReport
   from the above link. You can Download My Working Version Here.
   I fixed some class reference problems and ran it fine in Flex 3.

How can FlexReport help you

The best way to see how much FlexReport can help you is to Try It. Download a copy and run it in your Flex Builder.

I found FlexReport was pretty cool in the following 3 areas:

1. Print preview
   Provides a nice preview by generating print pages through Bitmaps.
   Has a built-in PDF Printer, No extra software required to end users.

2. Report layout
   Creates dynamic reports without knowing how many pages in advance.

3. Multi-page text printing 
   Except PrintDataGrid, adds a PrintText for long Text printing.

What is FlexReport missing

The biggest problem of FlexReport is: it assumes your Flex Components (Controls and Contains) are mainly Vertical-Stacked. For example, you have a  TextArea at the top, then a DataGrid starting after the bottom of the TextArea, then an Image after the DataGrid.

However, many corporate forms are not like that, they usually mix Vertical and Horizontal Layout. For instance, you may have 3 Labels, 2 Text Areas, and 2 Images horizontal-aligned while other 2 DataGrids, 2 Texts, 3 Images vertical-aligned. FlexReport might give you some weird results in this case.

Conclusion

FlexReport is a nice solution to none-critical Flex printing  jobs. It enhances Flex Print function in terms of Print Preview, Report Layout, and Multi-page Text Printing. However,  FlexReport still has some issues to handle complex corporate reports especially with mixed Vertical and Horizontal Layout.

So, how can you further improve from FlexReport? To do so, you need to know some concepts and implementations of Flex Framework. This will be covered in our next tutorial – Understanding Flex Print Job from A to Z.

 

Source:http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/

转载于:https://www.cnblogs.com/wuhenke/archive/2009/11/22/1608216.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值