0
我試圖打印一個多頁FlexPrintJob,它包含在第一頁上,幾個標籤,然後PrintDataGrid。它全部打印,除了PrintDataGrid只打印所有頁面的一半頁面。Flex - FlexPrintJob如何正確地打印一組字段和PrintDataGrid?
我知道它與我在第1頁上打印的標籤有關,因爲將它們取走或隱藏它們可修復問題,並且網格會打印整頁所有頁面。
我已經嘗試過各種容器圍繞網格和標籤,包括VBox,VGroup,Group,併爲一些容器指定height =「100%」的不同組合。
是不是可以打印第1頁上的變量/標籤的半頁,然後在同一頁面上啓動數據網格(半頁值),然後在後續頁面上轉到完整頁面?
這裏是我的打印作業代碼:
var printJob:FlexPrintJob = new FlexPrintJob();
if (printJob.start()) {
var thePrintView:printViewEventUser = new printViewEventUser(); // Create a FormPrintView control as a child of the application.
addElement(thePrintView);
thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.parentEncounter=parentEncounter; //pass in my object for the labels to print
thePrintView._currentRec=_currentRec; //pass in my object for the labels to print
thePrintView.myDataGrid.dataProvider = bedSearchEditList._recs;
thePrintView.showPage("single"); // Create a single-page image.
if(!thePrintView.myDataGrid.validNextPage) // If the print image's DataGrid can hold all the data provider's rows, add the page to the print job.
{
printJob.addObject(thePrintView,FlexPrintJobScaleType.NONE);
}
else // Otherwise, the job requires multiple pages.
{
thePrintView.showPage("first"); // Create the first page and add it to the print job.
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
while(true) //queue pages
{
thePrintView.myDataGrid.nextPage(); // Move the next page of data to the top of the PrintDataGrid.
thePrintView.showPage("last"); // Try creating a last page.
if(!thePrintView.myDataGrid.validNextPage) // If the page holds the remaining data, or if the last page was completely filled by the last grid data, queue it for printing. Test if there is data for another PrintDataGrid page.
{
printJob.addObject(thePrintView,FlexPrintJobScaleType.MATCH_WIDTH); // This is the last page; queue it and exit the print loop.
break;
}
else // This is not the last page. Queue a middle page.
{
thePrintView.showPage("middle");
printJob.addObject(thePrintView,FlexPrintJobScaleType.MATCH_WIDTH);
thePrintView.pageNumber++;
}
}
}
removeElement(thePrintView);
}
printJob.send(); // Send the job to the printer.
我打印視圖對象基本上只是一個在我的標籤,然後PrintDataGrid會。