这是一个PrintDataGrid错误或限制还是我缺乏理解?

时间:2011-04-08 18:16:09

标签: flex printing flex4

我正在尝试在我的应用程序中实现PrintDataGrid,我遇到了一个特殊的问题。打印输出在每页的打印输出中跳过最后几行。 我已经缩小了导致这个问题的原因。我的应用程序级自定义外观为整个应用程序提供了Flex滚动功能。自定义外观中存在此滚动条会导致PrintDataGrid跳过最后一行。实际上,跳过的行数取决于浏览器的高度。如果您降低浏览器高度,则会跳过更多行!

这是一个错误PrintDataGrid还是一个限制(在Scroller中不能有PrintDataGrid)或者我错过了什么?

请耐心等待,因为我已经挣扎了好几天了!

以下是重现此问题的简单代码:

主要应用:

                                                                                                                                                                                                                                                                                                                                                                                                  应用程序自定义外观类:ApplicationSkinCustom.mxml ============================================

@see spark.components.Application

@langversion 3.0 @playerversion Flash 10 @playerversion AIR 1.5 @productversion Flex 4 - >

<fx:Metadata>
    <![CDATA[
    /**
    * A strongly typed property that references the component to which this skin is applied.
    */
    [HostComponent("spark.components.Application")]
    ]]>
</fx:Metadata>

<fx:Script fb:purpose="styling">
    <![CDATA[
        /**
         *  @private
         */
        override protected function updateDisplayList(unscaledWidth:Number,
                                                      unscaledHeight:Number) : void
        {
            bgRectFill.color = getStyle('backgroundColor');
            super.updateDisplayList(unscaledWidth, unscaledHeight);
        }
    ]]>
</fx:Script>

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
    <s:State name="normalWithControlBar" />
    <s:State name="disabledWithControlBar" />
</s:states>

<!-- fill -->
<!---
A rectangle with a solid color fill that forms the background of the application.
The color of the fill is set to the Application's backgroundColor property.
-->
<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0"  >
    <s:fill>
        <s:SolidColor id="bgRectFill" color="#FFFFFF"/>
    </s:fill>
</s:Rect>

<s:Scroller left="1" top="1" right="1" bottom="1" id="scroller">
    <s:Group left="0" right="0" top="0" bottom="0">
        <s:layout>
            <s:VerticalLayout gap="0" horizontalAlign="justify" />
        </s:layout>

        <!---
        @private
        Application Control Bar
        -->
        <s:Group
            id="topGroup"
            minWidth="0"
            minHeight="0"
            includeIn="normalWithControlBar, disabledWithControlBar"
            >

            <!-- layer 0: control bar highlight -->
            <s:Rect left="0" right="0" top="0" bottom="1" >
                <s:stroke>
                    <s:LinearGradientStroke rotation="90" weight="1">
                        <s:GradientEntry color="0xFFFFFF" />
                        <s:GradientEntry color="0xD8D8D8" />
                    </s:LinearGradientStroke>
                </s:stroke>
            </s:Rect>

            <!-- layer 1: control bar fill -->
            <s:Rect left="1" right="1" top="1" bottom="2" >
                <s:fill>
                    <s:LinearGradient rotation="90">
                        <s:GradientEntry color="0xEDEDED" />
                        <s:GradientEntry color="0xCDCDCD" />
                    </s:LinearGradient>
                </s:fill>
            </s:Rect>

            <!-- layer 2: control bar divider line -->
            <s:Rect left="0" right="0" bottom="0" height="1" alpha="0.55">
                <s:fill>
                    <s:SolidColor color="0x000000" />
                </s:fill>
            </s:Rect>

            <!-- layer 3: control bar -->
            <!--- @copy spark.components.Application#controlBarGroup -->
            <s:Group id="controlBarGroup" left="0" right="0" top="1" bottom="1" minWidth="0" minHeight="0">
                <s:layout>
                    <s:HorizontalLayout paddingLeft="10" paddingRight="10" paddingTop="7" paddingBottom="7" gap="10" />
                </s:layout>
            </s:Group>
        </s:Group>

        <!--- @copy spark.components.SkinnableContainer#contentGroup -->
        <!--<s:Group id="contentGroup" width="100%" height="100%" minWidth="0" minHeight="0" />-->
        <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" />
    </s:Group>
</s:Scroller>

1 个答案:

答案 0 :(得分:1)

这显然是Flex打印库和Scroller控件的已知错误。你可以在这里阅读我的讨论: http://forums.adobe.com/message/3626759

我要尝试的第一件事是摆脱自定义皮肤,处理您的打印作业,然后重新应用自定义皮肤。这可能会成功。如果它确实有效,但看起来不像您想要的那样,那么您可以创建一个没有滚动条的自定义应用程序外观的变体。您可以在开始打印作业之前应用它,然后在打印作业完成后恢复原始自定义应用程序外观。

用户在点击打印按钮时可能会短暂看到您应用的“备用”版本,但最多只能是瞬间。

-Josh