用flex如何制作不规则的表格,进行打印预览。而且可以打印。譬如制作如下表单:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    horizontalScrollPolicy="off"
    verticalScrollPolicy="off">
    
    <mx:Script>
        <![CDATA[
            import mx.printing.FlexPrintJob;
            
            private function printResume():void
            {
                var printJob:FlexPrintJob = new FlexPrintJob();
                printJob.start();
                printJob.addObject(resume);
                printJob.send();
            }
        ]]>
    </mx:Script>
    
    <mx:Style>
        Application
        {
            paddingLeft: 0;
            paddingRight: 0;
            paddingTop: 0;
            paddingBottom: 0;
            verticalGap: 0;
            fontSize: 12;
        }
        
        .resume
        {
            backgroundAlpha: 1;
            backgroundColor: #FFFFFF;
            borderColor: #888888;
            borderStyle: solid;
            borderThickness: 1;
            paddingLeft: 15;
            paddingRight: 15;
            paddingTop: 15;
            paddingBottom: 15;
            verticalGap: 0;
        }
        
        Grid
        {
            backgroundAlpha: 1;
            backgroundColor: #FFFFFF;
            borderColor: #000000;
            borderSides: "right bottom";
            borderStyle: solid;
            borderThickness: 1;
            horizontalGap: 0;
            verticalGap: 0;
        }
        
        GridItem
        {
            borderColor: #000000;
            borderSides: "left top";
            borderStyle: solid;
            borderThickness: 1;
        }
        
        .title
        {
            fontSize: 24;
            textAlign: center;
        }
        
        .photo
        {
            borderColor: #000000;
            borderSides: "left top";
            borderStyle: solid;
            borderThickness: 1;
            paddingLeft: 2;
            paddingRight: 2;
            paddingTop: 2;
            paddingBottom: 2;
        }
        
        .box
        {
            verticalGap: 0;
        }
    </mx:Style>
    
    <mx:ApplicationControlBar width="100%">
        <mx:Button label="打印简历" click="printResume()" />
    
    </mx:ApplicationControlBar>
    <mx:Canvas width="100%" height="100%">
        <mx:VBox id="resume"
            x="20" y="20" width="492" height="620" styleName="resume">
            <mx:Spacer height="12" />
            <mx:Label width="100%" text="个人简历" styleName="title" />
            <mx:Spacer height="8" />
            <mx:Grid width="460" height="523">
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="姓名" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="北京人甲" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="性别" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="男" />
                    </mx:GridItem>
                    <mx:GridItem width="99" rowSpan="5" styleName="photo">
                        <mx:Image width="90" height="100"
                            source="http://www.javaeye.com/upload/logo/user/81174/5415ac9b-162c-317c-8c9c-aa5cd2c1d6c4.jpg?1236837636" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="出生日期" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="-200000-1-1" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="籍贯" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="北京周口店" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="姓名" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="张三" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="性别" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="男" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="民族" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="暂缺" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="政治面貌" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="群众" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="身高" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="164cm" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="健康状况" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="优秀" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem width="70">
                        <mx:Label text="学历" />
                    </mx:GridItem>
                    <mx:GridItem width="110">
                        <mx:Label text="无" />
                    </mx:GridItem>
                    <mx:GridItem width="70">
                        <mx:Label text="毕业院校" />
                    </mx:GridItem>
                    <mx:GridItem width="110" colSpan="2">
                        <mx:Label text="北京周口店社会大学" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="◇教育经历◇" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="78">
                    <mx:GridItem colSpan="5" />
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="◇工作经验◇" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="78">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="本人擅长打猎、捕鱼、采集野果、制作石器、生火等,有20年以上工作经验。" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="◇项目经验◇" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="78">
                    <mx:GridItem colSpan="5">
                        <mx:VBox styleName="box">
                            <mx:Label text="猎野猪(与他人合作完成)" />
                            <mx:Label text="捡兔子(野火烧熟的)" />
                            <mx:Label text="曾独立捕到一人长大鲤鱼一条" />
                        </mx:VBox>
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="21">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="◇自我评价◇" />
                    </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow height="78">
                    <mx:GridItem colSpan="5">
                        <mx:Label text="乐观向上、有团队合作精神" />
                    </mx:GridItem>
                </mx:GridRow>
            </mx:Grid>
        </mx:VBox>
    </mx:Canvas>
    
</mx:Application>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值