Multiple Page Number
Dear All
i have Month wise tabular and summary information in one report (using report 6i) ,
report start from January
report first show tabular information having many pages and then its summary, show on single page
then next month say February tabular information having many pages and then its summary show on single and so on
now the problem is that
i want to show separate page number for tabular and summary
mean tabular pages number start from one and continue to last page of the end of report with all months
same summary page number that show after every tabular months start from one and continue to last page of the end of report with all months
what is a best way to do...!
thanks
Hi,
I under stood that you are having two query groups.
One group has the tabular information, second group the summary information.
So keep a summary column in both the groups. CS_tab, CS_sum.
CS_tab : count on a unique column in first group, reset at report level.
CS_sum: count on a unique column in second group, reset at report level.
refer these summary columns appropriately in your layout.
More about summary columns:
http://oracleapps4u.blogspot.com/2011/03/summary-column-properties.html
Edited by: 843698 on Mar 22, 2011 9:39 PM
Edited by: 843698 on Mar 22, 2011 9:40 PM
Similar Messages
-
Print Multiple copies of report, and resetting Page number for each copy.
Dear frnds!
i am using developer 6i reports i have a problem.
i want to Print Multiple copies of report, and resetting Page number for each copy" that is 4 copies of an invoice is required
1 - for user copy
2- gate copy
3- accounts office
4- office copy
any body please tell me the solution "i am using oracle 9i and developer 6i"
Thanx
IbrarHi,
I was wondering if you were able to get your multiple copies working? Below is what I have so far, just trying to get it to work before changing the actual template.
<?for-each-group@section:R5542520/Pick_Slips_Detail_Lines_S3;PickSlipNumber_ID260?>
<?variable@incontext:G1;R5542520/Pick_Slips_Detail_Lines_S3;PickSlipNumber_ID260?>
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,3,1)?>
HEADER
PSN: <?$G1/Pick_Slip_Number_Display_ID54?>
PSN Detail: <?$G1/PickSlipNumber_ID260?>
Page 1 of 3
<?start:body?>
BODY
<?$G1/LineNumber_ID6?>
<?end body?>
FOOTER
<?end for-each?>
<?end for-each-group?>
XML:
<R5542520>
<Pick_Slips_Detail_Lines_S24>
<Header_Custom_Section_S24>
<Pick_Slip_Number_Display_ID54>123456</Pick_Slip_Number_Display_ID54>
<PickSlipNumber_ID260>123456</PickSlipNumber_ID260> -
Multiple keyword page number display, help me please!
Hi! I've been trying to solve this problem by checking other theads on this forum as well as other forums, but I can't seem to find a suitable solution and now im pretty desperate.
I'm working on a book where we've had to change the numbes on each page and re-make the index. The situation is that the old index is correctly fomatted with about 11539 keywords, and after each keyword the pages where they show up are displayed. The index is situated in the same .indb-file as the rest of the book.
Currently I'm fixing this manually by change and find, working overtime busting my a** to get this done. The problem is that in spite of this, it looks like I won't make it to the deadline.
So, does anyone know if theres a way to enter multiple search tags into a script, and then get the script to display evey page number where the tag can be located? Since the book contains 11539 keywords spead out on ove 700 pages, I'm going crazy here. I would love to just copy-paste all the tags into a script, press enter and then get them displayed one by one so that I could copy-paste them back into the index.
I wouldn't mind re-arranging the whole index, as long as I found a feasable way to solve this problem. I am currently running CS3, but I can upgrade if necessary.
PLEASE HELP ME! I'm in a world of pain that's worsening day by day.
/Corinne, SwedenYes! I am also suffering this issues.
If any one help for this it could be a great help for us......
Thanks
M. Karthik -
Reseting page number in Word RTF template for BI Publisher PDF generation
Hi!
Apex 4.0.2, Oracle 10.2.0.4, BIP 10.2
Bills are created based on Word RTF file with BI Publisher. Reszulting file is one big PDF file, which has many pages.
Word RTF template is grouped on BILLS.ID field with page break option. So one BILLS.ID may have one or many pages (according data).
How to create RTF template (for PDF BI Publisher generation) with reseting page numbers when grouping value change.
Page numbers are in footer in format
curr_group_page/total_group_pages
where:
curr_group_page is current page number in group (defined with BILLS.ID field),
total_group_pages is total page number of pages in group (defined with BILLS.ID field).
I need to reset numbering whenever BILLS.ID (group) change.
Example:
ID=1 (4 pages)
1/4, 2/4, 3/4, 4/4
ID=2 (1 pages)
1/1
ID=3 (2 pages)
1/2, 2/2
ID=4 (3 pages)
1/3, 2/3, 3/3
etc.
How to achieve that kind of numbering?
Any help appreciated.
Regards,
Damir Vadas
Edited by: Damir Vadas on May 16, 2011 12:49 PMSimple question.. Does your posting deal with an APEX issue or a BI Publisher issue? The posting you have deals with the RTF add-on for Word that builds report layouts for BI Publisher. I suggested in my response that you move it to a more relevant forum..
If you feel that me alerting you to the fact your are VIOLATING forum policy is an issue, please feel free to ask others their view.. (posting to a 3 year old closed thread, creating MULTIPLE threads for a single issue..) You do NOT seem to get the idea that posting this in the Bi Publisher support forum would probably get you a BETTER response than here.. Asking pl/sql questions here will also get people to refer your questions to the PL/Sql Support forum..
Also, here is a POSSIBLE answer from the BI Publisher Forum: http://forums.oracle.com/forums/thread.jspa?threadID=594805
This Is The APEX SUPPORT forum, we deal with SUPPORT questions on APEX (Application Express)..
Thank you,
Tony Miller
Webster, TX
You know, I used to think that it was awful that life was so unfair. Then I thought, wouldn't it be much worse if life were fair, and all the terrible things that happen to us come because we actually deserve them? So, now I take great comfort in the general hostility and unfairness of the universe.
If this question is answered, please mark the thread as closed and assign points where earned.. -
Page number reset in .rtf template
Hello,
In the AR statements report, If I run the report for mutiple customers, page number has to be reset for each bill_to customer...
I have the header part from the second page, so when I run the report for multiple customers...even for the new customer's first page...header is coming....
So I assume by resetting the page number for every bill to automatically solve the issue of header from second page...
Please advise...how to reset the page# based on a condition ( for each bill to)...I know it work with @section....
but my template is like <?for-each-group:G_STATEMENT;./STATEMENT_DATE?><?for-each-group:current-group();././././././././././././././SEND_TO_ADDRESS_ID?>
-Sridhar
Edited by: user7751421 on Oct 12, 2011 4:32 AMIf you could send me your xml and template i can give a try.
[email protected] is my email id. -
Scanning multiple pages in to a single continuous PDF
I have recently purchased an HP ENVY 5530 wireless printer for use with my iPad using the HP AIO ('All In One') software app from the i-Store.
I have a number of paper documents that I wish to scan in to electronic (PDF) format, most of which run in to multiple pages. However, each time I scan a page, the software creates a new PDF file, rather than one continuous electronic copy. I am finding this very frustrating as all I want is one single PDF file containing multiple pages.
Have read various message boards, forums, FAQs, but can't find any answers so would really appreciate any help anyone can give.
Thanks!Hi Manxie,
Thank you for the update.
I wonder if you are choosing to save after each page is scanned? If yes, that would be why each page is being created as a separate file. When you choose the add page icon and then confirm that you want to add a page (see screen shot below) it will return you to the preview/scan screen. I was able to scan 5 pages into one document this morning.
Regards,
Happytohelp01
Please click on the Thumbs Up on the right to say “Thanks” for helping!
Please click “Accept as Solution ” on the post that solves your issue to help others find the solution.
I work on behalf of HP -
Scanning multiple pages as one document
When I was using Windows XP with my HP 3055 I could scan multiple pages as one document. Since I have upgraded to Windows 7 Pro, when I scan, each page is scanned as a new document. Also, I no longer have the option to scan the document as a pdf. The pdf problem is not that important, but it is very important to be able to scan multiple pages as one document. How can I make my HP scan all pages as one document?
Thank you.Hi @flyrod40 ,
I see that you would like to be able to scan multiple pages to one file. I would be happy to help you.
What printer do you have? Deskjet 3050 or the Laserjet 3050.
How Do I Find My Model Number or Product Number?
If you are using the HP Scan Software, open the software, select the link for Advanced Settings, then click on the File tab and put a check mark in Create a separate file for each scanned page. This will allow you to scan multiple pages to one file.
Here are the screen shots.
Hope this helps.
Have a nice day!
Thank You.
Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
Gemini02
I work on behalf of HP -
Problem with Multiple Page convert in PDF
Hi all,
I done one invoice printing and convert in pdf report. but with smartform i get all thing and giving perfect out put.
But when i give second option for direct create a file of PDF this time only one page can convert in PDF. Means when i give multiple input like print invoice 0000910 to 0000925 so this time only invoice no. 0000925 is convert in pdf. But actually i need all invoice like 910 to 925 convert in one PDF with 25 pages.
And i done coding which is show below for this issue.
so please help me out and kindly guide me what is the mistake in my below code for make multiple page in one pdf.
FORM get_FORM1.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_form_name
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = w_fmodule
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_cparam-no_dialog = 'X'.
w_cparam-preview = space. " Suppressing the dialog box
" for print preview
w_cparam-getotf = 'X'.
* Printer name to be used is provided in the export parameter
* OUTPUT_OPTIONS
w_outoptions-tddest = 'LP01'.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ITABz[] = itab[].
ITABz1[] = itab1[].
IT_ADDRESSz[] = it_address[].
LOOP at itab1.
delete ITABz where vbeln ne itab1-vbeln.
delete ITABz1 where vbeln ne itab1-vbeln.
delete it_addressz where KUNNR ne itab1-KUNRG.
* delete itab1 where vbeln ne itab1-vbeln.
TOTAL_QNT = ITAB1-TOTAL_QNT.
TOTAL_AMT = itab1-TOTAL_AMT.
I_FKIMG = itab1-I_FKIMG.
BILL_DATE = itab1-BILL_DATE.
IJ_1ICSTNO = itab1-IJ_1ICSTNO.
VECHICAL_NO = itab1-VECHICAL_NO.
TAX = itab1-TAX.
INV_TXT = ITAB1-INV_TXT.
inv_name = ITAB1-INV_NAME.
INVOICE = ITAB1-INVOICE.
TAX1 = itab1-TAX1.
TAX_VAL = itab1-TAX_VAL.
TAX_ADD_VAL = itab1-TAX_ADD_VAL .
Text_inv = itab1-Text_inv.
TEXT1 = itab1-TEXT1.
TEXT2 = itab1-TEXT2.
TEXT3 = itab1-TEXT3.
TEXT4 = itab1-TEXT4.
TEXT5 = itab1-TEXT5.
P_DOCNO = itab1-vbeln.
CALL FUNCTION w_fmodule
EXPORTING
WERKS = WERKS
TOTAL_QNT = TOTAL_QNT
TOTAL_AMT = TOTAL_AMT
I_FKIMG = I_FKIMG
STATE = STATE
LAND1 = LAND1
LANDX = LANDX
P_DOCNO = P_DOCNO
BILL_DATE = BILL_DATE
IJ_1ICSTNO = IJ_1ICSTNO
T_WERKS = T_WERKS
VECHICAL_NO = VECHICAL_NO
TAX = TAX
TAX1 = TAX1
TAX_VAL = TAX_VAL
TAX_ADD_VAL = TAX_ADD_VAL
inv_txt = inv_txt
inv_name = inv_name
INVOICE = INVOICE
Text_inv = Text_inv
TEXT1 = TEXT1
TEXT2 = TEXT2
TEXT3 = TEXT3
TEXT4 = TEXT4
TEXT5 = TEXT5
* ARCHIVE_INDEX =
* ARCHIVE_INDEX_TAB =
* ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = w_cparam
* MAIL_APPL_OBJ =
* MAIL_RECIPIENT =
* MAIL_SENDER =
OUTPUT_OPTIONS = w_outoptions
* USER_SETTINGS = 'X'
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
* JOB_OUTPUT_OPTIONS =
TABLES
ITAB = itabz
ITAB1 = itabz1
IT_ADDRESS = it_addressz
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
iF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ITABz[] = itab[].
ITABz1[] = itab1[].
IT_ADDRESSz[] = it_address[].
ENDLOOP.
t_otf[] = t_otf_from_fm-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
* ARCHIVE_INDEX = ' '
* COPYNUMBER = 0
* ASCII_BIDI_VIS2LOG = ' '
* PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
* BIN_FILE =
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
* USER_ACTION =
* FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
* presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
FILETYPE = 'BIN'
tables
data_tab = T_pdf_tab
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
EndFORM . "get_FORM1
thanks
Keyur
Edited by: keyur chauhan on Aug 30, 2010 11:56 AM
Edited by: keyur chauhan on Aug 30, 2010 11:57 AM
Edited by: keyur chauhan on Aug 30, 2010 12:37 PMThank you!
Unfortunately I didn't find any work around.
Thanks,
Federico -
Every time I open a page, multiple pages open.
Hi
Ever since upgrading to 10.7 Lion whenever I open a file be it in Pages or Numbers or even preview, the last few pages also open. I can't figure it out.
Normally I'll use finder or double cick a file on my desktop. How can I stop multiple pages from opening?
Thanks
Allen10.7 Lion
System Preferences > General
Number of recent items:
At the bottom, uncheck the box next to "Restore windows when quitting and re-opening apps".
Hope this helps. -
Hi,
How to Print the Report in Multiple Pages? i.e. Once the first page Report is finished , the next one has to start printing, and so on.Each Page can contain more than one pages.
TIA,
Vikki
nullYou aren't really linking the frames to the pages. Simply set the "page break before" on the second frame. When the first frame finishes printing (regardless of how many pages that is) it will skip to the next page before the second frame starts printing. If required, you can make the page numbering re-set if you want to based on repeating frame values.
If you really want to distinguish between the layouts, you can create up to 3 layouts by using each of the three sections (header, main, trailer). As each section finishes, there is also a page break before the next section starts.
You can get at the page number using srw.get_page_num() but I don't think this will help you. -
How do you print a report that spans multiple pages? I couldn't find anything in the user's manual, other than making a page 'printer friendly'. The only thing I can think of is to temporarily change the rows per page to a huge number. But that seems pretty hokey.
TerryThat is about all you can do. A web application, a thin-client only knows about what it sees in the current page view.
Some alternatives you could evaluate to print the entire report are
a. FOP (export to PDF); search the forum for more information
b. export to CSV and then print from Excel
c. change rows/page to a large number (as you point out) and then use the browser's File/Print feature
d. use a commercial product like http://www.plpdf.com -
Multiple page form to email with sessions doesn't send mail
I am creating a multiple page form where a user can apply for finance. I am trying to use session to keep the user input values and then the last page sent the application by email.
My problem is the last step where it doen't send the email. I'm not sure if it the session I'm using is wrong because a simple form without sessions works fine.
here are the forms
First page is the input for with variables
<form action="Finance_form_proposal_Address.php" method="post" >
<span id="sprycheckbox1">
<input name="Disclaimer" type="checkbox" value="yes">
<span class="checkboxRequiredMsg">Please confirm that you have read and understood the Terms and Conditions.</span></span>
<div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
<tr>
<td align="right" bgcolor="#F7E4F8" ><strong>Title:</strong></td>
<td align="left" bgcolor="#F7E4F8"><select name="Title">
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Miss">Miss</option>
<option value="Ms">Ms</option>
<option value="Dr">Dr</option>
<option value="Rev">Rev</option>
</select></td>
etc..
</form>
The second form:
Getting values and input new form
<?php session_start();
$_SESSION['Disclaimer'] = $_POST['Disclaimer'];
$_SESSION['Title'] = $_POST['Title'];
$_SESSION['Forname'] = $_POST['Forname'];
$_SESSION['Middle_name'] = $_POST['Middle_name'];
$_SESSION['Surname'] = $_POST['Surname'];
$_SESSION['email'] = $_POST['email'];
$_SESSION['DOB'] = $_POST['DOB'];
$_SESSION['DOB2'] = $_POST['DOB2'];
$_SESSION['DOB3'] = $_POST['DOB3'];
$_SESSION['Gender'] = $_POST['Gender'];
$_SESSION['checkboxGroup1'] = $_POST['checkboxGroup1'];
$_SESSION['checkboxGroup2'] = $_POST['checkboxGroup2'];
$_SESSION['home_phone'] = $_POST['home_phone'];
$_SESSION['mobil'] = $_POST['mobil'];
$_SESSION['marital_status'] = $_POST['marital_status'];
$_SESSION['Occupancy'] = $_POST['Occupancy'];
$_SESSION['Dependants'] = $_POST['Dependants'];
?>
Form on second page
<form action="Finance_form_proposal_Bank_Details_employment.php" method="post"> <input name="Disclaimer" type="checkbox" value="yes">
<div id="F1"><table width="100%" border="1" align="center" cellpadding="3" cellspacing="2">
<tr>
<td align="right" bgcolor="#F7E4F8" ><strong>Correspondence Address:</strong></td>
<td align="left" bgcolor="#F7E4F8"><input name="Correspondence" type="checkbox" id="Correspondence" value="yes" checked="CHECKED">
<label for="Correspondence"></label></td>
</tr>
<tr>
<td bgcolor="#F7E4F8"><strong>Street:</strong></td>
<td bgcolor="#F7E4F8"><input name="Street" type="text"></td>
</tr>
<tr>
<td bgcolor="#F7E4F8"><strong>District:</strong></td>
<td bgcolor="#F7E4F8"><input name="District" type="text"></td>
</tr>
<tr>
<td bgcolor="#F7E4F8"><strong>Town:</strong></td>
<td bgcolor="#F7E4F8"><input name="Town" type="text"></td>
</tr>
etc ..
</form
Third page
Getting values
session_start();
$_SESSION['Correspondence'] = $_POST['Correspondence'];
$_SESSION['Street'] = $_POST['Street'];
$_SESSION['District'] = $_POST['District'];
$_SESSION['Town'] = $_POST['Town'];
$_SESSION['County'] = $_POST['County'];
$_SESSION['Country'] = $_POST['Country'];
$_SESSION['Years'] = $_POST['Years'];
$_SESSION['Months'] = $_POST['Months'];
$_SESSION['Street2'] = $_POST['Street2'];
$_SESSION['District2'] = $_POST['District2'];
$_SESSION['Town2'] = $_POST['Town2'];
$_SESSION['County2'] = $_POST['County2'];
$_SESSION['Country2'] = $_POST['Country2'];
$_SESSION['Years2'] = $_POST['Years2'];
$_SESSION['Months2'] = $_POST['Months2'];
$_SESSION['Street3'] = $_POST['Street3'];
$_SESSION['District3'] = $_POST['District3'];
$_SESSION['Town3'] = $_POST['Town3'];
$_SESSION['County3'] = $_POST['County3'];
$_SESSION['Country3'] = $_POST['Country3'];
$_SESSION['Years3'] = $_POST['Years3'];
$_SESSION['Months3'] = $_POST['Months3'];
Then there is a another form to fill in , wont show that as it is in principle the same.
This is the last page that should sent the data to email:
<?php
session_start();
/* Subject mail variables */
$emailsubject = 'Finance application from PandKshop';
$webmaster = '[email protected]';
/* Gathering Data */
$goods = $_POST['goods'];
$amount = $_POST['amount'];
$Total_Cash = $_POST['Total_Cash'];
$Deposit = $_POST['Deposit'];
$Balance = $_POST['Balance'];
$Payments = $_POST['Payments'];
$Diclaimer = $_SESSION['Disclaimer'];
$Title = $_SESSION['Title'];
$Forname = $_SESSION['Forname'];
$Middle_name = $_SESSION['Middle_name'];
$Surname = $_SESSION['Surname'];
$email = $_SESSION['email'];
$DOB = $_SESSION['DOB'];
$DOB2 = $_SESSION['DOB2'];
$DOB3 = $_SESSION['DOB3'];
$Gender = $_SESSION['Gender'];
$CheckboxGroup1 = $_SESSION['CheckboxGroup1'];
$CheckboxGroup2 = $_SESSION['CheckboxGroup2'];
$home_phone = $_SESSION['home_phone'];
$mobil_phone = $_SESSION['mobil_phone'];
$marital_status = $_SESSION['marital_status'];
$Occupancy = $_SESSION['Occupancy'];
$Dependants = $_SESSION['Dependants'];
$Correspondence = $_SESSION['Correnspondence'];
$Street = $_SESSION['Street'];
$District = $_SESSION['District'];
$Town = $_SESSION['Town'];
$County = $_SESSION['County'];
$Country = $_SESSION['Country'];
$Years = $_SESSION['Years'];
$Months = $_SESSION['Months'];
$Street2 = $_SESSION['Street2'];
$District2 = $_SESSION['District2'];
$Town2 = $_SESSION['Town2'];
$County2 = $_SESSION['County2'];
$Country2 = $_SESSION['Country2'];
$Years2 = $_SESSION['Years2'];
$Months2 = $_SESSION['Months2'];
$Street3 = $_SESSION['Street3'];
$District3 = $_SESSION['District3'];
$Town3 = $_SESSION['Town3'];
$County3 = $_SESSION['County3'];
$Country3 = $_SESSION['Country3'];
$Years3 = $_SESSION['Years3'];
$Months3 = $_SESSION['Months3'];
$Sort_Code = $_SESSION['Sort_Code'];
$Account = $_SESSION['Account'];
$Years_with_Bank = $_SESSION['Years_with_Bank'];
$Months_with_Bank = $_SESSION['Months_with_Bank'];
$CreditCard = $_SESSION['CreditCard'];
$ChequeCard = $_SESSION['ChequeCard'];
$Employment = $_SESSION['Employment'];
$income = $_SESSION['Income'];
$Income2 = $_SESSION['Income2'];
$Occupation = $_SESSION['Occupation'];
$Body = <<<EOD
<br><hr><br>
Goods: $goods <br>
Amount: $amount <br>
Total Cash: $Total_Cash <br>
Deposit: $Deposit <br>
Balance: $Balance
Nine Monthly Payments of : £ $Payments
Title: $Title <br>
Forname: $Forname <br>
Middle Name: $Middle_name <br>
Surname : $Surname <br>
Email: $email <br>
DOB: $DOB/$DOB2/$DOB3 <br>
Gender: $Gender <br>
Home_phone: $CheckboxGroup1 Mobile phone: $CheckboxGroup2 <br>
Home Phone number: $home_phone <br>
Mobile Phone number: $mobil_phone <br>
Marital_Status: $marital_status <br>
Occupancy : $Occupancy <br>
Dependants: $Dependants <br>
Correspondence Address: $Correspondence <br>
Street: $Street <br>
District: $District <br>
Town: $Town <br>
County: $County <br>
Country: $Country
Years: $Years
Months: $Months
Street2: $Street <br>
District2: $District2 <br>
Town2: $Town2 <br>
County2: $County2 <br>
Country2: $Country2
Years2: $Years2
Months2: $Months2
Street3: $Street3 <br>
District3: $District3 <br>
Town3: $Town3 <br>
County3: $County3 <br>
Country3: $Country3 <br>
Years3: $Years3 <br>
Months3: $Months3 <br>
Sort Code: $Sort_Code <br>
Account: $Account <br>
Years with the Bank: $Years_with_Bank <br>
Months with the Bank: $Months_with_Bank <br>
CreditCards: $CreditCard <br>
Cheque Card: $ChequeCard <br>
Employment: $Employment <br>
Income: £$income <br>
Income Frequency: $Income2 <br>
Occupation: $Occupation <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "content-type: text/html\r\n";
$succes = mail($webmaster, $emailsubject, $Body, $headers);
session_destroy();
/* Results rendered as HTML */
$theResults = <<<EOD
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Thank you! The Piano and Keyboard Shop Online</title>
<link rel="STYLESHEET" type="text/css" href="contact.css">
<link href="The Piano and Keyboard Shop.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h2>Thanks for your application!<br />
We endavour to get back to you as soon as possible with application results</h2>
Please contact us on 0116 2541053 if you have any questions regarding your finance application
Return to <a href="../index_main.php">Home Page</a>
<div id="advertising">
<div id="add_left"><a href="Contact.php">Contact us</a><br>
<a href="About.php">About us</a><br>
<a href="Finance.php">Finance</a><br>
</div>
<div id="adds_middle"><a href="term-conditions.php">Terms and Conditions</a><br>
<a href="Privacy-Policy.php">Privacy Conditions</a><br>
<a href="FAQ.php">FAQ</a><br>
</div>
<div id="adds_right"><a href="http://www.youtube.com/user/KeysoundWebsite">Follow us on YouTube</a><br>
<a href="https://twitter.com/KeysoundUK">Follow us on Twitter</a><br>
<a href="https://www.facebook.com/pages/Keysound/163590297024385">Follow us on Face book</a><br>
</div>
</div>
<div id="advertising"> <div id="copy"><img src="files/Images/copyright.gif" width="19" height="22">
</div> </div>
</body>
</html>
EOD;
echo "$theResults";
?>
Is there something wrong with my sessions or just something in the code?Standard Apple Mail. I'm running Yosemite 10.10.1, and I'm amazed to see that About Mail says it's Mail Version 8.1 (1993), copyright 1995-2014 Apple Inc.
Interesting thought, do you think that it doesn't like to work with itself? Actually, I'm fairly sure I've had the problem inside of other apps but I should document that. I'll keep notes to see where this happens. -
How to print logical page number in TOC of report
My report has three sections - header, main, trailer.
after each group break in the main section the page number is saved using the srw.get_page_num(pageNum).
this records are used to build the toc in the trailer section.
Problem: srw.get_page_num delivers only the logical pagenum of the section,
means if the header section spans more than one page (for example 2), the main section starts at physical pagenum 3.
If I don't know how many pages my header contains I never have the real page number in my toc, beacuse i have to add the number of "header pages" to the saved pagenum of the main section to compute the "physical pagenum".
Is there a possibility to save the physical pagenum in the header section (in a trigger) ?
Message was edited by:
[email protected]Thats my huge problem - i can not calculate the number of pages
nor in the main section neither in the header section.
The problem is not to know how many pages are in the trailor section.
I have to know, how many pages are in the header section without to start multiple the report.
If I have this number i can add it to the "logical" page number" of the main section to get the physical page number of the report.
the page numbers of the main section are available.
Message was edited by:
[email protected] -
Print JTable with Multiple pages and rows
I took the printing example at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/advprint.html#pe and modified it a bit to include the following:
1) To Print Multiple pages
2) To wrap lines that is too long for the column
3) To print with a more proffesional style, so that it doesn't look like a screen capture is printed
4) To align the numbers to the right and center column headings
import javax.swing.*;
import javax.swing.table.*;
import java.awt.print.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.Dimension;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import java.text.*;
public class Report implements Printable
private final int LEFT_ALIGN = -1;
private final int CENTER_ALIGN = 0;
private final int RIGHT_ALIGN = 1;
private JFrame frame;
private JTable tableView;
private String lastPrintDate;
private Font defaultFont;
private Font headerFont;
private Font footerFont;
private int headerHeight;
private int footerHeight;
private int cellBuffer = 5;
private boolean first_pass;
private ArrayList pages;
public Report()
frame = new JFrame("Sales Report");
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
final String[] headers =
"ID",
"Description",
"open price",
"latest price",
"End Date",
"Quantity"
int count = 0;
final Object[][] data =
{new Integer(count++), "Box of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of BirosBox of Biros ppppppppppppppp", "1.00", "4.99", new Date(), new Integer(200000)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)},
{new Integer(count++), "Blue Biro", "0.10", "0.14", new Date(), new Integer(1)},
{new Integer(count++), "legal pad", "1.00", "2.49", new Date(), new Integer(1)},
{new Integer(count++), "tape", "1.00", "1.49", new Date(), new Integer(1)},
{new Integer(count++), "stapler", "4.00", "4.49", new Date(), new Integer(1)},
{new Integer(count++), "Box of Biros", "1.00", "4.99", new Date(), new Integer(2)}
TableModel dataModel = new AbstractTableModel()
public int getColumnCount() { return headers.length; }
public int getRowCount() { return data.length;}
public Object getValueAt(int row, int col)
return data[row][col];
public String getColumnName(int column)
return headers[column];
public Class getColumnClass(int col)
return getValueAt(0,col).getClass();
public boolean isCellEditable(int row, int col)
return (col==1);
public void setValueAt(Object aValue, int row, int column)
data[row][column] = aValue;
tableView = new JTable(dataModel);
JScrollPane scrollpane = new JScrollPane(tableView);
scrollpane.setPreferredSize(new Dimension(500, 80));
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(BorderLayout.CENTER,scrollpane);
frame.pack();
JButton printButton= new JButton();
printButton.setText("print me!");
frame.getContentPane().add(BorderLayout.SOUTH,printButton);
// for faster printing turn double buffering off
RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
printButton.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent evt)
doPrint();
frame.setVisible(true);
* Reset variables before printing
private void prepareForPrint()
pages = new ArrayList();
first_pass = true;
* Display a print dialog with some hardcoded defaults
* The print fonts are also hardcoded
public void doPrint()
try
String jobName = "Java Report";
defaultFont = new Font("Arial", Font.PLAIN, 8);
footerFont = new Font("Arial", Font.PLAIN, 6);
headerFont = new Font("Arial", Font.BOLD, 10);
PrinterJob prnJob = PrinterJob.getPrinterJob();
prnJob.setPrintable(this);
PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
prnSet.add(new Copies(1));
prnSet.add(new JobName(jobName, null));
prnSet.add(MediaSizeName.ISO_A4);
PageFormat pf = prnJob.defaultPage();
pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
prnJob.setJobName(jobName);
PrintService[] services = PrinterJob.lookupPrintServices();
if (services.length > 0)
if (prnJob.printDialog(prnSet))
* Get print date
String dateFormat = "dd/MM/yyyy HH:mm:ss";
DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
lastPrintDate = m_DateFormat.format(new Date()).toString();
prepareForPrint();
prnJob.print(prnSet);
else
JOptionPane.showMessageDialog(frame, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
return;
catch (PrinterException e)
e.printStackTrace();
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
* Check if this is the first time the print method is called for this print action.
* It is not guaranteed that the print will be called with synchronous pageIndex'es,
* so we need to calculate the number of pages and which rows appear on which pages.
* Then the correct page will be printed regardless of which pageIndex is sent through.
if (first_pass)
calcPages(g, pageFormat);
first_pass = false;
// Stop printing if the pageIndex is out of range
if (pageIndex >= pages.size())
return NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
// The footer will be one line at the bottom of the page, cater for this.
g2.setFont(footerFont);
footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
g2.setFont(defaultFont);
FontMetrics fontMetrics = g2.getFontMetrics();
int fontHeight = fontMetrics.getHeight();
int fontDescent = fontMetrics.getDescent();
double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
// Shrink or expand the table to fit the page width
double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
// Calculate the width in pixels for each column
double[] columnWidths = new double[tableView.getColumnCount()];
for(int i = 0; i < tableView.getColumnCount(); i++)
columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
// Reset the view to the start of the page
g2.translate(0, 0);
// Draw a rectangle to see the printable area
g2.draw3DRect((int)pageFormat.getImageableX(),
(int)pageFormat.getImageableY(),
(int)pageFormat.getImageableWidth(),
(int)pageFormat.getImageableHeight(),
false);
// Calculate the header height
g2.setFont(headerFont);
fontMetrics = g2.getFontMetrics();
// Print the headers and retreive the starting position for the data
int next_row = printLine(g2, pageFormat, fontMetrics, -1, (int)pageFormat.getImageableY() + fontHeight, columnWidths);
g2.setFont(defaultFont);
fontMetrics = g2.getFontMetrics();
// Start printing the detail
ArrayList page = (ArrayList)pages.get(pageIndex);
int start = ((Integer)page.get(0)).intValue();
int end = ((Integer)page.get(1)).intValue();
for (int i = start; i <= end; i++)
next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
// Print the footer
g2.setFont(footerFont);
String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
g2.drawString(pageFooter,
(int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
(int)(pageHeight - fontDescent));
return PAGE_EXISTS;
* We can't guarantee that the same amount of rows will be displayed on each page,
* the row heights are dynamic and may wrap onto 2 or more lines.
* Thus we need to calculate the height of each row and then test how may rows
* fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
// The footer will be one line at the bottom of the page, cater for this.
g2.setFont(footerFont);
footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
g2.setFont(defaultFont);
FontMetrics fontMetrics = g2.getFontMetrics();
int fontHeight = fontMetrics.getHeight();
int fontDescent = fontMetrics.getDescent();
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
// Shrink or expand the table to fit the page width
double scale = pageWidth / (tableWidth+ (cellBuffer * tableView.getColumnCount()));
// Calculate the width in pixels for each column
double[] columnWidths = new double[tableView.getColumnCount()];
for(int i = 0; i < tableView.getColumnCount(); i++)
columnWidths[i] = (double)tableView.getColumnModel().getColumn(i).getWidth() * scale;
// Calculate the header height
int maxHeight = 0;
g2.setFont(headerFont);
fontMetrics = g2.getFontMetrics();
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = tableView.getColumnName(j).toString();
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
headerHeight = g2.getFontMetrics().getHeight() * maxHeight;
g2.setFont(defaultFont);
fontMetrics = g2.getFontMetrics();
int pageNum = 0;
int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
int prev_row = 0;
int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
int i = 0;
ArrayList page = new ArrayList();
page.add(new Integer(0));
for (i = 0; i < tableView.getRowCount(); i++)
maxHeight = 0;
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = tableView.getValueAt(i, j).toString();
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
prev_row = next_row;
next_row += (fontHeight * maxHeight);
// If we've reached the bottom of the page then set the current page's end row
if (next_row > bottom_of_page)
page.add(new Integer(i - 1));
pages.add(page);
page = new ArrayList();
page.add(new Integer(i));
pageNum++;
next_row = (int)pageFormat.getImageableY()
+ fontHeight
+ ((int)pageFormat.getHeight() * pageNum)
+ headerHeight;
bottom_of_page = (int)(pageFormat.getImageableHeight()
+ pageFormat.getImageableY())
+ ((int)pageFormat.getHeight() * pageNum)
- footerHeight;
//Include the current row on the next page, because there is no space on this page
i--;
page.add(new Integer(i - 1));
pages.add(page);
* Print the headers or a row from the table to the graphics context
* Return the position of the row following this one
public int printLine(Graphics2D g2,
PageFormat pageFormat,
FontMetrics fontMetrics,
int rowNum,
int next_row,
double[] columnWidths)
throws PrinterException
int lead = 0;
int maxHeight = 0;
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = null;
int align = LEFT_ALIGN;
if (rowNum > -1)
Object obj = tableView.getValueAt(rowNum, j);
if (obj instanceof Number)
align = RIGHT_ALIGN;
value = obj.toString();
else
align = CENTER_ALIGN;
value = tableView.getColumnName(j);
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
if (fontMetrics.stringWidth(value) < columnWidths[j])
// Single line
int offset = 0;
// Work out the offset from the start of the column to display alignment correctly
switch (align)
case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
default: offset = 0; break;
g2.drawString(value,
lead + (int)(pageFormat.getImageableX() + offset),
next_row);
else
for(int a = 0; a < numLines; a++)
//Multi-Line
int x = 0;
int width = 0;
for(x = 0; x < value.length(); x++)
width += fontMetrics.charWidth(value.charAt(x));
if (width > columnWidths[j])
break;
int offset = 0;
// Work out the offset from the start of the column to display alignment correctly
switch (align)
case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
default: offset = 0; break;
g2.drawString(value.substring(0, x),
lead + (int)(pageFormat.getImageableX() + offset),
next_row + (fontMetrics.getHeight() * a));
value = value.substring(x);
lead += columnWidths[j] + cellBuffer;
// Draw a solid line below the row
g2.draw(new Line2D.Double(pageFormat.getImageableX(),
next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent(),
pageFormat.getImageableY() + pageFormat.getImageableWidth(),
next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent()));
// Return the position of the row following this one
return next_row + (fontMetrics.getHeight() * maxHeight);
public static void main(String[] args)
new Report();
}Fixed some bugs and added a title. Just pass in a JTable and the class will do the rest.
import javax.swing.*;
import javax.swing.table.*;
import java.awt.print.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import java.text.*;
import java.math.*;
public class PrintJTable implements Printable
private final int LEFT_ALIGN = -1;
private final int CENTER_ALIGN = 0;
private final int RIGHT_ALIGN = 1;
private JFrame m_parent;
private String m_title;
private JTable tableView;
private String lastPrintDate;
private Font defaultFont;
private Font headerFont;
private Font footerFont;
private int headerHeight;
private int footerHeight;
private int cellBuffer = 5;
private boolean first_pass;
private ArrayList pages;
public PrintJTable(JFrame parent, JTable table)
m_parent = parent;
tableView = table;
doPrint();
public PrintJTable(JFrame parent, String title, JTable table)
m_parent = parent;
m_title = title;
tableView = table;
doPrint();
* Reset variables before printing
private void prepareForPrint()
pages = new ArrayList();
first_pass = true;
* Display a print dialog with some hardcoded defaults
* The print fonts are also hardcoded
public void doPrint()
try
String jobName = "Java Report";
defaultFont = new Font("Arial", Font.PLAIN, 8);
footerFont = new Font("Arial", Font.PLAIN, 6);
headerFont = new Font("Arial", Font.BOLD, 8);
PrinterJob prnJob = PrinterJob.getPrinterJob();
prnJob.setPrintable(this);
PrintRequestAttributeSet prnSet = new HashPrintRequestAttributeSet();
prnSet.add(new Copies(1));
prnSet.add(new JobName(jobName, null));
prnSet.add(MediaSizeName.ISO_A4);
PageFormat pf = prnJob.defaultPage();
pf.setOrientation(java.awt.print.PageFormat.PORTRAIT);
prnJob.setJobName(jobName);
PrintService[] services = PrinterJob.lookupPrintServices();
if (services.length > 0)
if (prnJob.printDialog(prnSet))
* Get print date
String dateFormat = "dd/MM/yyyy HH:mm:ss";
DateFormat m_DateFormat = new SimpleDateFormat(dateFormat);
lastPrintDate = m_DateFormat.format(new Date()).toString();
prepareForPrint();
prnJob.print(prnSet);
else
JOptionPane.showMessageDialog(m_parent, "No Printer was found!!", "Printer Error", JOptionPane.ERROR_MESSAGE);
return;
catch (PrinterException e)
e.printStackTrace();
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException
* Check if this is the first time the print method is called for this print action.
* It is not guaranteed that the print will be called with synchronous pageIndex'es,
* so we need to calculate the number of pages and which rows appear on which pages.
* Then the correct page will be printed regardless of which pageIndex is sent through.
if (first_pass)
calcPages(g, pageFormat);
first_pass = false;
// Stop printing if the pageIndex is out of range
if (pageIndex >= pages.size())
return NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
// The footer will be one line at the bottom of the page, cater for this.
g2.setFont(footerFont);
footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
g2.setFont(defaultFont);
FontMetrics fontMetrics = g2.getFontMetrics();
int fontHeight = fontMetrics.getHeight();
int fontDescent = fontMetrics.getDescent();
double pageHeight = pageFormat.getImageableHeight() + pageFormat.getImageableY();
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
// Shrink or expand the table to fit the page width
double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
// Calculate the width in pixels for each column
double[] columnWidths = new double[tableView.getColumnCount()];
double test = 0;
for(int i = 0; i < tableView.getColumnCount(); i++)
columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
test += columnWidths;
// Reset the view to the start of the page
g2.translate(0, 0);
// Draw a rectangle to see the printable area
g2.draw3DRect((int)pageFormat.getImageableX(),
(int)pageFormat.getImageableY(),
(int)pageFormat.getImageableWidth(),
(int)pageFormat.getImageableHeight(),
false);
// Calculate the header height
g2.setFont(headerFont);
fontMetrics = g2.getFontMetrics();
// Print the headers and retreive the starting position for the data
int next_row = (int)pageFormat.getImageableY() + fontMetrics.getHeight();
if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
g2.drawString(m_title,
(int)(pageFormat.getImageableX()),
next_row);
Color current_color = g2.getColor();
g2.setColor(Color.lightGray);
int y = next_row + fontMetrics.getDescent();
g2.draw(new Line2D.Double(pageFormat.getImageableX(),
y,
(pageFormat.getImageableY() + pageFormat.getImageableWidth()),
y));
g2.setColor(current_color);
next_row += fontMetrics.getHeight();
next_row = printLine(g2, pageFormat, fontMetrics, -1, next_row, columnWidths);
g2.setFont(defaultFont);
fontMetrics = g2.getFontMetrics();
// Start printing the detail
ArrayList page = (ArrayList)pages.get(pageIndex);
int start = ((Integer)page.get(0)).intValue();
int end = ((Integer)page.get(1)).intValue();
for (int i = start; i <= end; i++)
next_row = printLine(g2, pageFormat, fontMetrics, i, next_row, columnWidths);
// Print the footer
g2.setFont(footerFont);
String pageFooter = "Page " + (pageIndex + 1) + " - " + lastPrintDate;
g2.drawString(pageFooter,
(int)pageFormat.getWidth() / 2 - (fontMetrics.stringWidth(pageFooter) / 2),
(int)(pageHeight - fontDescent));
return PAGE_EXISTS;
* We can't guarantee that the same amount of rows will be displayed on each page,
* the row heights are dynamic and may wrap onto 2 or more lines.
* Thus we need to calculate the height of each row and then test how may rows
* fit on a specific page. eg. Page 1 contains rows 1 to 10, Page 2 contains rows 11 to 15 etc.
public void calcPages(Graphics g, PageFormat pageFormat) throws PrinterException
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
// The footer will be one line at the bottom of the page, cater for this.
g2.setFont(footerFont);
footerHeight = g2.getFontMetrics().getHeight() + g2.getFontMetrics().getDescent();
g2.setFont(defaultFont);
FontMetrics fontMetrics = g2.getFontMetrics();
int fontHeight = fontMetrics.getHeight();
int fontDescent = fontMetrics.getDescent();
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) tableView.getColumnModel().getTotalColumnWidth();
// Shrink or expand the table to fit the page width
double scale = (pageWidth - (cellBuffer * tableView.getColumnCount())) / tableWidth;
// Calculate the width in pixels for each column
double[] columnWidths = new double[tableView.getColumnCount()];
for(int i = 0; i < tableView.getColumnCount(); i++)
columnWidths[i] = (double)Math.floor(tableView.getColumnModel().getColumn(i).getWidth() * scale);
// Calculate the header height
int maxHeight = 0;
g2.setFont(headerFont);
fontMetrics = g2.getFontMetrics();
headerHeight = 0;
if ((m_title != null) && (!m_title.equalsIgnoreCase("")))
headerHeight = fontMetrics.getHeight();
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = tableView.getColumnName(j).toString();
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
headerHeight += g2.getFontMetrics().getHeight() * maxHeight;
g2.setFont(defaultFont);
fontMetrics = g2.getFontMetrics();
int pageNum = 0;
int bottom_of_page = (int)(pageFormat.getImageableHeight() + pageFormat.getImageableY()) - footerHeight;
int prev_row = 0;
int next_row = (int)pageFormat.getImageableY() + fontHeight + headerHeight;
int i = 0;
ArrayList page = new ArrayList();
page.add(new Integer(0));
for (i = 0; i < tableView.getRowCount(); i++)
maxHeight = 0;
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = formatObject(tableView.getValueAt(i, j));
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
prev_row = next_row;
next_row += (fontHeight * maxHeight);
// If we've reached the bottom of the page then set the current page's end row
if (next_row > bottom_of_page)
page.add(new Integer(i - 1));
pages.add(page);
page = new ArrayList();
page.add(new Integer(i));
pageNum++;
next_row = (int)pageFormat.getImageableY()
+ fontHeight
+ ((int)pageFormat.getHeight() * pageNum)
+ headerHeight;
bottom_of_page = (int)(pageFormat.getImageableHeight()
+ pageFormat.getImageableY())
+ ((int)pageFormat.getHeight() * pageNum)
- footerHeight;
//Include the current row on the next page, because there is no space on this page
i--;
page.add(new Integer(i - 1));
pages.add(page);
* Print the headers or a row from the table to the graphics context
* Return the position of the row following this one
public int printLine(Graphics2D g2,
PageFormat pageFormat,
FontMetrics fontMetrics,
int rowNum,
int next_row,
double[] columnWidths)
throws PrinterException
int lead = 0;
int maxHeight = 0;
for (int j = 0; j < tableView.getColumnCount(); j++)
String value = null;
int align = LEFT_ALIGN;
if (rowNum > -1)
Object obj = tableView.getValueAt(rowNum, j);
if (obj instanceof Number)
align = RIGHT_ALIGN;
value = formatObject(obj);
else
//align = CENTER_ALIGN;
value = tableView.getColumnName(j);
int numLines = (int)Math.ceil(fontMetrics.stringWidth(value) / columnWidths[j]);
if (numLines > maxHeight)
maxHeight = numLines;
if (fontMetrics.stringWidth(value) < columnWidths[j])
// Single line
int offset = 0;
// Work out the offset from the start of the column to display alignment correctly
switch (align)
case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)); break;
case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value)) / 2; break;
default: offset = 0; break;
g2.drawString(value,
lead + (int)(pageFormat.getImageableX() + offset),
next_row);
else
for(int a = 0; a < numLines; a++)
//Multi-Line
int x = 0;
int width = 0;
for(x = 0; x < value.length(); x++)
width += fontMetrics.charWidth(value.charAt(x));
if (width > columnWidths[j])
break;
int offset = 0;
// Work out the offset from the start of the column to display alignment correctly
switch (align)
case RIGHT_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))); break;
case CENTER_ALIGN: offset = (int)(columnWidths[j] - fontMetrics.stringWidth(value.substring(0, x))) / 2; break;
default: offset = 0; break;
g2.drawString(value.substring(0, x),
lead + (int)(pageFormat.getImageableX() + offset),
next_row + (fontMetrics.getHeight() * a));
value = value.substring(x);
lead += columnWidths[j] + cellBuffer;
// Draw a solid line below the row
Color current_color = g2.getColor();
g2.setColor(Color.lightGray);
int y = next_row + (fontMetrics.getHeight() * (maxHeight - 1)) + fontMetrics.getDescent();
g2.draw(new Line2D.Double(pageFormat.getImageableX(),
y,
(pageFormat.getImageableY() + pageFormat.getImageableWidth()),
y));
g2.setColor(current_color);
// Return the position of the row following this one
return next_row + (fontMetrics.getHeight() * maxHeight);
public String formatObject(Object obj)
String value = (obj == null) ? "" : obj.toString();
return value; -
In smartfrom create multiple page format
Hi expart..
In selection screen using select-options . i m puting the debit no 1100019222 to 1100019224 . the output shows only 1 page . n't showing 3 page .in smartform .Pls tell me how to print multiple page . i m using
data : l_sform type tdsfname,
l_fm_name type rs38l_fnam.
data : control_param like ssfctrlop.
clear control_param-no_dialog .
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : s_budat for bsid-budat ,
s_belnr for bsid-belnr .
SELECTION-SCREEN : END OF block b1 .
move 'ZS_FI_CREDITNOTE' to l_sform.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = l_sform
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = l_fm_name.
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
loop at itab_debit.
if sy-tabix = 1.
clear control_param-no_dialog .
else.
control_param-no_dialog = 'X'.
endif.
read table itab_basic with key belnr = itab_debit-belnr .
CALL FUNCTION l_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = control_param
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
itab_debit = itab_debit
itab_basic_value = itab_basic
itab_t030k = itab_t030k
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
new-page.
endloop.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
but n't working...
i ll give points...
regards
bhabaniHi,
I have Corrected the code.Check and reply.
data : l_sform type tdsfname,
l_fm_name type rs38l_fnam.
data : control_param like ssfctrlop.
clear control_param-no_dialog .
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : s_budat for bsid-budat ,
s_belnr for bsid-belnr .
SELECTION-SCREEN : END OF block b1 .
move 'ZS_FI_CREDITNOTE' to l_sform.
control_param-no_open = 'X'.
control_param-no_close = 'X'.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = l_sform
VARIANT = ' '
DIRECT_CALL = ' '
importing
fm_name = l_fm_name.
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
CALL FUNCTION 'SSF_OPEN'
EXPORTING
ARCHIVE_PARAMETERS =
user_settings = ' '
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJ =
output_options =
control_parameters = control_param
IMPORTING
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
loop at itab_debit.
if sy-tabix = 1.
clear control_param-no_dialog .
else.
control_param-no_dialog = 'X'.
endif.
read table itab_basic with key belnr = itab_debit-belnr .
CALL FUNCTION l_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = control_param
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
itab_debit = itab_debit
itab_basic_value = itab_basic
itab_t030k = itab_t030k
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
new-page.
endloop.
IF sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SSF_CLOSE'
IMPORTING
JOB_OUTPUT_INFO =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
error handling
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
analyse internal error table of Smart Forms
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
errortab = errtab.
IF NOT errtab IS INITIAL.
add your handling
ENDIF.
Regards,
Morris Bond.
Reward Points if helpful.
Maybe you are looking for
-
Java application problem in my 6021
Dear. I read from user guide for 6021, that this mobile is enabled with java technologyu. but when i try to get Java application from bluetooth, it says as invalid file format. what is the remedy for this issue? shall i update my mobile software? Whe
-
IPOD Shuffle not recognized by computer, and caused a USB power surge
Device is not recognized by computer, and I tried the listed support recommendations. The problem originated when I plugged the IPOD shuffle directly into the computer USB ( not using a hub), and this caused a warning window to appear saying unknown
-
How to Integrate SAP Business One to R/3
Hi guys, I have one client, this client is having the one head office and two branch offices. in the Head Office SAP R/3 is implemented Now the Client wants to implement SAP Business One in the branches. and want to integrate SAP Business One to R/3.
-
Display a seeded page as a region in another seeded page in OA Framework
Hi All, I'm newbee to OAF. I have a requirement of displaying a page (seeded), inside another seeded page. Previously that use to come as a link and on click of the link the next page opened up. The page here Im talking about is Notification details
-
Jar files created in test server page
Hey everyone, I have been trying to follow the steps listed at: http://e-docs.bea.com/wls/docs81/webserv/client.html#1070561 to create a client jar. I was trying to use the jars created when you test the server code by running the webpage and d/l the