Datum format displayed
Hi guys,
I need to help how I could change the datum format displayed from my Web App. I need instead of displaying 19 - Jul - 2013 international format 19 / 07 / 2013.
Many thanks for help!
You'll need to use javascript. Here some code to get you started:
$('.date').each(function(){
var date = $(this).text();
var dateBits = date.split("-");
// here you need to take dateBits[1] and match it to a corresponding
month digit place the final format inside some var e.g. finalDate and then
//write it back with
$(this).text(finalDate);
Cheers,
Mario
On Fri, Jul 19, 2013 at 6:23 PM, MyPragueInfo.com
Similar Messages
-
Problem in Date format display at table leve in 3.1i System
Hi Team,
I am facing an issue in 3.1i Prod System.
When i go and check at SE16 transaction and table name is TCURR. Execute the same i am getting date displayed in an unknown format.
For Eg:
Valid From Date
79908769
When i double click the same record, it displays the correct date format:
12/30/2009
when i download the table contents into excel sheet it should display the correct date format: instead of 79908769 to 12/30/2009.
But my problem is either to display the proper format of date at the table level.
Is there anyway to download the contents in correct dated format without disturbing the data elements or domain at table level.
Please let me know how to solve this problem.
Thanks,
Sunil KumarYou need to write abap program to download into the required format.
once you get the date field in your work area...
say you have date field in wa_data-budat , after that use the above syntax you will get the required format.
DATA :
v_date type sy-datum.
write wa_data-budat to v_date MM/DD/YYYY.
Please let me know if you need further information.
Regards
Satish Boguda -
Formatting display value in LOV
I have an LOV whose display value is a concatenation of 2 database fields. That works fine. But I want to put a tab in between the
2 fields, otherwise the values are displayed one right after the other, and the columns are out of alignment from one row to the next.
In sqlplus, I can do:
select CHR(9)||to_char(objecttype_id)||CHR(9)||objecttype_name from hdb_objecttype;
And I get:
12 acoustic velocity meter
1 basin
11 canal
2 climate site
3 confluence
4 diversion
10 hydro plant unit
5 hydro power plant
6 reach
7 reservoir
14 riverware dataobject
When I do the same thing in my LOV query, I get
12 acoustic velocity meter
1 basin
11 canal
2 climate site
3 confluence
4 diversion
10 hydro plant unit
5 hydro power plant
6 reach
7 reservoir
14 riverware dataobject
I've tried lpad and rpad, also. With blanks as padding they produce the above results. If I use a character such as '.' they behave
correctly, but I still don't have standard field widths because of the variance in character sizes.
Why won't any of this formatting work, and how can I get it to?
Thanks,
CarolHi, Carol,
In addition to what Max said, you may be displaying this in a region where whitespace is compressed; in which case you would need to use non-breaking spaces in place of regular spaces:
SELECT REPLACE ( RPAD ( TO_CHAR (objecttype_id)
, 10
) || objecttype_name
, CHR (38) || 'nbsp;' -- CHR (38) is ampersand
...Speaking of compressing whitespace, this site does it.
So when you say
CarolM2 wrote:
In sqlplus, I can do:
select CHR(9)||to_char(objecttype_id)||CHR(9)||objecttype_name from hdb_objecttype;
And I get:
12 acoustic velocity meter
1 basin
11 canal
2 climate site
3 confluence
4 diversion
10 hydro plant unit
5 hydro power plant
6 reach
7 reservoir
14 riverware dataobject
When I do the same thing in my LOV query, I get
12 acoustic velocity meter
1 basin
11 canal
2 climate site
3 confluence
4 diversion
10 hydro plant unit
5 hydro power plant
6 reach
7 reservoir
14 riverware dataobjectThey come out looking identical.
When you post formatted text (such as the results above) on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing. -
Problem with format displayed in output while using Pivot table
Hi All,
I am using Pivot table in 10.1.3.4.1 version for displaying dynamic type data. Data is coming fine but it is coming in very strange format. I have following two tables in my RTF Template.
Table1 using Pivot table
!http://farm3.static.flickr.com/2570/4092137243_924cca92ca.jpg!
Table 2 - A normal table
!http://img5.imageshack.us/img5/6651/table3p.jpg!
In the output PDF, “Table 2” shows data fine but “Table 1” shows very strange kind of behaviour if the columns exceed more than 5 in “Table 1” . If columns in Pivot table output are more than 5[at present according to my Table1 size] then columns more than 5 are shown on next page after Table 2 instead of displaying inside outer table “Table1“. Anyone has any idea what is the reason behind this strange behavior and how can I avoid it ?
Thanks
-SookieHi All,
I tried including following piece of code in RTF as mentioned here: [http://winrichman.blogspot.com/2009/05/cross-tab-by-limiting-number-of-colums.html] but as a result it showed blank page in report. Nothing else.
<?variable:G11;count(xdoxslt:distinct_values(/CUST_SUMMARY/LIST_CLIENT/CLIENT/LIST_OVERALL_ASSET_ALLOC/OVERALL_ASSET_ALLOC/ASSET_LIAB_DESC))?> <?variable:numcol;5?>
<?template:table1?><?param:cellvalue;1?><?param:maxcolvalue;5?>
<?choose:?>
<?when:$cellvalue < $maxcolvalue?>
!http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
<?call@inlines:table1?><?with-param:cellvalue;(number($cellvalue) + $numcol)?><?with-param:maxcolvalue;$maxcolvalue?><?end call?>
<?end when?>
<?end choose?>
<?end template?>
Also modified RTf as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H
G <?for-each@column:$c594//C1?><?if@column:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
ASSET_LIAB_DESC <?./H?>
E <?end if?><?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?><?if@cell:position() > $cellvalue and position() <= ($cellvalue + $numcol) ?>
99.00% <?./M1?>
E <?end if?><?end for-each?>
E <?end for-each?>I have this as my xml
<?xml version="1.0" encoding="UTF-8"?>
<CUST_SUMMARY>
<CLIENTID>1034</CLIENTID>
<LIST_CLIENT>
<CLIENT>
<CLIENT_ID>1034</CLIENT_ID>
<LIST_OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID>1110</PORTFOLIO_ID>
<PORTFOLIO_NAME>RM Managed</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>3.91466115811489974032104849667369505831E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>8.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Aggregate Portfolio</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Alternatives</ASSET_LIAB_DESC>
<PERCENT>2.93117485730770817994482449012020516681E-03</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Collectables</ASSET_LIAB_DESC>
<PERCENT>1.28354604277895431879689156620000563094E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>-3.6085338841885100259678951503326304942E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>2.71946226825880885538778864840827563226E-01</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Others</ASSET_LIAB_DESC>
<PERCENT>7.3140526307872865690096910040315224715E-02</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Deviation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Debt</ASSET_LIAB_DESC>
<PERCENT>.4</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Equity</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
<OVERALL_ASSET_ALLOC>
<PORTFOLIO_ID/>
<PORTFOLIO_NAME>Recommended Allocation</PORTFOLIO_NAME>
<ASSET_LIAB_DESC>Cash</ASSET_LIAB_DESC>
<PERCENT>.3</PERCENT>
</OVERALL_ASSET_ALLOC>
</LIST_OVERALL_ASSET_ALLOC>
</CLIENT>
</LIST_CLIENT>
</CUST_SUMMARY>and Original RTF looks like !http://farm3.static.flickr.com/2508/4104410643_f540c1d5a3_m.jpg!
with code as
C <?crosstab:c594;"//OVERALL_ASSET_ALLOC";"PORTFOLIO_NAME{,o=a,t=t}";"ASSET_LIAB_DESC{,o=a,t=t}";"PERCENT";"sum"?>
H <?horizontal-break-table:1?>
G <?for-each@column:$c594//C1?>
ASSET_LIAB_DESC <?./H?>
E <?end for-each?>
G <?for-each:$c594//R1?>
PORTFOLIO_NAME <?./H?>
G <?for-each@cell:.//R1C1?>
99.00% <?./M1?>
E <?end for-each?>
E <?end for-each?>Anyone can now tell my mistake? What wrong I am doing? Why it is showing blank page in output? How to solve this page breaking problem?
Thanks
-Sookie -
How to get the HTML data formatted display using the Rrt template
hi,
I have a table which has data with html tags in it.
eg as shown below.
sample text is as follows:
<BR>
<b>MY TEST HERE HAS SOME BOLD TEXT IN IT. THIS WHOLE LINE SHOULD BE BOLD</b><br>and the rest of the text will not be bold.
<BR><br>
now I want to be able to display this text with the proper format using BI publisher / rt template.
my report shows the tags as is instead of being formatted.
please let me know how i can fix this
Thanks
knuthttp://blogs.oracle.com/xmlpublisher/2007/01/02.
-
BEx Query Formating - Displaying both Sum and Average in the same report
Hi everybody,
I need to create a BW report in the below format,
Company Code Total Total Average
0001 0002 0003 0004
Doc Type
AV 10 10 10 10 40 10
RV 20 20 20 20 80 20
Getting the report till the 'Total' column is easy but having the 'Total Average' as a separate column is where I am stuck.
Having the company code in the rows, and not clolumns, would have solved the issue but I need to keep the above format. Also I do not want to
see the Total Average for every Company Code, just that of the 'Total'.
In the Query Designer, in the Column section I have first the 'Company Code' and then the 'Count' in a structure, so whatever I add to this structure,
is displayed for each Company Code, that means 2 columns for each Company code. This changes the format.
I cannot use the Cell Definition method here, as then it would be a static structure and the number of Company Codes are not fixed.
It would be great if somebody could provide some suggestions.
Thank you,
AjayHi Suman,
Thanks for the quick reply.
I have tried this, but again this will change the format. With the way you said, I will only get the report in the below 2 formats,
1. Company code in Free Charac, later drill down to Rows,
Doc Type Company Code
AV 0001 10
AV 0002 10
AV 0003 10
AV 0004 10
Total 40
RV 0001 20
RV 0002 20
RV 0003 20
RV 0004 20
Total 80
or 2. Company code in Free Charac, later drill down to Column,
Company Code
0001 0002 0003 0004
Total Total Avg Total Total Avg Total Total Avg Total Total Avg
Doc Type
AV 10 10 10 10 10 10 10 10
RV 20 20 20 20 20 20 20 20
Both the above are different from the format that I need. -
Is there a way to set a custom date format on a report column? I am trying to use a format mask and it doesn't appear to be working. Maybe someone can spot my mistake:
Query: Hours Worked = Clock_IN - Clock_OUT
Format mask for Clock In/Clock Out - DD-MON-YYYY HH24:MI (from list)
Format mask for Hours Worked column: HH:MI (hand typed)
actual display (Timecard ID is edit link):
Timecard Employee Vehicle Clock IN Clock OUT Hours Worked
6 20044 26045 30-JUN-2006 13:28 30-JUN-2006 13:31 +000000000 00:03:43.000000
28 20044 144 06-JUL-2006 10:11 06-JUL-2006 10:39 +000000000 00:28:43.000000
48 20044 144 07-JUL-2006 09:03 07-JUL-2006 16:30 +000000000 07:27:50.000000
108 20044 26045 18-JUL-2006 15:35
128 20044 144 19-JUL-2006 14:57 19-JUL-2006 15:02 +000000000 00:05:06.000000These programs also..
GFW_PROG_BAR : Bar chart example
GFW_PROG_PIE: Pie chart example -
Report Formating: Display defaults of scaling factors
Hi,
I have an issue with scaling factors for a query. I have set scaling factor 1,000,000 for amount which is displaying in wrong portion of the format which is visible in the coloums but it should be defaulted to rows.
tTable below will explain issue clearly
Desired display
Amount Variance
1,000,000 1,000,000
Curr Asts (323) 4 .5%
Derivatives 444 13 .4%
Curr Liabils 513 2 .2%
Current display is
Amount Variance
Curr Assets 1,000,000 (323) 4 .5%
Derivatives 1,000,000 444 13 .4%
Curr Liabils 1,000,000 513 2 .2%
I want the format to be as in the first case. Any suggestions and how to achieve the required display.
Thanks in Advance. Please throw some light.
Banu
Edited by: Ban513 on Jan 3, 2011 2:06 PMHi Volker,
go back to your query, and create a calculated KF with NODIM(key figure) - that will remove the currency from your report. The scaling factors are to show the factor of 10 that you are using scaling (for example thousands). There is no actual way to do this in the report designer.
good luck
Pasha -
Hi!
The date originally displayed in YYYY/MM/DD format. But, don't know what'd done, the date shown in DD-MMM-YYYY. I've set the NLS_DATE_FORMAT in registry.
Please tell me how to reset displaying date in YYYY/MM/DD format?
Thanks a lot.hi
use this command
ALTER SESSION SET NLS_DATE_FORMAT= "YYYY/MM/DD";
go to
http://www.experts-exchange.com/Databases/Oracle/Q_10331751.html -
EBS R12 date format display error?
Hi all,
I am opening forms in EBS R12 but all the dates value displayed are DD-MM-RRRR instead
of the format like 21-04-2008, how do I resolve this please?
Thanks a lotHi all,
I am opening forms in EBS R12 but all the dates value
displayed are DD-MM-RRRR instead
of the format like 21-04-2008, how do I resolve this
please?
Thanks a lotWhat is the difference? if you need it in a different format, can you apply a format mask?
Thanks,
Chiru -
Currency format displayed differently
Hi Gurus,
I had created PO with 1,600,000 JPY currency, when I tried to check the print preview , it is appearing like 1.600.000 JPY. decimals are appearing instead of commas.
Could you please suggest why these difference is appearing in PO display and in preview..and where these settings will be doe to reflect..
Regards
SubbuDear,
Check : Currency field to be displayed with commas and asterisks(formatting)
Re: sap script-amount format
http://help.sap.com/saphelp_erp2004/helpdata/EN/ff/4649b1f17411d2b486006094192fe3/content.htm
Regards,
Syed Hussain. -
PhotoBooth in Leopard, how to keep the format displayed for the burst mode
Hi,
I've used the new photobooth.
I've made some pictures with the burst mode.
In PhotoBooth the result is good : like this : http://images.apple.com/macosx/features/images/300photobooth20071016.png
But if i want to send the picture by mail, my picture is just 4 picture in a square ... no as fun as the one displayed in PhotoBooth
Do you know if we can keep the format seen in photobooth ???Hi
Just tried and with the photo showing in the main photoshop window hold the shift/apple(cmd)/4 keys and you will see a cross hair, click and drag that from the top left of the window to the bottom right and release.
You should now have a grab of the pic on you desktop.
Tony -
Why is my finished project in 16:9 format displaying in 4:3 after export??
After completing a 27 minute wedding video project in HDV format (16:9) I exported it using Quicktime conversion - but the finished .mov file displays in 4:3 format. To export the file, I had selected the Apple Intermediate codec (Quality:medium), and Export Size settings of 1280 x 720. I checked the "Preserve aspect ratio box using "Letterbox" rather than "crop" or "fit within dimensions" since I could find no instructions in the manual or other FCE books I have.
Under "Dimensions", I could have selected a different set-up such as "HD 1920 x 1080 16:9" - would that have produced the desired results? (ie, a 16:9 finished .mov file?) Since I am planning to move this into iDVD I need to get the finished .mov file into 16:9 format before attempting to build the DVD.
Any help on this question will be very appreciated, as the production of the (unusable) 4:3 file took about 2.5 hours to encode and I am reluctant to experiment further without some more knowledgeable guidance. Any "takers" on this one ???Tom - Thanks so much for your quick response - - I'm trying to get to a 16:9 finished ".mov" file and create a DVD using iDVD. I apparently over-complicated things by selecting"Export using Quicktime conversion" rather than choosing "Export > Quicktime Movie". After a second attempt using the latter choice, I've now got a finished .mov file in 16:9 format!
Hope to see your FCE 4.0 book out soon - I'll be "first in line" !! -
Hi I need to dispaly some data in text in the form of a table like
starttime | endtime | Count
100 | 203 | 10
I used this String.format() to format the string. But because of the different width of a character and an integer, the textual representaion of the table is getting misaligned. It gets displayed as
starttime | endtime | Count
100 | 203 | 10
For longer integers more drastic misalignment is witnessed between those integers and the column names. Is there any way i could fix this?whoami wrote:
I used this String.format() to format the string. But because of the different width of a character and an integer,There is no such distinction. Either it's a proportional or a monospaced font. Make sure you use monospaced.
the textual representaion of the table is getting misaligned. Representation where? -
Text format + attached image files or Html format + displayed images ?
Hi, I have this kind of probleme and I need some help.
(Code : see below)
I want to send a mail with some attached image files.
For the message part, I create a MimeBodyPart and add two kinds of message (text or html) and this part is multipart/alternative.
For the attachment part, I create another MimeBodyPart and I set the Header like this : xxx.setHeader("Content-ID", "<image>").
When I use outlook (html format) , I receive a mail with the picture displayed at the bottom, it's perfect.
However the problem is for the mailbox which is in text mode, I receive a mail with message + attachment files, but I also have some image frames generated by xxx.setHeader("Content-ID", "<image>") I guess.
Who can give me a hand to implement something that able to make difference according to text format or html format.
I post my code here, thanks a lot :
//set Message
msg.setText(pMsgText, DEFAULT_CHARSET);
// Partie Texte brut
MimeBodyPart textPart = new MimeBodyPart();
String header = "";
textPart.setText(header + pMsgText, DEFAULT_CHARSET);
textPart.setHeader(
"Content-Type",
"text/plain;charset=\"iso-8859-1\"");
textPart.setHeader("Content-Transfert-Encoding", "8bit");
// Partie HTML
MimeBodyPart htmlPart = new MimeBodyPart();
String images = BTSBackUtil.generateImgSrc(pictureContainers.length);
String endPart = "</div>\n</body>\n</html>";
htmlPart.setText(pMsgTextHTML+images+endPart);
htmlPart.setHeader("Content-Type", "text/html");
// create the mail root multipart
// Multipartie
Multipart multipart = new MimeMultipart("mixed");
// create the content miltipart (for text and HTML)
MimeMultipart mpContent = new MimeMultipart("alternative");
// create a body part to house the multipart/alternative Part
MimeBodyPart contentPartRoot = new MimeBodyPart();
contentPartRoot.setContent(mpContent);
// add the root body part to the root multipart
multipart.addBodyPart(contentPartRoot);
// add text
mpContent.addBodyPart(textPart);
// add html
mpContent.addBodyPart(htmlPart);
// this part treates attachment
if (pictureContainers != null){
PictureContainer pictureContainer = new PictureContainer();
String fileName = "";
for(int i = 0; i < pictureContainers.length; i++) {
pictureContainer = pictureContainers;
byte[] bs = pictureContainer.getImgData();
fileName = "image" + i +".jpg";
DataSource dataSource = new ByteArrayDataSource(fileName, "image/jpeg", bs);
DataHandler dataHandler = new DataHandler(dataSource);
MimeBodyPart mbp = new MimeBodyPart();
mbp.setDataHandler(dataHandler);
mbp.setHeader("Content-ID", "<image"+i+">");
mbp.setFileName(fileName);
multipart.addBodyPart(mbp);
// end attachment
msg.setContent(multipart);Hi All!!! I have created this code , i hope this w'll solve u'r problem , this code display u'r html text and display the images below on it, no need to attach the image...... byee.
package Temp;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.activation.URLDataSource;
import javax.mail.Authenticator;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class HtmlImageExample {
public static void main (String args[]) throws Exception {
String host = "smtp.techpepstechnology.com";;
String from = "[email protected]";
String to = "[email protected]";
//String to = "[email protected]";
String dir=null;
//String file = "C://NRJ/EmailApp/src/java/MailDao//clouds.jpg"];
//File file = new File("C:\\NRJ\\EmailApp\\src\\java\\Temp
Sunset.jpg");
// Get system properties
//Properties props = System.getProperties();
HtmlImageExample html1 = new HtmlImageExample();
html1.postImage(to,from);
// Setup mail server
String SMTP_HOST_NAME = "smtp.techpepstechnology.com";//smtp.genuinepagesonline.com"; //techpepstechnology.com";
String SMTP_AUTH_USER = "[email protected]"; //[email protected]"; //techpeps";
String SMTP_AUTH_PWD = "demo"; //techpeps2007";
//my code
public void postImage(String to, String from) throws MessagingException, FileNotFoundException, IOException
Properties props = System.getProperties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
// props.load(new FileInputStream(file));
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);
// Create the message
Message message = new MimeMessage(session);
// Fill its headers
message.setSubject("Embedded Image");
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setContent
h1. This is a test
+ "<img src=\"http://www.rgagnon.com/images/jht.gif\">",
"image/jpeg");
// Create your new message part
//BodyPart messageBodyPart = new MimeBodyPart();
//mycode
MimeMultipart multipart = new MimeMultipart("related");
MimeBodyPart mbp1 = new MimeBodyPart();
// Set the HTML content, be sure it references the attachment
String htmlText = "<html>"+
"<head><title></title></head>"+
"<body>"+
" see the following jpg : it is a car!
"+
h1. hello
"+
//"<IMG SRC=\"CID:Sunset\" width=100% height=80%>
"+
"<img src=\"http://www.yahoo.com//70x50iltA.gif\">"+
" end of jpg"+
"</body>"+
"</html>";
mbp1.setContent("h1. Hi! From HtmlJavaMail
<img src=\"cid:Sunset\">","text/html");
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.setText("This is a Second Part ","html");
// Fetch the image and associate to part
//DataSource fds=new URLDataSource(new URL("C://NRJ//MyWeb//logo.gif"));
FileDataSource fds = new FileDataSource("C://NRJ//MyWeb//Sunset.jpg");
mbp2.setFileName(fds.getName());
mbp2.setText("A Wonderful Sunset");
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setHeader("Content-ID","<Sunset>");
// Add part to multi-part
multipart.addBodyPart(mbp1);
multipart.addBodyPart(mbp2);
message.setContent(multipart);
// Send message
Transport.send(message);
//mycode
private class SMTPAuthenticator extends javax.mail.Authenticator
public PasswordAuthentication getPasswordAuthentication() {
String username = SMTP_AUTH_USER;
String password = SMTP_AUTH_PWD;
return new PasswordAuthentication(username, password);
Maybe you are looking for
-
How to have Multiple Configurations for a Flex Application
Hi All, I've seen this question asked in various forms multiple times, but never answered: How do you set up a FLEX configuration to have different configurations for development (local), test server, staging server, beta server, and production serve
-
How can i print between my galaxy s4 and hp officejet 150 mobile all in one printer
i have connected my hp officejet 150 mobile all-in-one printer to my lap top. Now I want to connect my printer to my smartphone galaxy s4 via bluetooth but the phone is new and I am not sure next steps. Help. This question was solved. View Solution
-
hi gurus, In my report program i have a monthly report displaying the data for that month. 1. Now in my ALV grid i want The SUB-TOTALS for the work center wise data for a field of the alv. there are many workcenters data in my report. So after the
-
Apple TV using eduroam.
We want to use the apple tv as an academic tool. The fact is that all of us use an Apple device as a Lab Journal, so we want to have Apple tv in the lab. As part of the university, our network is Eduroam, a secure, world-wide roaming access service.
-
Performance Tuning : Query session
Dear Friends, I am working with Hyperion Interactive reporting and I am very new to this environment, I am having a query session with 11 tables all are simple joins. when ever I am processing the query it talks long time to fetch the data ofcourse i