【问题标题】:Is this a PrintDataGrid bug or restriction or my lack of understanding?这是 PrintDataGrid 错误或限制还是我缺乏理解?
【发布时间】:2011-04-08 18:16:08
【问题描述】:

我正在尝试在我的应用程序中实现 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>

【问题讨论】:

    标签: apache-flex printing flex4


    【解决方案1】:

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

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

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

    -乔什

    【讨论】:

    • 乔希,感谢您的回复。您建议在打印部分将应用程序皮肤更改为没有滚动条的皮肤,但似乎仍然存在分页问题。我会尝试重新创建它并将其发布在这里。这是我在 Adob​​e 论坛上对同一主题的讨论:forums.adobe.com/thread/835791?tstart=0
    猜你喜欢
    • 2021-06-03
    • 2017-11-03
    • 2018-11-23
    • 1970-01-01
    • 2013-09-14
    • 2015-03-31
    • 2015-10-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多