Does anyone have any ideas/suggestions to tackle this printing issue? I hope my explanation was clear enough.
Thank you for reading. --- In flexcoders@yahoogroups.com, "handitan" <[EMAIL PROTECTED]> wrote: > > I have been trying to solve this issue for days but still couldn't > find the right solution. > > I am going to make as simple as I can about the issue. > Here's the situation: > I have this DataGrid > <mx:DataGrid id="myDataGrid" width="100%" height="100%"> > <mx:columns> > <mx:DataGridColumn headerText="FirstName" dataField="fName" > itemRenderer="Renderer.NameRenderer"/> > <mx:DataGridColumn headerText="LastName" dataField="lName" > itemRenderer="Renderer.NameRenderer"/> > </mx:columns> > </mx:DataGrid> > =========================================== > Now here's the NameRenderer's definition: > <mx:HBox width="100%" horizontalAlign="left" verticalAlign="middle"> > <mx:Script> > <![CDATA[ > override public function set data(value:Object):void { > super.data = value; > > if (value != null) > { > myLabel.text = value; > } > > ]]> > </mx:Script> > <!-- Remember the font size please. It relates to the issue- -> > <mx:Label id="myLabel" fontSize="14"> > > </mx:HBox> > ================================================== > > Now, the grid displays fine in my flex app. Then I added a > functionality to be able to print the grid using almost exactly the > same like in this example: > http://livedocs.adobe.com/flex/2/langref/mx/printing/PrintDataGrid.htm > l#includeExamplesSummary > with the following exceptions: > - My FormPrintView doesn't have the all of the <mx:columns> stuffs in > PrintDataGrid. > - Inside my doPrint() (this is in PrintDataGridExample section) under > thePrintView.myDataGrid.dataProvider = myDataGrid.dataProvider > statement, I add this: > thePrintView.myDataGrid.columns = myDataGrid.columns; > ================================================== > Now when I print it out, everything is working fine and dandy (good > job Flex team!). > > Then one day, I was told to do a "bit" change. The Printouts need to > be in font-size 8 instead of 14. The grid looks great on the web > using font-size 14 but when it is being printed out, it needs to be > in font-size 8. > > So my question is how do you do that? > Just to let you know, these were the things that I try: > - In my FormPrintView, I added this attribute 'fontSize="8"'. I > thought that this will take care the problem but it didn't. It wasn't > overriding myLabel's fontSize. > - Then I do another way using Bindable strategy, this is what I did: > == Create a global variable to store the font size. > <GlobalFont.as> > package myGlobals > { > [Bindable] > public class GlobalFont > { > public static const DEFAULT_SIZE:int = 14; > public static const PRINT_SIZE:int = 8; > public static var myFontSize:int = DEFAULT_SIZE; > } > } > > ==Then in NameRenderer, I change myLabel to be like this: > <mx:Label id="myLabel" fontSize="{GlobalFont.myFontSize}"> > > ==Then on my doPrint(), I add this before I assign the dataProvider > and columns to thePrintView.myDataGrid: > GlobalFont.myFontSize = GlobalFont.PRINT_SIZE > > ==Then I do the print. > Result: It prints out with the font-size 8 :) But the Flex app will > show all my grid's column content to be shifted off the column after > I scroll the grid up/down (you have to have large data that will have > the vertical scroll bar to appear). You can fix the display again but > clicking the column's header. > > Again I call all Flex Masters to share your wisdom in this matter. > I have been given a deadline to fix this by early next week. So all > ideas/suggestions/anything will help. > > Thank you! >