Thanks, I actually was able to fix that first problem (solution is
below, please let me know if there's a better way) but now I have
another slight problem when printing the DataGrid. IF I keep
variableRowHeight set to true, it really doesn't do a good job. It
seems to cut off some of the rows that may have a little more text
than the rest. If I set it to false, it prints okay but all are the
largest size. Any ideas how to fix this?
DETAILS FIX ON THE HIDDEN PRINT PAGE:
public function resizeTextBoxes(e:Event):void {
e.target.height = e.target.height + 10;
}
<mx:Text id="descText" text="{_ADL.getItemAt
(0).deploymentDescription}" width="80%" selectable="false"
styleName="detailPrintStyle" creationComplete="resizeTextBoxes
(event)"/>
===============================================================
DATAGRID PRINT:
<?xml version="1.0"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:MyComp="print.*" backgroundColor="#FFFFFF"
paddingTop="20" paddingBottom="20" paddingLeft="20">
<mx:Script>
<![CDATA[
include "../com/decodeAreaCode.as";
import mx.core.*
[Embed(source="../images/banner.swf",symbol="banner")]
[Bindable]
public var Banner:Class;
// Declare and initialize the variables used in the
component.
// The application sets the actual prodTotal value.
[Bindable]
public var pageNumber:Number = 1;
[Bindable]
public var prodTotal:Number = 0;
// Control the page contents by selectively hiding the
header and
// footer based on the page type.
public function showPage(pageType:String):void {
if(pageType == "first" || pageType == "middle") {
// Hide the footer.
//footer.includeInLayout=false;
//footer.visible = false;
}
if(pageType == "middle" || pageType == "last") {
// The header won't be used again; hide it.
header.includeInLayout=false;
header.visible = false;
}
if(pageType == "last") {
// Show the footer.
//footer.includeInLayout=true;
//footer.visible = true;
}
//Update the DataGrid layout to reflect the results.
validateNow();
}
public function myDateFormat(item:Object,
column:DataGridColumn):String {
var newItem:String;
var thisDate:String;
var result:Array;
if (column.headerText == "Release to Area Date"){
newItem = item.globalReleaseDate;
} else {
newItem = item.globalDeadline;
}
return myDateSm.format(newItem)
}
//
]]>
</mx:Script>
<!-- date formatter -->
<mx:DateFormatter id="myDate" formatString="D, MMMM YYYY" />
<mx:DateFormatter id="myDateSm" formatString="DD MMM YYYY" />
<!---->
<!-- The template for the printed page,
with the contents for all pages. -->
<mx:VBox width="80%" horizontalAlign="left">
<mx:Label text="Page {pageNumber}"/>
</mx:VBox>
<!--
<MyComp:FormPrintHeader id="header" width="100%"/>
-->
<mx:Image source="{Banner}" id="header" width="90%"/>
<!-- The sizeToPage property is true by default, so the last
page has only as many grid rows as are needed for the data. -
->
<mx:PrintDataGrid id="myDataGrid" width="100%" height="100%"
variableRowHeight="true" fontSize="9">
<!-- Specify the columns to ensure that their order is correct. -
->
<mx:columns>
<mx:DataGridColumn headerText="Deployment"
dataField="title" wordWrap="true" />
<mx:DataGridColumn headerText="Portfolio
Name" dataField="portfolioName" wordWrap="true"/>
<mx:DataGridColumn headerText="Origin"
dataField="origin"/>
<mx:DataGridColumn headerText="Target(s)"
dataField="targetAll" wordWrap="true" width="100" />
<mx:DataGridColumn headerText="Release to
Area Date" headerWordWrap="true" dataField="globalReleaseDate"
labelFunction="myDateFormat" />
<mx:DataGridColumn headerText="Deadline"
dataField="globalDeadline" labelFunction="myDateFormat"
minWidth="100" />
</mx:columns>
</mx:PrintDataGrid>
<!-- Create a FormPrintFooter control
and set its prodTotal variable. -->
<!--<MyComp:FormPrintFooter id="footer" pTotal="{prodTotal}"/>-->
</mx:VBox>