File - Side Section

Transcription

File - Side Section
Internet
Introduction
Internet is the largest computer network system in the world. It is a global network of Computers. Millions of Computers around the world can share any information
at a time by using this worldwide network system. The Internet is an ocean of information accessible to people across the world, but the way it can be used on various platform is different.
The Internet consists of millions of Computer networks, connected together
around the world. A network is a group of connected Computers each other. There are
no government rule and regulation for Internet and no one censors the information
available in the Internet.
The Internet is an inter-connection between several computers of different
types belonging to various networks all over the globe. It is a network of network.
A Brief History of the Internet
In 1969, the Department of Defense (DOD) of the United States started a project to allow researchers and military personal to communicate with each other in an emergency. The project is called ARPAnet (Advance Research Projects Administration network)
and it is the foundation of the Internet. It began in a modest way with one computer in
California and three in Utah. Later, to share the software and hardware resources, the
military allowed universities to join the network, from where the students caught up
with it and developed much of the software, giving birth to the now so very popular Internet.
Throughout the 1970’s, what would later become the Internet was developed.
While mostly military personal and scientist used it in its early days, the advent of the
World Wide Web in the early 1990’s changed all that.
The World Wide Web (WWW)
1. Tim Berners –Lee, a software engineer, invented the World Wide Web in 1991.
2. The Web is a system of Internet Severs that supports specially – formatted documents.
3. These specially formatted documents are text documents created in HTML, a formatting language. In conjunction with the World Wide Web, your Web browser interprets these text documents so they become Web pages.
4. Web pages contain formatted text, graphics, sound, animation and video, allowing point and
click navigation.
Internet and Word Wide Web
Many people use the terms Internet and World Wide Web interchangeably, but
in fact the two terms are not synonymous. The Internet and the World Wide Web are
two separate but related things. The Internet is a massive network of networks, a networking infrastructure. It connects millions of computers together globally, forming a
network in which any computer can communicate with any other computer as long as
they are both connected to the Internet. Information that travels over the Internet does
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 1
so via a variety of languages known as protocols. The World Wide Web or simply Web is
a way of accessing information over the medium of the Internet. The Web uses the
HTTP protocol, only one of the languages spoken over the Internet, to transmit data.
The Web also utilizes browsers, such as Internet Explorer or Mozilla Firefox, to access
Web documents called Web Pages that are linked to each other via hyperlinks. Web
documents also contain graphic, sound, text and video. The Web is just one of the ways
that information can be disseminated over the Internet. The Internet not the Web is also used for email, which relies on SMTP, Usenet news group, instant messaging and FTP.
So the Web is just a portion of the Internet, albeit a large portion, but the two terms are
not synonymous and should not be confused.
How does Computer Works
Transmission Control Protocol / Internet Protocol (TCP/IP) prepares the data to
be sent and received. TCP/IP ensures that a Macintosh network can exchange data with
a Windows, or a UNIX network, and vice- versa.
The file that you are sending does not travel to your friends computers directly,
or even in a single continuous stream. The file you are sending gets broken up into separate data packets. The Internet Protocol side of TCP/IP labels each packet with the
unique Internet address, or IP address of your friends’ computer. Since these packets
will travel separates routes, some arriving sooner than others, the Transmission Control
Protocol side of TCP/IP assigns a sequence numbers to each of packets. These sequence
numbers will tell the TCP/IP in your friends’ computers how to reassemble the packets
once he receives them. Amazingly, the complicated process of TCP/IP takes place in a
matter of milliseconds.
The packets are then sent from one “router” to the next. Each router reads the
IP address of the packet and decides which path will be the fastest. Since the traffic on
these paths is constantly changing each packet may be sent a different way.
Internet experience all you really need is either Internet Explorer or Mozilla Firefox. In addition to displaying Web pages they also include options for email. They can also serve as newsreaders.
Common Terminologies
Some of the most commonly used terminologies related to www are:
Website:
Website is the location of web pages created by any Person, Organizations, Universities,
and Government agencies to provide information regarding them like
www.himalkhabar.com. Each and every website has its own address, is called Internet
Address. After connecting to the Internet, we have to search any information of related
websites.
Webpage:
Webpage is the collection of information that is stored in the website. The www consists
of a huge collection of documents with related websites called webpage. Webpage provides vast amount o information of related websites.
Browser:
A browser is software application used to locate and display Webpage. The most popular browsers are Microsoft Internet Explorer and Mozilla Firefox. Both of these are
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 2
graphical browser, which mean that they can display graphics as well as text. In addition, most modern browsers can present multimedia information, including sound and
video, though they require plug-ins for some formats.
Browser is client software that allows a user to display and interact with a hypertext
documents. Remember, along with a computer equipped with a modem, you need a
piece of software called a web browser to navigate the web.
Web Server:
A computer that is maintaining by a system administrator or Internet service provider
(ISP) and that responds to requests from a user’s browser. A web server is a site on
which the WebPages are kept. It is a program that responds to requests from web
browsers to retrieve resources.
Home Page:
The home page is the first page of the web site.
Hyperlink:
An element is an electronic document that links to another place in the same
document or another different document. Typically, you click on the hyperlink to follow
the link. Hyperlinks are the most essential ingredient of all hypertext systems, including
the World Wide Web.
HTML:
Hypertext Markup Language (HTML) is the encoding scheme used to create a
web document.
URL:
Uniform Resource Locater (URL) is a web-addressing scheme that spells our exact location of an Internet resource.
ISP:
To access the Internet, you need a computer equipped with modem and web browser,
but you’ll also need an ISP. Internet Service Provide (ISP) is companies that provide
access to the Internet and the World Wide Web (WWW).
The ISP software package usually includes:
1. User Name
2. Password
3. Access Phone Number
Protocol:
It is a set of rules and conventions for sending information over a network.
TCP/IP:
It stands for Transmission Control Protocol / Internet Protocol. It is a set of networking
protocols used on the Internet that provides communications across interconnected
computer networks.
HTTP:
Hypertext Transfer Protocol (HTTP) is a protocol used on the web to transfer
hypertext documents.
FTP:
File Transfer Protocol (FTP) is protocol that allows this viewing, downloading, and uploading of flies on flies on remote computers.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 3
What Internet Offers?
1.
2.
3.
4.
5.
The Internet offers many fun and exciting features. However, Internet offers mainly the
followings features: Electronic Mail (Email)
Chatting
E-commerce
Entertainment
Getting Information
Equipment Needed for Internet
1.
2.
3.
4.
5.
You need specific equipments and programs to access the Internet. These are as follows:Computer
Modem (Modulator and Demodulator),Cable Modem, Router etc
Internet Programs (Web Browsers etc)
Telephone line, Cable etc.
ISP
Electronic Mail (Email)
Email Address:
E-mail address is the location of individual’s mailbox on the Internet. An email address is
required to send and receive email. Email usually consists or three parts: a user name,
an “at” symbol (@), and a domain name. For example: - [email protected], [email protected].
Domain Name:
Denote the name of a specific Internet area controlled by a company, government, or
organization. Example: - …@mos.com.np, …@wlink.com.np.
The domain name usually consists of two pieces of identifying information. The first
piece is the name of the email server and is located to the right of @ symbol. For example: - ntc is the name of the email server. The second piece, usually three letters extensions, indicates the top-level domain. They are separated by periods, called dots.
Top Level Domains
Top level domains may help you figures out the type of organization the recipient of associated with. If there is a two-letter extension, it is usually a country code. Nepal uses
“np”.
Extension
Meaning
Example
.com
Commercial Orwww.yahoo.com,
ganization
.org
Non Profit Organiwww.radiosagarmatha.org
zation
.gov
Government
www.doe.gov.np
.mil
Military
www.army.mil
.edu
Educational Orwww.tuexam.edu.np
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 4
.net
ganization
Network Organization
www.ntc.net.np
Chatting
Chatting is the process of meeting other people and communicating with them via net. You
need an E-mail ID (either Yahoo or Hotmail) to enter into the chat. So first make an ID
using respective website. After then install latest either Yahoo Messenger of MSN Messenger. Open your respective messenger program. Then you will see the following
screen. Type ID and Password then click on Sign In button. It is necessary to type full ID
(in case of Hotmail) and just ID for Yahoo.
Web page - A Web page is a simple text file that contains not only text, but also a set of
HTML tags that describe how the text should be formatted when a browser displays it
on the screen. The tags are simple instructions that tell the Web browser how the page
should look when it is displayed. The tags tell the browser to do things like change the
font size or color, or arrange things in columns. The Web browser interprets these tags
to decide how to format the text onto the screen.
HTML - HTML stands for Hyper Text Markup Language. A "markup language" is a computer
language that describes how a page should be formatted. If all you want to do is display
a long string of black and white text with no formatting, then you don't need HTML. But
if you want to change fonts, add colors, create headlines and embed graphics in your
page, HTML is the language you use to do it.
Web browser - A Web browser, like Netscape Navigator or Microsoft Internet Explorer, is a
computer program (also known as a software application, or simply an application)
that does two things:
A Web browser knows how to go to a Web server on the Internet and request a page, so
that the browser can pull the page through the network and into your machine.
A Web browser knows how to interpret the set of HTML tags within the page in order to
display the page on your screen as the page's creator intended it to be viewed.
Web server - A Web server is a piece of computer software that can respond to a browser's
request for a page, and deliver the page to the Web browser through the Internet. You
can think of a Web server as an apartment complex, with each apartment housing
someone's Web page. In order to store your page in the complex, you need to pay rent
on the space. Pages that live in this complex can be displayed to and viewed by anyone
all over the world. Your landlord is called your host, and your rent is usually called your
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 5
hosting charge. Every day, there are millions of Web servers delivering pages to the
browsers of tens of millions of people through the network we call the Internet.
It is extremely easy to experiment with Web pages without using a server. Your browser can
view the Web pages you create from your personal machine. Once you understand how
to create your own pages, it is likely that you will want to put them "out on a server," so
that people around the world can load your pages and read them. We will talk about
how to do that at the end of this article.
The Basic Process
At the most basic level possible, the following diagram shows the steps that brought that page to your
screen:
Your browser formed a connection to a Web server, requested a page and received it.
Behind the Scenes
If you want to get into a bit more detail on the process of getting a Web page onto your
computer screen, here are the basic steps that occurred behind the scenes:
The browser broke the URL into three parts:
1. The protocol ("http")
2. The server name ("www.himalkhabar.com")
3. The file name ("web-server.htm")
• The browser communicated with a name server to translate the server name "
www.himalkhabar.com " into an IP Address, which it uses to connect to the server machine.
• The browser then formed a connection to the server at that IP address on port 80. Following the
HTTP protocol, the browser sent a GET request to the server, asking for the file "http://
www.himalkhabar.com /web-server.htm."
• The server then sent the HTML text for the Web page to the browser.
• The browser read the HTML tags and formatted the page onto your screen.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 6
The Internet
So what is "the Internet"? The Internet is a gigantic collection of millions of computers, all
linked together on a computer network. The network allows all of the computers to
communicate with one another. A home computer may be linked to the Internet using a
phone-line modem, DSL or cable modem that talks to an Internet service provider (ISP).
A computer in a business or university will usually have a network interface card (NIC)
that directly connects it to a local area network (LAN) inside the business. The business
can then connect its LAN to an ISP using a high-speed phone line .
ISPs then connect to larger ISPs, and the largest ISPs maintain fiber-optic "backbones" for an entire
nation or region. Backbones around the world are connected through fiber-optic lines, undersea cables
or satellite links (see An Atlas of Cyberspaces for some interesting backbone maps). In this way, every
computer on the Internet is connected to every other computer on the Internet.
Clients and Servers
In general, all of the machines on the Internet can be categorized as two types: servers and
clients. Those machines that provide services (like Web servers or FTP servers) to other
machines are servers. And the machines that are used to connect to those services are
clients. When you connect to Yahoo! at www.yahoo.com to read a page, Yahoo! is
providing a machine (probably a cluster of very large machines), for use on the Internet,
to service your request. Yahoo! is providing a server. Your machine, on the other hand,
is probably providing no services to anyone else on the Internet. Therefore, it is a user
machine, also known as a client. It is possible and common for a machine to be both a
server and a client, but for our purposes here you can think of most machines as one or
the other.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 7
A server machine may provide one or more services on the Internet. For example, a server machine
might have software running on it that allows it to act as a Web server, an e-mail server and an FTP
server. Clients that come to a server machine do so with a specific intent, so clients direct their requests
to a specific software server running on the overall server machine. For example, if you are running a
Web browser on your machine, it will most likely want to talk to the Web server on the server machine.
Your Telnet application will want to talk to the Telnet server, your e-mail application will talk to the email server, and so on...
IP Addresses
To keep all of these machines straight, each machine on the Internet is assigned a unique
address called an IP address. IP stands for Internet protocol, and these addresses are
32-bit numbers, normally expressed as four "octets" in a "dotted decimal number." A
typical IP address looks like this:
216.27.61.137
The four numbers in an IP address are called octets because they can have values between 0 and 255,
which is 28 possibilities per octet.
Every machine on the Internet has a unique IP address. A server has a static IP address that does not
change very often. A home machine that is dialing up through a modem often has an IP address that is
assigned by the ISP when the machine dials in. That IP address is unique for that session -- it may be
different the next time the machine dials in. This way, an ISP only needs one IP address for each modem
it supports, rather than for each customer.
As far as the Internet's machines are concerned, an IP address is all you need to talk to a server. For
example, in your browser, you can type the URL http://209.116.69.66 and arrive at the machine that
contains the Web server for HowStuffWorks. On some servers, the IP address alone is not sufficient, but
on most large servers it is -- keep reading for details.
Domain Names
Because most people have trouble remembering the strings of numbers that make up IP
addresses, and because IP addresses sometimes need to change, all servers on the
Internet also have human-readable names, called domain names. For example,
www.howstuffworks.com is a permanent, human-readable name. It is easier for most of
us to remember www.howstuffworks.com than it is to remember 209.116.69.66.
The name www.himalkhabar.com actually has three parts:
1.
2.
3.
The host name ("www")
The domain name ("himalkhabar")
The top-level domain name ("com")
Domain names within the ".com" domain are managed by the registrar called VeriSign.
VeriSign also manages ".net" domain names. Other registrars (like RegistryPro, NeuLevel
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 8
and Public Interest Registry) manage the other domains (like .pro, .biz and .org).
VeriSign creates the top-level domain names and guarantees that all names within a
top-level domain are unique. VeriSign also maintains contact information for each site
and runs the "whois" database. The host name is created by the company hosting the
domain. "www" is a very common host name, but many places now either omit it or
replace it with a different host name that indicates a specific area of the site. For
example, in encarta.msn.com, the domain name for Microsoft's Encarta encyclopedia,
"encarta" is designated as the host name instead of www.
Name Servers
A set of servers called domain name servers (DNS) maps the human-readable names to the
IP addresses. These servers are simple databases that map names to IP addresses, and
they are distributed all over the Internet. Most individual companies, ISPs and
universities maintain small name servers to map host names to IP addresses. There are
also central name servers that use data supplied by VeriSign to map domain names to IP
addresses.
If you type the URL "http://www.howstuffworks.com/web-server.htm" into your browser, your browser
extracts the name "www.howstuffworks.com," passes it to a domain name server, and the domain
name server returns the correct IP address for www.howstuffworks.com. A number of name servers
may be involved to get the right IP address. For example, in the case of www.howstuffworks.com, the
name server for the "com" top-level domain will know the IP address for the name server that knows
host names, and a separate query to that name server, operated by the How Stuff Works ISP, may
deliver the actual IP address for the How Stuff Works server machine.
So here it is: The Internet is made up of millions of machines, each with a unique IP address. Many of
these machines are server machines, meaning that they provide services to other machines on the
Internet. You have heard of many of these servers: e-mail servers, Web servers, FTP servers, Gopher
servers and Telnet servers, to name a few. All of these are provided by server machines.
Introduction to Microsoft Word 2007
Word Processor Software Package
Word Processor is a software package that helps you to create and edit documents. Creating a
document involves typing in the internal memory of the computer and saving it by writing it onto the
disk. Editing a document involves correcting the spelling mistakes, if any, and deleting or moving words,
sentences or paragraphs.
The following are some of popular word processors:
1. Word Perfect
2. Word Star
3. Microsoft Word
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 9
Microsoft word is very powerful, advance and useful word-processing software which is developed by Microsoft Corporation, USA. It has all kind of word processing facilities like to create, edit, format, save and print document, to check spellings and grammar, to search for synonyms and antonyms
(thesaurus), to work with newspaper columns, tables, to add footnotes and endnotes, page number,
special symbols, bookmarks, comments, to insert the picture, objects. Its extension is DOCX.
In spite of above-mentioned matters, there are many other features available in Microsoft
Word, which help us to furnish a document (e.g. report, letter, essay etc.) in such a way that we can
produce the professional outlook. Now a day, Microsoft Word is considered as the best word-processing
software.
To Start Microsoft Word 2007
1.
2.
3.
4.
1.
2.
3.
4.
5.
6.
Click on Start menu.
Choose Program
Choose Microsoft Office
Choose Microsoft Office Word 2007
OR
Click on Start Button
Choose Run
Then a dialogue box will display.
Type the text "winword" into Run box.
Click on OK
Then your required program (Word) will open
Creating, Saving, and Opening a Document
Create a new file
1. Click the Microsoft Office Button, and then click New.
2. Under Templates, you see options you can use to create:
a. A blank document, workbook, or presentation.
b. A document, workbook, or presentation from a template.
c. A new document, workbook, or presentation from an existing file.
Save file
When you save a file, you can save it to a folder on your hard disk drive, a network location, disk, CD, the
desktop, or another storage location. You need to identify the target location in the Save in list. Otherwise, the saving process is the same, no matter what location you choose.
Save a copy of a file
1. Click the Microsoft Office Button, and then click Save As.
2. In the Save in list, click the folder or drive to which you want to save.
Note: -To save the copy in a different folder, click a different drive in the Save in list or a
different folder in the folder list.
3. In the File name box, enter a new name for the file.
4. Click Save.
Save a file
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 10
1. Click the Microsoft Office Button, and then click Save. OR Keyboard shortcut to save the file,
press CTRL+S.
Note: -If you are saving the file for the first time, you are asked to give it a name.
Save a file to another format
1. Click the Microsoft Office Button, and then click Save As.
2. In the File name box, enter a new name for the file.
3. In the Save as type list, click the file format that you want to save the file in.
4. Click Save.
Open a file
1. Click the Microsoft Office Button, and then click Open. Or Keyboard shortcut to display the
Open dialog box, press CTRL+O.
2. In the Look in list, click the folder, drive, or Internet location that contains the file that you want
to open.
3. In the folder list, locate and open the folder that contains the file.
Note: -By default, the files that you see in the Open dialog box are only those files that
are created by the program that you are using. For example, if you are using Microsoft
Office Excel, you do not see files that are created by using Microsoft Office Word unless
you click All Files in the Files of type box.
4. Click the file, and then click Open.
Formatting Text and Writing Text
Cursor Movement
To do this
Press
Move to the beginning of the entry.
HOME
Move to the end of the entry.
END
Move one character to the left or right.
LEFT ARROW or RIGHT ARROW
Move one word to the left.
CTRL+LEFT ARROW
Move one word to the right.
CTRL+RIGHT ARROW
Select or unselect one character to the left.
SHIFT+LEFT ARROW
Select or unselect one character to the right.
SHIFT+RIGHT ARROW
Select or unselect one word to the left.
CTRL+SHIFT+LEFT ARROW
Select or unselect one word to the right.
CTRL+SHIFT+RIGHT ARROW
Select from the insertion point to the beginning of the entry. SHIFT+HOME
Select from the insertion point to the end of the entry.
SHIFT+END
Select text
In Microsoft Office Word 2007, you can select text by using the mouse or the keyboard. You can also
select text or items that are in different places.
Select text by using the mouse
To select
Any amount of text
Do this
Click where you want to begin the selection, hold
down the left mouse button, and then drag the
pointer over the text that you want to select.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 11
A word
A line of text
Double-click anywhere in the word.
Move the pointer to the left of the line until it
changes to a right-pointing arrow, and then click.
Hold down CTRL, and then click anywhere in the
sentence.
Triple-click anywhere in the paragraph.
Move the pointer to the left of the first paragraph until it changes to a right-pointing arrow
and then press and hold down the left mouse
button while you drag the pointer up or down.
Move the pointer to the left of any text until it
changes to a right-pointing arrow, and then
triple-click.
In Print Layout view (Print Layout view: A view of
a document or other object as it will appear
when you print it. For example, items such as
headers, footnotes, columns, and text boxes appear in their actual positions.), double-click the
dimmed header or footer text. Move the pointer
to the left of the header or footer until it
changes to a right-pointing arrow, and then click.
Move the pointer over the border of the frame
or text box until the pointer becomes a fourheaded arrow, and then click.
A sentence
A paragraph
Multiple paragraphs
An entire document
Headers and footers
A text box or frame
Select text by using the keyboard
To select
One character to the right
One character to the left
A word from its beginning to its end
A word from its end to its beginning
A line from its beginning to its end
A line from its end to its beginning
One line down
One line up
A paragraph from its beginning to its end
A paragraph from its end to its beginning
A document from its end to its beginning
A document from its beginning to its end
Do this
Press SHIFT+RIGHT ARROW.
Press SHIFT+LEFT ARROW.
Place the insertion point at the beginning of the
word, and then press CTRL+SHIFT+RIGHT ARROW.
Move the pointer to the end of the word, and then
press CTRL+SHIFT+LEFT ARROW.
Press HOME and then press SHIFT + END.
Press END, and then press SHIFT+HOME.
Press END, and then press SHIFT+DOWN ARROW.
Press HOME and then press SHIFT+UP ARROW.
Move the pointer to the beginning of the paragraph, and then press CTRL+SHIFT+DOWN ARROW.
Move the pointer to the end of the paragraph, and
then press CTRL+SHIFT+UP ARROW.
Move the pointer to the end of the document, and
then press CTRL+SHIFT+HOME.
Move the pointer to the beginning of the document, and then press CTRL+SHIFT+END.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 12
The entire document
A word, a sentence, a paragraph, or a document
Press CTRL+A.
Press F8 to turn on selection mode, and then press
F8 once to select a word, twice to select a sentence, three times to select a paragraph, or four
times to select the document. Press ESC to turn off
the selection mode.
Font (Ctrl + D)
You can specify how you want text to appear by selecting options in the Font dialog box. The availability
of some options depends on the languages that are installed and enabled for editing.
Font Specifies a Latin text font. In the box, select a font name.
Font style Specifies a font style, such as Bold or Italic. In the box, select a font style.
Size Specifies a font size in points. In the list, select a font size.
Font Color Specifies the color of the selected text.
Underline style Specifies whether selected text is underlined and the underline style. Click none
to remove underlining.
6. Underline color Specifies the color of the underline. This option remains unavailable until you
apply an underline style.
1.
2.
3.
4.
5.
Font Effects
1. Strikethrough Draws a line through the selected text.
2. Double strikethrough Draws a double line through the selected text.
3. Superscript Raises the selected text above the baseline and changes the selected text to a
smaller font size, if a smaller size is available.
4. Subscript Lowers the selected text below the baseline and changes the selected text to a smaller
font size, if a smaller size is available.
5. Shadow Adds a shadow beneath and to the right of the selected text.
6. Outline Displays the inner and outer borders of each character.
7. Emboss Makes the selected text appear to be raised off the page in relief.
8. Engrave Makes the selected text appear to be imprinted or pressed into the page.
9. Small caps Formats selected lowercase text as capital letters and reduces their size. Small caps
formatting do not affect numbers, punctuation, non-alphabetic characters, or uppercase letters.
10. All caps Formats lowercase letters as capitals. All caps formatting do not affect numbers, punctuation, non-alphabetic characters, or uppercase letters.
11. Hidden Prevents selected text from being displayed. To view hidden text, on the Tools menu,
click Options, and on the View tab, select the Hidden text check box.
12. Preview
13. The Preview box displays the specified font and any text effects.
14. Default Click to store the current values on the Font, Character Spacing, and Text Effects tabs as
default settings for the current document and all new documents based on the current template.
Make text bold
Select the text that you want to make bold, and move your pointer to the Mini toolbar above your selection.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 13
1. Click Bold OR Keyboard shortcut CTRL+B.
2. Click Bold again to unbold the text that you selected OR Keyboard shortcut CTRL+B.
Make text Italics
Select the text that you want to make italics, and move your pointer to the Mini toolbar above your selection.
1. Click Italics OR Keyboard shortcut CTRL+I.
2. Click Italics again to unitalics the text that you selected OR Keyboard shortcut CTRL+I.
Underline words and the spaces between them
1. Select the text that you want to underline.
2. On the Home tab, in the Font group, click Underline. Or press CTRL+U.
Note: -To change the underline style or color, click the Font Dialog Box Launcher, click the Font tab, and
then change the Underline style or Underline color setting.
Make text superscript or subscript
Superscript and subscript refer to numbers that are positioned slightly higher or slightly lower than the
text on the line. For example, a footnote or endnote number reference is an example of superscript, and
a scientific formula might use subscript text.
Make text superscript or subscript
1. Select the text that you want to format as superscript or subscript.
2. Do one of the following:
a. On the Home tab, in the Font group, click Superscript. Or press CTRL+SHIFT+=.
b. On the Home tab, in the Font group, click Subscript. Or press CTRL+=.
Change the color of text
In Microsoft Office Word 2007, you can apply a format to selected text, or you can quickly and easily
format an entire document to give it a professional and modern look by applying a document theme. A
document theme is a set of formatting choices that can include a color scheme (a set of colors), a font
scheme (a set of heading and body text fonts), and an effects scheme (a set of lines and fill effects).
Change the text color
In Office Word 2007, you can use the formatting options on the Mini toolbar to quickly format text. The
Mini toolbar appears automatically when you select text. It also appears with the menu when you select
text and then right-click.
1. Select the text that you want to change, and move your pointer to the Mini toolbar that appears
with your text selection.
2. Click Font Color, and then select the color that you want.
Apply a predefined color theme
You can change the colors in your document by selecting a new color theme. When you choose a new
color theme, Word automatically formats various parts of your document with colors that are designed
to work together.
1. On the Page Layout tab, in the Themes group, click Theme Colors.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 14
Note: - If you want to change the font, colors, and effects in your document, click
Themes instead of Theme Colors.
2. Under Built-In, click the predefined color theme that you want to use.
Use the Format Painter
You can use the Format Painter on the Write tab to apply text formatting and some basic graphics formatting, such as borders and fills.
1. Select the text or graphic that has the formatting that you want to copy.
Note:-If you want to copy text formatting, select a portion of a paragraph. If you want to copy
text and paragraph formatting, select an entire paragraph, including the paragraph mark.
2. On the Home tab, in the Clipboard group, click Format Painter.
The pointer changes to a paintbrush icon.
(Note:-Double-click the Format Painter button if you want to change the format of multiple selections in your document.)
3. Select the text or graphic that you want to format.
4. To stop formatting, press ESC.
Apply a style
Applying a style to a selection of text in Microsoft Office Word 2007 is as easy as clicking a button in the
Quick Styles gallery.
1. Select the text to which you want to apply a style.
2. For example, you can select text that you want to make into a heading. If you want to change
the style for an entire paragraph, click anywhere in the paragraph.
3. On the Home tab, in the Styles group, click the style that you want.
4. For example, if you select text that you want to style as a title, click the style called Title in the
Quick Styles gallery.
Insert Hyphen
1. Make sure that no text is selected.
2. On the Page Layout tab, in the Page Setup group, click Hyphenation, and then click Automatic.
Add or delete bookmarks
A bookmark identifies a location or a selection of text that you name and identify for future reference.
For example, you might use a bookmark to identify text that you want to revise at a later time. Instead
of scrolling through the document to locate the text, you can go to it by using the Bookmark dialog box.
Add a bookmark
1. Select the text or item to which you want to assign a bookmark, or click where you want to insert a bookmark.
2. On the Insert tab, in the Links group, click Bookmark.
3. Under Bookmark name, type a name.
4. Click Add.
Go to a specific bookmark
1. On the Insert tab, in the Links group, click Bookmark.
2. Click either Name or Location to sort the list of bookmarks in the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 15
3. Click the name of the bookmark that you want to go to.
4. Click Go To.
Delete a bookmark
1. On the Insert tab, in the Links group, click Bookmark.
2. Click the name of the bookmark you want to delete, and then click Delete.
Add WordArt
1. On the Insert tab, in the Text group, click WordArt, and then click the WordArt style that you
want.
2. Type your text in the Text box.
3. You can customize the shape surrounding the WordArt as well as the text in the WordArt.
Insert a symbol
1. Click where you want to insert the symbol.
2. On the Insert tab, in the Symbols group, click Symbol.
3. Do one of the following:
a. Click the symbol that you want in the drop-down list.
b. If the symbol that you want to insert is not in the list, click More Symbols. In the Font box,
click the font that you want, click the symbol that you want to insert, and then click Insert.
4. Click Close.
Insert a special character
1. Click where you want to insert the special character.
2. On the Insert tab, in the Symbols group, click Symbol, and then click More Symbols.
3. Click the Special Characters tab.
4. Click the character that you want to insert, and then click Insert.
5. Click Close.
Editing Text
Copy /Move and Paste
1. Select the first item that you want to copy/Cut.
2. Do one of the following in these Office programs:
a. On the Home tab, in the Clipboard group, click Copy/Cut OR
b. Keyboard shortcut CTRL+C /CTRL+X
3. Click where you want the items to be pasted.
4. Do one of the following:
a. On the Home tab, in the Clipboard group, click Paste.
b. Keyboard shortcut CTRL+V
Check spelling and grammar
1. Press F7 or On the Review tab, in the Proofing group, click Spelling & Grammar.
1. Click the word in the document
2. Click the Not in Dictionary box.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 16
3.
4.
5.
6.
7.
Edit the word.
Click Change.
Click the Change to box.
Edit the word.
Click Change.
a. Click Add or Add to Dictionary.
I want to ignore the misspelled word and move on to the next word
b. Click Ignore Once.
c. Click Ignore Once.
d. Click Find Next.
e. Select the correct word from Suggestions, and then click AutoCorrect
Thesaurus
Using the Research feature, you can look up synonyms (different words with the same meaning) and
antonyms (words with the opposite meaning) in the thesaurus.
1. On the Review tab, click Thesaurus Or Shift + F7
2. Then appear the Research task pane.
3. Type the word in Search for Box and then Click on Arrow.
4. To use one of the words in the list of results or to search for more words, do one of the following:
a. To use one of the words, point to it, click the down arrow, and then click Insert or Copy.
b. To look up additional related words, click a word in the list of results.
Find text
You can quickly search for every occurrence of a specific word or phrase.
1. On the Home tab, in the Editing group, click Find.
2. In the Find what box, type the text that you want to search for.
3. Do one of the following:
a. To find each instance of a word or phrase, click Find Next.
b. To find all instances of a specific word or phrase at one time, click Find All, and then click
Main Document.
Find and replace text
You can automatically replace a word or phrase with another — for example, you can replace Acme with
Apex.
1. On the Home tab, in the Editing group, click Replace.
2. Click the Replace tab.
3. In the Find what box, type the text that you want to search for.
4. In the Replace with box, type the replacement text.
5. Do one of the following:
a. To find the next occurrence of the text, click Find Next.
b. To replace an occurrence of the text, click Replace. After you click Replace, Office Word
2007 moves to the next occurrence of the text.
c. To replace all occurrences of the text, click Replace All.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 17
Paragraphs Alignment
Align the text left or right
1. Select the text that you want to align.
2. On the Home tab, in the Paragraph group, click Align Left or Align Right.
Center the text
1. Select the text that you want to center.
2. On the Home tab, in the Paragraph group, click Center.
Justify the text
You can justify the text, which might make the last line of text in a paragraph considerably shorter than
the other lines.
1. Select the text you want to justify.
2. On the Home tab, in the Paragraph group, click Justify.
Creating List
Type a bulleted or numbered list
1. Type * (asterisk) to start a bulleted list or 1. To start a numbered list, and then press SPACEBAR
or the TAB key.
2. Type any text that you want.
3. Press ENTER to add the next list item.
Word automatically inserts the next bullet or number.
4. To finish the list, press ENTER twice, or press BACKSPACE to delete the last bullet or number in
the list.
Add bullets or numbering to a list
1. Select the items that you want to add bullets or numbering to.
2. On the Home tab, in the Paragraph group, click Bullets or Numbering.
Note: -You can find different bullet styles and numbering formats by clicking the arrow next to Bullets or Numbering on the Home tab, in the Paragraph group.
Choose a multilevel list style from the gallery
You can apply a gallery style to any multilevel list.
1. Click an item in the list.
2. On the Home tab, in the Paragraph group, click the arrow next to Multilevel List.
3. Click the multilevel list style that you want.
Line and Paragraphs Spacing
Change the line spacing
1. Select the paragraph for which you want to change the line spacing.
2. On the Home tab, in the Paragraph group, click Line Spacing.
3. Do one of the following:
a. To apply a new setting, click the number of line spaces that you want.
4. For example, if you click 2.0, the selected text is double spaced.
a. To set more precise spacing measurements, click Line Spacing Options, and then select the
options that you want under Spacing.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 18
Change the spacing before or after paragraphs
1. By default, spacing is increased slightly following paragraphs.
2. Select the paragraphs before or after which you want to change the spacing.
3. On the Page Layout tab, in the Paragraph group, click an arrow next to Spacing Before or Spacing After and enter the amount of space that you want.
Tab and Indents
Set tab stops
1. On the Page Layout tab, click the Paragraph Dialog Box Launcher.
2. In the Paragraph dialog box, click Tabs.
When you press the TAB key, your tab will stop across the page at the distance that you specified.
Indent paragraphs
Indentation determines the distance of the paragraph from either the left or the right margin. Within
the margins, you can increase or decrease the indentation of a paragraph or group of paragraphs. You
can also create a hanging indent, in which the first line of the paragraph is not indented, but subsequent
lines are.
Indent only the first line of a paragraph and to set a hanging indent
1. Click in front of the line that you want to indent.
2. On the Page Layout or Home tab, click the Paragraph Dialog Box Launcher, and then click the
Indents and Spacing tab.
3. In the Special list under Indentation, click First line, and then in the ‘By’ box, set the amount of
space that you want the first line to be indented.
4. In the Special list under Indentation, click Hanging, and then in the ‘By’ box, set the amount of
space that you want for the hanging indent.
Increase or decrease the left and right indent of an entire paragraph
1. Select the paragraph that you want to change.
2. On the Page Layout tab, in the Paragraph group, click the arrows next to Indent Left to increase
or decrease the left indentation of the paragraph. Click the arrows next to Indent Right to increase or decrease the right indentation of the paragraph.
Working with Tables
Insert a table
1. Click where you want to insert a table.
2. On the Insert tab, in the Tables group, click Table, and then, under Insert Table, drag to select
the number of rows and columns that you want.
Insert Table command
You can use the Insert Table command to choose the table dimensions and format before you insert the
table into a document.
1. Click where you want to insert a table.
2. On the Insert tab, in the Tables group, click Table, and then click Insert Table.
3. Under Table size, enter the number of columns and rows.
4. Under AutoFit behavior, choose options to adjust the table size.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 19
Add a row above or below
1. Click in a cell above or below where you want to add a row.
2. Under Table Tools, on the Layout tab, do one of the following:
a. To add a row above the cell, click Insert Above in the Rows and Columns group.
b. To add a row below the cell, click Insert Below in the Rows and Columns group.
Add a column to the left or right
1. Click in a cell to the left or right of where you want to add a column.
2. Under Table Tools, on the Layout tab, do one of the following:
a. To add a column to the left of the cell, click Insert Left in the Rows and Columns
group.
b. To add a column to the right of the cell, click Insert Right in the Rows and Columns
group.
Delete a row or column
1. Select the row or column that you want to delete.
2. Under Table Tools, click the Layout tab.
3. In the Rows & Columns group, click Delete, and then click Delete Rows or click Delete Columns.
Merge cells
You can combine two or more table cells located in the same row or column into a single cell. For example, you can merge several cells horizontally to create a table heading that spans several columns.
1. Select the cells that you want to merge by clicking the left edge of a cell and then dragging
across the other cells that you want.
2. Under Table Tools, on the Layout tab, in the Merge group, click Merge Cells.
Split cells
1. Click in a cell, or select multiple cells that you want to split.
2. Under Table Tools, on the Layout tab, in the Merge group, click Split Cells.
3. Enter the number of columns or rows that you want to split the selected cells into.
Convert text to a table
1. Insert separator characters — such as commas or tabs — to indicate where you want to divide
the text into columns. Use paragraph marks to indicate where you want to begin a new row.
For example, in a list with two words on a line, insert a comma or a tab after the first word
to create a two-column table.
2. Select the text that you want to convert.
3. On the Insert tab, in the Tables group, click Table, and then click Convert Text to Table.
4. In the Convert Text to Table dialog box, under Separate text at, click the option for the separator character that is in your text.
5. In the Number of columns box, check the number of columns.
If you don't see the number of columns that you expect, you may be missing a separator character
in one or more lines of text.
6. Select any other options that you want.
Convert a table to text
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 20
1. Select the rows or table that you want to convert to paragraphs.
2. Under Table Tools, on the Layout tab, in the Data group, click Convert to Text.
3. Under Separate text at, click the option for the separator character that you want to use in
place of the column boundaries.
Rows are separated with paragraph marks.
Working with Pictures
Insert a picture from a file
1. Click where you want to insert the picture.
2. On the Insert tab, in the Illustrations group, click Picture.
3. Locate the picture that you want to insert.
4. Double-click the picture that you want to insert.
Change an inline picture to a floating picture, and vice versa
1. If the picture is not on a drawing canvas, select the picture. If the picture is on a drawing canvas,
select the canvas.
2. Under Picture Tools, on the Format tab, in the Arrange group, click Position.
3. If you don't see Position, click Arrange, and then click Position.
4. Do one of the following:
a. To change an inline picture to a floating picture, select the wrapping style that you want.
b. To change a floating picture to an inline picture, select In Line with Text (Normal).
Inserting and Formatting Page Numbers
Insert page numbers
1. On the Insert tab, in the Header & Footer group, click Page Number.
2. Click Top of Page, Bottom of Page, or Page Margins, depending on where you want page
numbers to appear in your document.
3. Choose a page numbering design from the gallery of designs. The gallery includes Page X of
Y options.
Format page numbers
After you add page numbers, you can change them just as you might change text in a header or footer.
Change the format of the page number, the font, or the size.
Change the page-number format, such as 1, i, or a
1. Double-click the header or footer of one of your document pages.
2. Under Header & Footer Tools, on the Design tab, in the Header & Footer group, click Page
Number, and then click Format Page Numbers.
3. In the Number format box, click a numbering style, and then click OK.
Page Break and Section Break
Insert Page break
1. Click where you want to start a new page.
2. On the Insert tab, in the Pages group, click Page Break.
Insert a section break
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 21
You can use section breaks to change the layout or formatting of a page or pages in your document. For
example, you can lay out part of a single-column page as two columns. You can separate the chapters in
your document so that the page numbering for each chapter begins at 1. You can also create a different
header or footer for a section of your document.
Types of section break that you can insert
Section breaks are used to create layout or formatting changes in a portion of a document. You can
change the following formats for individual sections:
1. Margins
2. Paper size or orientation
3. Paper source for a printer
4. Page borders
5. Vertical alignment of text on a page
6. Headers and footers
7. Columns
8. Page numbering
9. Line numbering
10. Footnotes and endnotes
To insert a section break
1. Click where you want to make a formatting change.
2. You might want to select a portion of the document around which to insert a pair of section
breaks.
3. On the Page Layout tab, in the Page Setup group, click Breaks.
4. In the Section Breaks group, click the section break type that fits the type of formatting change
that you want to make.
For example, if you're separating a document into chapters, you might want each chapter to start on an
odd page. Click Odd Page in the Section Breaks group.
The Next Page command inserts a section break and starts the new section on the next page. This type
of section break is especially useful for starting new chapters in a document. The Continuous command
inserts a section break and starts the new section on the same page. A continuous section break is useful for creating a formatting change, such as a different number of columns, on a page.
The Even Page or Odd Page command inserts a section break and starts the new section on the next
even-numbered or odd-numbered page. If you want document chapters always to begin on an odd page
or on an even page, use the ‘Odd page’ or ‘Even page’ section break option.
Working with Header and Footer
Insert headers and footers
Headers and footers are areas in the top, bottom, and side margins (margin: The blank space outside the
printing area on a page.) of each page in a document. You can insert or change text or graphics in headers and footers. For example, you can add page numbers, the time and date, a company logo, the document title or file name, or the author's name.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 22
Insert or change the headers or footers
You can insert predesigned headers or footers in your document and easily change the header and footer designs. Or you can create your own header or footer with a company logo and custom look, and
save the new header or footer to the gallery.
Insert the same header and footer throughout a document
1. On the Insert tab, in the Header & Footer group, click Header or Footer.
2. Click the header or footer design that you want.
The header or footer is inserted on every page of the document.
Note:-If necessary, you can format text in the header or footer by selecting the text and using the formatting options on the Mini toolbar.
Remove the header or footer from the first page
1. On the Page Layout tab, click the Page Setup Dialog Box Launcher, and then click the Layout
tab.
2. Select the Different first page check box under Headers and footers.
Headers and footers are removed from the first page of the document.
Make the headers or footers different for odd and even pages
For example, you might choose to use the title of the document on odd pages, and the chapter title on
even pages.
1. On the Page Layout tab, click the Page Setup Dialog Box Launcher, and then click the Layout
tab.
2. Select the Different odd and even check box.
Now you can insert the header or footer for even pages on an even page and the header or footer for
odd pages on an odd page.
Remove the headers or footers
1. Click anywhere in the document.
2. On the Insert tab, in the Header & Footer group, click Header or Footer.
3. Click Remove Header or Remove Footer.
The header or footers are removed from the entire document.
Working with headers and footers in a document with multiple sections
In a document with sections (section: A portion of a document in which you set certain page formatting
options. You create a new section when you want to change such properties as line numbering, number
of columns, or headers and footers.), you can insert, change, and remove different headers and footers
for each section. Or you can use the same header or footer for all of the sections.
Create a different header or footer for part of a document
1. Click in the section for which you want to create a different header or footer.
2. On the Insert tab, in the Header & Footer group, click Header or Footer.
3. Click Edit Header or Edit Footer.
4. On the Headers & Footers tab, in the Navigation group, click Link to Previous to break the connection between the header and footer in the new section and the previous section.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 23
5. Change the existing header or footer, or create a new header or footer for this section.
Working Page Layout
Set page margins
1. On the Page Layout tab, in the Page Setup group, click Margins.
2. Click the margin type that you want. For the most common margin width, click Normal.
When you click the margin type that you want, your entire document automatically changes to the margin type that you have selected.
You can also specify your own margin settings. Click Margins, click Custom Margins, and then in the
Top, Bottom, Left, and Right boxes, enter new values for the margins.
Set margins for facing pages
When you choose mirror margins, the margins of the left page are a mirror image of those on the right
page. That is, the inside margins are the same width and the outside margins are the same width.
1. On the Page Layout tab, in the Page Setup group, click Margins.
2. Click Mirrored.
3. To change the margin widths, click Margins, click Custom Margins, and then, in the Inside and
‘Outside’ boxes, enter the widths that you want.
Set gutter margins for bound documents
A gutter margin setting adds extra space to the side margin or top margin of a document that you plan
to bind. A gutter margin helps ensure that text isn't obscured by the binding.
1. On the Page Layout tab, in the Page Setup group, click Margins.
2. Click Custom Margins.
3. In the Multiple pages list, click Normal.
4. In the Gutter box, enter a width for the gutter margin.
5. In the Gutter position box, click Left or Top.
Note:-The Gutter position box is not available when you use the Mirror margins, 2 pages per sheet, or
Book fold option. For those options, the gutter position is determined automatically.
Select a paper source
1. On the Page Layout tab, in the Page Setup group, click the Page Setup Dialog Box Launcher.
2. In the Page Setup dialog box, click the Paper tab.
3. Under Paper source, click the paper source that you want.
Change the orientation of your entire document
1. On the Page Layout tab, in the Page Setup group, click Orientation.
2. Click Portrait or Landscape.
Add a border to a page
1. On the Page Layout tab, in the Page Background group, click Page Borders.
2. Make sure you are on the Page Border tab in the Borders and Shading dialog box.
3. Click one of the border options under Settings.
4. To specify that the border appears on a particular side of a page, such as only at the top, click
Custom under Setting. Under Preview, click where you want the border to appear.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 24
5. Select the style, color, and width of the border.
6. To specify an artistic border, such as trees, select an option in the Art box.
7. Do any of the following:
a. To specify a particular page or section for the border to appear in, click the option that you
want under Apply to.
b. To specify the exact position of the border on the page, click Options, and then select the
options that you want.
Remove a border from a page
1. On the Page Layout tab, in the Page Background group, click Page Borders.
Make sure you are on the Page Border tab in the Borders and Shading dialog box.
2. Under Setting, click ‘None’.
Creating Table of Content and Other References
Mark entries for a table of contents
The easiest way to create a table of contents is to use the built-in heading styles (heading style: Formatting applied to a heading. Microsoft Word has nine different built-in styles: Heading 1 through Heading
9.). You can also create a table of contents that is based on the custom styles that you have applied. Or
you can assign the table of contents levels to individual text entries.
Mark entries by using built-in heading styles
1. Select the heading to which you want to apply a heading style.
2. On the Home tab, in the Styles group, click the style that you want.
For example, if you selected text that you want to style as a main heading, click the style called Heading
1 in the Quick Style gallery.
Mark individual text entries
If you want the table of contents to include text that is not formatted as a heading, you can use this procedure to mark individual text entries.
1. Select the text that you want to include in your table of contents.
2. On the References tab, in the Table of Contents group, click Add Text.
3. Click the level that you want to label your selection, such as Level 1 for a main level display in
the table of contents.
4. Repeat steps 1 through 3 until you have labeled all of the text that you want to appear in the table of contents.
Create a table of contents from built-in heading styles
Use this procedure if you created a document by using heading styles.
1. Click where you want to insert the table of contents, usually at the beginning of a document.
2. On the References tab, in the Table of Contents group, click Table of Contents, and then click
the table of contents style that you want.
Note:-For more options, click Insert Table of Contents to open the Table of Contents dialog box.
Create a table of contents from custom styles that you applied
Use this procedure if you already applied custom styles to your headings. You can choose the style settings that you want Word to use when it builds the table of contents.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 25
1. Click where you want to insert the table of contents.
2. On the References tab, in the Table of Contents group, click Table of Contents, and then click
Insert Table of Contents.
3. Click Options.
4. Under Available styles, find the style that you applied to the headings in your document.
5. Under TOC level, next to the style name, type a number from 1 to 9 to indicate the level that
you want the heading style to represent.
Note:-If you want to use only custom styles, delete the TOC level numbers for the builtin styles, such as Heading 1].
6. Repeat step 4 and step 5 for each heading style that you want to include in the table of contents.
7. Click OK.
8. Choose a table of contents to fit the document type:
a. Printed document: - If you are creating a document that reader will read on a printed page,
create a table of contents in which each entry lists both the heading and the page number
where the heading appears. Readers can turn to the page that they want.
b. Online document: - For a document that readers will read online in Word, you can format
the entries in the table of contents as hyperlinks, so that readers can go to a heading by
clicking its entry in the table of contents.
c. To use one of the available designs, click a design in the Formats box.
d. Select any other table of contents options that you want.
Update the table of contents
If you added or removed headings or other table of contents entries in your document, you can quickly
update the table of contents.
1. On the References tab, in the Table of Contents group, click Update Table.
2. Click Update page numbers only or Update entire table.
Delete a table of contents
1. On the References tab, in the Table of Contents group, click Table of Contents.
2. Click Remove Table of Contents.
Insert a footnote or an endnote
1. In Print Layout View, click where you want to insert the note reference mark.
2. On the References tab, in the Footnotes group, click Insert Footnote or Insert Endnote.
By default, Word places footnotes at the end of each page and endnotes at the end of
the document.
3. To make changes to the format of footnotes or endnotes, click the Footnotes Dialog Box
Launcher, and do one of the following:
a. In the Number format box, click the format that you want.
b. To use a custom mark instead of a traditional number format, click Symbol next to Custom
mark, and then choose a mark from the available symbols.
c. Click Insert.
d. Word inserts the note number and places the insertion point next to the note number.
e. Type the note text.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 26
f.
Double-click the footnote or endnote number to return to the reference mark in the document
Delete a footnote or an endnote
In the document, select the note reference mark of the footnote or endnote that you want to delete,
and then press DELETE
Bibliography
A bibliography is a list of sources, usually placed at the end of a document that you consulted or cited in
creating the document. Each time that you create a new source, the source information is saved on your
computer, so that you can find and use any source you have created.
Add a new source to a document for bibliography
1. On the References tab, in the Citations & Bibliography group, click Manage Sources.
2. Under Current List, click the placeholder that you want to edit.
3. Click New.
4. Begin to fill in the source information by clicking the arrow next to Type of source.
For example, your source might be a book, a report, or a Web site.
To add more information about a source, click the Show All Bibliography Fields check box.
5. Click Ok.
Create a bibliography
1. Click where you want to insert a bibliography, usually at the end of the document.
2. On the References tab, in the Citations & Bibliography group, click Bibliography.
3. Click a predesigned bibliography format to insert the bibliography into the document.
Index
An index lists the terms and topics that are discussed in a document, along with the pages that they appear on. To create an index, you mark the index entries by providing the name of the main entry and the
cross-reference in your document, and then you build the index.
Step 1: Mark index entries
To mark index entries, do one of the following:
1. Mark words or phrases
2. Mark entries for text that spans a range of pages
Mark words or phrases
1. To use existing text as an index entry, select the text. To enter your own text as an index entry,
click where you want to insert the index entry.
2. On the References tab, in the Index group, click Mark Entry.
3. To create the main index entry that uses your own text, type or edit the text in the Main entry
box.
4. If you want, you can customize the entry by creating a subentry , a third-level entry, or a crossreference to another entry:
a. To create a subentry, type the text in the Subentry box.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 27
To include a third-level entry, type the subentry text followed by a colon (:), and then type
the text of the third-level entry.
c. To create a cross-reference to another entry, click Cross-reference under Options, and then
type the text for the other entry in the box.
5. To format the page numbers that will appear in the index, select the Bold check box or the Italic
check box below Page number format.
To format the text for the index, select the text in the Main entry or Subentry box, right-click, and
then click Font. Select the formatting options that you want to use.
6. To mark the index entry, click Mark. To mark all occurrences of this text in the document, click
Mark All.
7. To mark additional index entries, select the text, click in the Mark Index Entry dialog box, and
then repeat step 3 through step 6.
b.
Mark entries for text that spans a range of pages
1. Select the range of text that you want the index entry to refer to.
2. On the Insert tab, in the Links group, click Bookmark.
3. In the Bookmark name box, type a name, and then click Add. In the document, click at the end
of the text that you marked with a bookmark.
4. On the References tab, in the Index group, click Mark Entry.
5. In the Main entry box, type the index entry for the marked text.
6. To format the page numbers that will appear in the index, select the Bold check box or the Italic
check box below Page number format.
To format the text for the index, select the text in the Main entry or Subentry box, right-click, and
then click Font. Select the formatting options that you want to use.
7. Under Options, click Page range.
8. In the Bookmark box, type or select the bookmark name that you typed in step 3, and then click
Mark.
Step 2: Create the index
After you mark the entries, you are ready to select an index design and insert the index into your document.
1. Click where you want to add the index.
2. On the References tab, in the Index group, click Create Index, and then click Insert Index.
3. Do one of the following:
a. Click a design in the Formats box to use one of the available index designs.
b. Design a custom index layout:
1. In the Formats box, click From template, and then click Modify.
2. In the Style dialog box, click the index style that you want to change, and then click
Modify.
3. Under Formatting, select the options that you want.
4. To add the style changes to your template, click All documents based on the template.
5. Click OK twice.
4. Select any other index options that you want.
1. To update the index, click the index, and then press F9. Or click Update Index in the Index
group on the References tab.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 28
If you find an error in the index, locate the index entry that you want to change, make the
change, and then update the index.
3. If you create an index in a master document, expand the subdocuments before you insert or
update the index.
2.
Using Mail Merge Features
Use mail merge to create and print letters and other documents
You use mail merge when you want to create a set of documents, such as a form letter that is sent too
many customers or a sheet of address labels. Each letter or label has the same kind of information, yet
the content is unique. For example, in letters to your customers, each letter can be personalized to address each customer by name. The unique information in each letter or label comes from entries in a
data source.
The mail merge process entails the following overall steps:
Set up the main document
1. Start Word.
a. A blank document opens by default. Leave it open. If you close it, the commands in the
next step are not available.
b. On the Mailings tab, in the Start Mail Merge group, click Start Mail Merge.
c. Click the type of document that you want to create.
For example, you can create:
a. A set of envelopes The return address is the same on all the envelopes, but the destination address is unique on each one. Click Envelopes, and then specify your preferences for envelope size and text formatting on the Envelope Options tab of the
Envelope Options dialog box.
b. A set of form letters The basic content is the same in all the letters or messages, but
each contains information that is specific to the individual recipient, such as name, address, or some other piece of information. Click Letters to create these types of documents.
Connect the document to a data source
To merge information into your main document, you must connect the document to a data source, or a
data file. If you don't already have a data file, you can create one during the mail merge process.
Choose a data file
1. On the Mailings tab, in the Start Mail Merge group, click Select Recipients.
1. Do one of the following:
2. If you want to use your Contacts list in Outlook, click Select from Outlook Contacts.
3. With the mail merge main document open, in the Start Mail Merge group of the Mailings
tab, click Select Recipients, and then click Use Existing List.
4. If you want to create new document, Click Type New List.
2. Type content and add fields
a. In the main document, click where you want to insert the field.
b. Use the Write & Insert Fields group on the Mailings tab.
c. Add any of the following:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 29
Address block with name, address, and other information
a. Click Address block.
b. In the Insert Address Block dialog box, select the address elements that you want to include and
the formats that you want, and then click OK.
c. If the Match Fields dialog box appears, Word may have been unable to find some of the information that it needs for the address block. Click the arrow next to (not matched), and then select the field from your data source that corresponds to the field that is required for the mail
merge.
Greeting line
a. Click Greeting line.
b. Select the greeting line format, which includes the salutation, name format, and following punctuation.
c. Select the text that you want to appear in cases where Microsoft Word can't interpret the recipient's name, for example, when the data source contains no first or last name for a recipient,
but only a company name.
d. Click OK.
e. If the Match Fields dialog box appears, Word may have been unable to find some of the information that it needs for the greeting line. Click the arrow next to (not matched), and then select
the field from your data source that corresponds to the field that is required for the mail merge.
Preview the merge
You can preview your merged documents and make changes before you actually complete the merge.
To preview, do any of the following in the Preview Results group of the Mailings tab:
a. Click Preview Results.
b. Page through each merged document by using the Next Record and Previous Record buttons in the Preview Results group.
c. Preview a specific document by clicking Find Recipient.
You can print the merged documents or modify them individually. You can print or change all or just a
subset of the documents.
Print the merged documents
a. On the Mailings tab, in the Finish group, click Finish & Merge, and then click Print Documents.
b. Choose whether to print the whole set of documents, only the copy that's currently visible,
or a subset of the set, which you specify by record number.
Change individual copies of the document
a. On the Mailings tab, in the Finish group, click Finish & Merge, and then click Edit Individual
Documents.
b. Choose whether you want to edit the whole set of documents, only the copy that's currently
visible, or a subset of the set, which you specify by record number. Word saves the copies
that you want to edit to a single file, with a page break between each copy of the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 30
Editing Document with Track Change and Comment
Insert a comment
1. Select the text or item that you want to comment on, or click at the end of the text.
2. On the Review tab, in the Comments group, click New Comment.
3. Type the comment text in the comment balloon or in the Reviewing Pane.
To respond to a comment, click its balloon, and then click New Comment in the Comments group. Type
your response in the new comment balloon.
Delete a comment
1. To quickly delete a single comment, right-click the comment, and then click Delete Comment.
2. To quickly delete all comments in a document, click a comment in the document. On the Review
tab, in the Comments group, click the arrow below Delete, and then click Delete All Comments
in Document.
Track changes while you edit
1. Open the document that you want to revise.
2. On the Review tab, in the Tracking group, click the Track Changes image.
3. Make the changes that you want by inserting, deleting, moving, or formatting text or graphics.
You can also add comments.
Turn off change tracking
1. On the Review tab, in the Tracking group, click the Track Changes image.
Note: -To ensure that there are no more tracked changes in your document, be sure that all changes
are showing, and then use the Accept or Reject commands for each change in the document.
Change the way that markup is displayed
1. You can view all changes, including deletions, inline instead of inside balloons that appear in the
margins of your document. To show changes inline, in the Tracking group, click Balloons, and
then click Show all revisions inline.
2. When you click Show all revisions inline, all of the revisions and comments in the document appear inline.
3. To highlight the margin area where all balloons appear, click Markup Area Highlight under Show
Markup.
Review tracked changes and comments
To prevent you from inadvertently distributing documents that contain tracked changes and comments,
Word displays tracked changes and comments by default. Final Showing Markup is the default option in
the Display for Review box.
In Microsoft Office Word, you can track each insertion, deletion, move, formatting change, or comment
that you make so that you can review all of the changes later.
The Reviewing Pane displays all of the changes that currently appear in your document, the total number of changes, and the number of changes of each type.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 31
As you review tracked changes and comments, you can accept or reject each change. Until you accept or
reject all tracked changes and comments in a document, even hidden changes will appear to viewers in
documents you send or display.
Review a summary of tracked changes
1. On the Review tab, in the Tracking group, click Reviewing Pane to view the summary at the side
of your screen. To view the summary across the bottom of your screen instead of on the side of
your screen, click the arrow next to Reviewing Pane, and then click Reviewing Pane Horizontal.
Review each tracked change and comment in sequence
1. On the Review tab, in the Changes group, click Next or Previous.
2. Do one of the following:
a. In the Changes group, click Accept.
b. In the Changes group, click Reject.
c. In the Comments group, click Delete.
To ensure all tracked changes are accepted or rejected and that all comments are deleted, on the Review tab, in the Tracking group, click Reviewing Pane. The summary section at the top of the Reviewing
Pane displays the exact number of tracked changes and comments that remain in your document.
Accept all changes at once
1. On the Review tab, in the Changes group, click Next or Previous.
2. Click the arrow below Accept, and then click Accept All Changes in Document.
Reject all changes at once
1. On the Review tab, in the Changes group, click Next or Previous.
2. Click the arrow below Reject, and then click Reject All Changes in Document.
Review changes by type of edit or by a specific reviewer
1. Do one of the following:
a. On the Review tab, in the Tracking group, click the arrow next to Show Markup.
2. Clear all check boxes except for the ones next to the types of changes that you want to review.
a. On the Review tab, in the Tracking group, click the arrow next to Show Markup.
3. Point to Reviewers, and then clear all check boxes except for the ones next to the names of the
reviewers whose changes you want to review.
To select or clear the check boxes for all reviewers in the list, click All Reviewers.
Reading View and Zoom of Document
Read a document
1. On the View tab, in the Document Views group, click Full Screen Reading.
Turn off Full Screen Reading view
1. Click Close in the upper-right corner of the screen, or press ESC.
Zoom in or out of a document
You can zoom in to get a close-up view of your document or zoom out to see more of the page at a reduced size. You can also save a particular zoom setting with a document or template.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 32
Quickly zoom in or out of a document
1. On the status bar, click the Zoom slider.
2. Slide to the percentage zoom setting that you want.
Choose a particular zoom setting
You can choose how much of a document you view on the screen. Do one of the following:
1. On the View tab, in the Zoom group, click Zoom 100%.
2. On the View tab, in the Zoom group, click One Page, Two Pages, or Page Width.
3. On the View tab, in the Zoom group, click Zoom, and then enter a percentage or choose any
other settings that you want.
Compare documents side by side
Open both of the files that you want to compare.
1. On the View tab, in the Window group, click View Side by Side.
2. To scroll both documents at the same time, click Synchronous Scrolling in the Window group on
the View tab.
3. If you don't see Synchronous Scrolling, click Window on the View tab, and then click Synchronous Scrolling.
4. To close Side by Side view, click View Side by Side in the Window group on the View tab.
5. If you don't see View Side by Side, click Window on the View tab, and then click View Side by
Side.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 33
MICROSOFT WORD 2007
Word Processor is a software package that helps you to create and edit documents. Creating a
document involves typing in the internal memory of the computer and saving it by writing it onto
the disk. Editing a document involves correcting the spelling mistakes, if any, and deleting or
moving words, sentences or paragraphs.
The following are some of popular word processors:
4. Word Perfect
5. Word Star
6. Microsoft Word
Microsoft word is very powerful, advance and useful word-processing software which is developed by Microsoft Corporation, USA. It has all kind of word processing facilities like to create,
edit, format, save and print document, to check spellings and grammar, to search for synonyms
and antonyms (thesaurus), to work with newspaper columns, tables, to add footnotes and endnotes, page number, special symbols, bookmarks, comments, to insert the picture, objects (e.g.
video clips, audio clips, power point presentations, equations, Tables of contents and indexes).
Its extension is DOCX.
In spite of above-mentioned matters, there are many other features available in Microsoft Word,
which help us to furnish a document (e.g. report, letter, essay etc.) in such a way that we can
produce the professional outlook. Now a day, Microsoft Word is considered as the best wordprocessing software.
To Start Microsoft Word 2007
5. Click on Start menu.
6. Choose Program
7. Choose Microsoft Office
8. Select Microsoft Office Word 2007
OR
7. Click on Start Button
8. Choose Run
9. Then a dialogue box will display.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 34
10. Type the text "WinWord" into Run box.
11. Click on OK
12. Then your required program (Word) will open
Create a new file
Do the following in one of these 2007 Microsoft Office system programs:
1. Click the Microsoft Office Button
, and then click New.
2. Under Templates, you see options you can use to create:
A blank document, workbook, or presentation.
A document, workbook, or presentation from a template.
A new document, workbook, or presentation from an existing file.
[If you are connected to the Internet, you also see templates that are available from Microsoft
Office Online.]
Open a file
Do the following in these 2007 Microsoft Office system programs:
, and then click Open.
1. Click the Microsoft Office Button
Keyboard shortcut To display the Open dialog box, press CTRL+O.
2. In the Look in list, click the folder, drive, or Internet location that contains the file that you
want to open.
3. In the folder list, locate and open the folder that contains the file.
4. Click the file, and then click Open.
Save a file
When you save a file, you can save it to a folder on your hard disk drive, a network location,
disk, CD, the desktop, or another storage location. You need to identify the target location in the
Save in list. Otherwise, the saving process is the same, no matter what location you choose.
Save a file
Do the following in these 2007 Microsoft Office system programs:
1. Click the Microsoft Office Button
, and then click Save.
Keyboard shortcut To save the file, press CTRL+S.
[If you are saving the file for the first time, you are asked to give it a name.]
Save a copy of a file
Do the following in these 2007 Microsoft Office system programs:
1. Click the Microsoft Office Button
, and then click Save As.
2. In the Save in list, click the folder or drive to which you want to save.
3. [To save the copy in a different folder, click a different drive in the Save in list or a different
folder in the folder list. To save the copy in a new folder, click Create New Folder
4. In the File name box, enter a new name for the file.
5. Click Save.
.]
Save a file to another format
Do the following in these 2007 Microsoft Office system programs:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 35
1.
2.
3.
4.
Click the Microsoft Office Button
, and then click Save As.
In the File name box, enter a new name for the file.
In the Save as type list, click the file format that you want to save the file in.
Click Save.
Copy /Move items to the Office Clipboard
1. Select the first item that you want to copy/Cut.
2. Do one of the following in these Office programs:
On the Home tab, in the Clipboard group, click Copy/Cut.
Keyboard shortcut CTRL+C /CTRL+X
Paste items
1. Click where you want the items to be pasted.
2. Do one of the following:
On the Home tab, in the Clipboard group, click Paste.
Keyboard shortcut CTRL+V
Make text bold
1.
Select the text that you want to make bold, and move your pointer to the Mini toolbar
above your selection.
2.
Click Bold.
Keyboard shortcut CTRL+B
Click Bold
again to unbolt the text that you selected.
Make text Italics
1.
Select the text that you want to make italics, and move your pointer to the Mini toolbar
above your selection.
2.
•
Click Italics .
Keyboard shortcut CTRL+I
Click Italics again to unitalics the text that you selected.
Underline words and the spaces between them
1.
Select the text that you want to underline.
2.
On the Home tab, in the Font group, click Underline. Or press CTRL+U.
[To change the underline style or color, click the Font Dialog Box Launcher, click the Font tab,
and then change the Underline style or Underline color setting.]
Change the text size
1.
In Office Word 2007, you can use the formatting options Mini toolbar to quickly format
text. The Mini toolbar appears automatically when you select text. It also appears with the menu
when you select text and then right-click.
2.
Select the text that you want to change, and move your pointer to the Mini toolbar that
appears with your text selection.
3.
Do one of the following:
To make the text larger, click Grow Font. Or press CTRL+SHIFT+>.
To make the text smaller, click Shrink Font. Or press CTRL+SHIFT+<.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 36
[You can also specify a font size on the Home tab, in the Font group.]
Change the horizontal alignment of text on a page
Horizontal alignment determines the appearance and orientation of the edges of the paragraph:
left-aligned text, right-aligned text, centered text, or justified text, which is aligned evenly along
the left and right margins. For example, in a paragraph that is left-aligned (the most common
alignment), the left edge of the paragraph is flush with the left margin.
Align the text left or right
1.
Select the text that you want to align.
2.
On the Home tab, in the Paragraph group, click Align Left
Center the text
1.
Select the text that you want to center.
or Align Right
.
2.
On the Home tab, in the Paragraph group, click Center .
Justify the text
You can justify the text, which might make the last line of text in a paragraph considerably
shorter than the other lines.
1.
Select the text you want to justify.
2.
On the Home tab, in the Paragraph group, click Justify .
Create a bulleted or numbered list
You can quickly add bullets or numbers to existing lines of text, or Word can automatically
create lists as you type.
By default, if you start a paragraph with an asterisk or a number 1. Word recognizes that you
are trying to start a bulleted or numbered list.
Create a one-level bulleted or numbered list
Word can automatically create bulleted and numbered lists as you type, or you can quickly add
bullets or numbers to existing lines of text.
Type a bulleted or numbered list
1.
Type * (asterisk) to start a bulleted list or 1. To start a numbered list, and then press
SPACEBAR or the TAB key.
2.
Type any text that you want.
3.
Press ENTER to add the next list item.
4.
Word automatically inserts the next bullet or number.
5.
To finish the list, press ENTER twice, or press BACKSPACE to delete the last bullet or
number in the list.
Add bullets or numbering to a list
1.
Select the items that you want to add bullets or numbering to.
2.
On the Home tab, in the Paragraph group, click Bullets or Numbering.
You can find different bullet styles and numbering formats by clicking the arrow next to Bullets
or Numbering on the Home tab, in the Paragraph group.
You can move an entire list to the left or the right. Click a bullet or number in the list, and drag it
to a new location. The entire list moves as you drag. The numbering levels do not change.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 37
Choose a multilevel list style from the gallery
You can apply a gallery style to any multilevel list.
1.
Click an item in the list.
2.
On the Home tab, in the Paragraph group, click the arrow next to Multilevel List.
3.
4.
Click the multilevel list style that you want.
Change the line spacing
If a line contains a large text character, graphic, or formula, Microsoft Office Word increases the
spacing for that line.
To space all lines evenly within a paragraph, use exact spacing and specify an amount of space
that is large enough to fit the largest character or graphic in the line. If items appear cut off, increase the amount of spacing.
1.
Select the paragraph for which you want to change the line spacing.
2.
On the Home tab, in the Paragraph group, click Line Spacing.
3.
Do one of the following:
To apply a new setting, click the number of line spaces that you want.
4.
For example, if you click 2.0, the selected text is double spaced.
To set more precise spacing measurements, click Line Spacing Options, and
then select the options that you want under Spacing.
Line spacing options
1.
Single This option accommodates the largest font (font: A graphic design applied to all
numerals, symbols, and alphabetic characters. Also called type or typeface. Arial and Courier
New are examples of fonts. Fonts usually come in different sizes, such as 10 point, and various
styles, such as bold.) In that line, plus a small amount of extra space. The amount of extra
space varies depending on the font that is used.
2.
1.5 lines This option is one-and-one-half times that of single line spacing.
3.
Double This option is twice that of single line spacing.
4.
At least this option sets the minimum line spacing that is needed to fit the largest font or
graphic on the line.
5.
Exactly This option sets fixed line spacing that Microsoft Office Word does not adjust.
6.
Multiple This options sets line spacing that is increased or decreased from single spacing by a percentage that you specify. For example, setting line spacing to 1.2 will increase the
space by 20 percent.
Change the spacing before or after paragraphs
1.
By default, spacing is increased slightly following paragraphs.
2.
Select the paragraphs before or after which you want to change the spacing.
3.
On the Page Layout tab, in the Paragraph group, click an arrow next to Spacing Before or Spacing After and enter the amount of space that you want.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 38
Apply a style
Applying a style to a selection of text in Microsoft Office Word 2007 is as easy as clicking a button in the Quick Styles gallery.
1.
Select the text to which you want to apply a style.
For example, you can select text that you want to make into a heading. If you want to change
the style for an entire paragraph, click anywhere in the paragraph.
2.
On the Home tab, in the Styles group, click the style that you want. If you don't see the
style that you want, click the more buttons to expand the Quick Styles gallery.
For example, if you select text that you want to style as a title, click the style called Title in the
Quick Styles gallery.
Find text
You can quickly search for every occurrence of a specific word or phrase.
1.
On the Home tab, in the Editing group, click Find.
2.
In the Find what box, type the text that you want to search for.
3.
Do one of the following:
To find each instance of a word or phrase, click Find Next.
To find all instances of a specific word or phrase at one time, click Find All,
and then click Main Document.
Find and replace text
You can automatically replace a word or phrase with another — for example, you can replace
Acme with Apex.
1.
On the Home tab, in the Editing group, click Replace.
2.
3.
4.
5.
6.
Click the Replace tab.
In the Find what box, type the text that you want to search for.
In the Replace with box, type the replacement text.
Do one of the following:
To find the next occurrence of the text, click Find Next.
To replace an occurrence of the text, click Replace. After you click Replace, Office Word 2007 moves to the next occurrence of the text.
To replace all occurrences of the text, click Replace All.
Insert a table
In Microsoft Office Word 2007, you can insert a table by choosing from a selection of preformatted tables — complete with sample data — or by selecting the number of rows and columns that
you want. You can insert a table into a document, or you can insert one table into another table
to create a more complex table.
Use table templates
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 39
You can use table templates to insert a table that is based on a gallery of preformatted tables.
Table templates contain sample data to help you visualize what the table will look like when you
add your data.
1. Click where you want to insert a table.
2. On the Insert tab, in the Tables group, click Table, point to Quick Tables, and then click the
template that you want.
3. Replace the data in the template with the data that you want.
Use the Table menu
1.
Click where you want to insert a table.
2.
On the Insert tab, in the Tables group, click Table, and then, under
Insert Table, drag to select the number of rows and columns that you want.
Use the Insert Table command
You can use the Insert Table command to choose the table dimensions and format before you
insert the table into a document.
1.
Click where you want to insert a table.
2.
On the Insert tab, in the Tables group, click Table, and then click Insert Table.
3.
Under Table size, enter the number of columns and rows.
4.
Under AutoFit behavior, choose options to adjust the table size.
Add a row above or below
1.
Click in a cell above or below where you want to add a row.
2.
Under Table Tools, on the Layout tab, do one of the following:
To add a row above the cell, click Insert Above in the Rows and Columns
group.
To add a row below the cell, click Insert Below in the Rows and Columns
group.
Add a column to the left or right
1.
Click in a cell to the left or right of where you want to add a column.
2.
Under Table Tools, on the Layout tab, do one of the following:
To add a column to the left of the cell, click Insert Left in the Rows and Columns group.
To add a column to the right of the cell, click Insert Right in the Rows and Columns group.
Delete a row
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 40
1.
Select the row that you want to delete by clicking its left edge.
2.
Under Table Tools, click the Layout tab.
3.
In the Rows & Columns group, click Delete, and then click Delete Rows.
Delete a column
1.
Select the column that you want to delete by clicking its top gridline or top border.
2.
Under Table Tools, click the Layout tab.
3.
In the Rows & Columns group, click Delete, and then click Delete Columns.
Insert a picture or clip art
Insert clip art
1.
On the Insert tab, in the Illustrations group, click Clip Art.
2.
In the Clip Art task pane, in the Search for text box, type a word or phrase that describes the clip art that you want, or type in all or some of the file name of the clip art.
3.
To narrow your search, do one or both of the following:
To limit the search results to a specific collection of clip art, in the Search in box,
click the arrow and select the collection you want to search.
To limit the search results to clip art, click the arrow in the Results should be
box and select the check box next to Clip Art.
In the Clip Art task pane, you can also search for photographs, movies, and sounds. To include
any of those media types, select the check boxes next to them.
4.
Click Go.
5.
In the list of results, click the clip art to insert it.
Insert a picture from a file
1.
Click where you want to insert the picture.
2.
On the Insert tab, in the Illustrations group, click Picture.
3.
Locate the picture that you want to insert.
4.
Double-click the picture that you want to insert.
By default, Microsoft Word embeds pictures in a document. You can reduce the size of a file by
linking to a picture. In the Insert Picture dialog box, click the arrow next to Insert, and then click
Link to File.
Change an inline picture to a floating picture, and vice versa
1.
If the picture is not on a drawing canvas, select the picture. If the picture is on a drawing
canvas, select the canvas.
2.
Under Picture Tools, on the Format tab, in the Arrange group, click Position.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 41
If you don't see Position, click Arrange, and then click Position.
3.
Do one of the following:
To change an inline picture to a floating picture, select the wrapping style that
you want.
To change a floating picture to an inline picture, select In Line with Text (Normal).
Add or delete bookmarks
A bookmark identifies a location or a selection of text that you name and identify for future reference. For example, you might use a bookmark to identify text that you want to revise at a later
time. Instead of scrolling through the document to locate the text, you can go to it by using the
Bookmark dialog box.
You can also add cross-references to bookmarks. For example, after you insert a bookmark in a
document, you can refer to that bookmark from other places in the text by creating crossreferences to the bookmark.
Add a bookmark
1.
Select the text or item to which you want to assign a bookmark, or click where you want
to insert a bookmark.
2.
On the Insert tab, in the Links group, click Bookmark.
3.
Under Bookmark name, type or select a name.
Bookmark names must begin with a letter and can contain numbers. You can't include spaces in
a bookmark name. However, you can use the underscore character to separate words — for
example, "First heading."
4.
Click Add.
Go to a specific bookmark
1.
On the Insert tab, in the Links group, click Bookmark.
2.
Click either Name or Location to sort the list of bookmarks in the document.
3.
Click the name of the bookmark that you want to go to.
4.
Click Go To.
Delete a bookmark
1.
On the Insert tab, in the Links group, click Bookmark.
2.
Click the name of the bookmark you want to delete, and then click Delete.
To delete both the bookmark and the bookmarked item (such as a block of text or other element), select the item, and then press DELETE.
Create a hyperlink
Microsoft Office Word creates a hyperlink for you when you press ENTER or the SPACEBAR
after you type the address of an existing Web page, such as www.contoso.com.
Create a customized hyperlink to a document, file, or Web page
1.
Select the text or picture that you want to display as the hyperlink.
2.
On the Insert tab, in the Links group, click Hyperlink .
You can also right-click the text or picture and then click Hyperlink on the shortcut menu.
3.
Do one of the following:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 42
To link to an existing file or Web page, click Existing File or Web Page under
Link to, and then type the address that you want to link to in the Address box. If you don't
know the address for a file, click the arrow in the Look in list, and then navigate to the file that
you want.
To link to a file that you haven't created yet, click Create New Document under
Link to, type the name of the new file in the Name of new document box, and then, under
When to edit, click Edit the new document later or Edit the new document now.
To customize the ScreenTip that appears when you rest the pointer over the hyperlink, click
ScreenTip and then type the text that you want. If you don't specify a tip, Word uses the path or
address of the file as the tip.
Create a hyperlink to a location in the current document or Web page
To link to a location in a document or Web page that you created in Word, you must mark the
hyperlink location or destination and then add the link to it.
Mark the hyperlink location
You can mark the hyperlink location by using either a bookmark or heading styles in Word.
Insert a bookmark
In the current document, do the following:
1.
Select the text or item to which you want to assign a bookmark, or click where you want
to insert a bookmark.
2.
On the Insert tab, in the Links group, click Bookmark.
3.
Under Bookmark name, type a name.
Bookmark names must begin with a letter and can contain numbers. You can't include spaces in
a bookmark name. However, you can use the underscore character to separate words — for
example, first heading.
4.
Click Add.
Apply a heading style
You can apply one of the built-in heading styles in Word to the text at the location that you want
to go to. In the current document, do the following:
1.
Select the text to which you want to apply a heading style.
2.
On the Home tab, in the Styles group, click the style that you want.
For example, if you selected text that you want to style as a main heading, click the style called
Heading 1 in the Quick Styles gallery.
Add the link
1.
Select the text or object that you want to display as the hyperlink.
on the shortcut menu.
2.
Right-click and then click Hyperlink
3.
Under Link to, click Place in This Document.
4.
In the list, select the heading or bookmark that you want to link to.
To customize the ScreenTip that appears when you rest the pointer over the hyperlink, click
ScreenTip, and then type the text that you want. If you don't specify a tip, Word uses "Current
document" as the tip for links to headings. For links to bookmarks, Word uses the bookmark
name.
Insert page numbers
You can add page numbers, which are associated with headers and footers, to the top, the bottom, or the margins of a document. Information that is stored in headers and footers or margins
appears dimmed, and it cannot be changed at the same time as the information in the body of
the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 43
To change the header or footer or the information in the page margins, do the following: Doubleclick the header or footer, and then click the Headers & Footers tab under Header & Footer
Tools.
Insert page numbers
You can choose from various page numbering designs that are available in the gallery.
Insert page numbers or Page X of Y page numbers
1.
On the Insert tab, in the Header & Footer group, click Page Number.
2.
Click Top of Page, Bottom of Page, or Page Margins, depending on where you want
page numbers to appear in your document.
3.
Choose a page numbering design from the gallery of designs. The gallery includes Page
X of Y options.
Format page numbers
After you add page numbers, you can change them just as you might change text in a header or
footer. Change the format of the page number, the font, or the size.
Change the page-number format, such as 1, i, or a
1.
Double-click the header or footer of one of your document pages.
2.
Under Header & Footer Tools, on the Design tab, in the Header & Footer group, click
Page Number, and then click Format Page Numbers.
3.
In the Number format box, click a numbering style, and then click OK.
Remove page numbers
Microsoft Office Word 2007 automatically removes or deletes page numbers when you click
Remove Page Numbers or when you remove a single page number manually from the document.
1.
On the Insert tab, in the Header & Footer group, click Page Number.
2.
Click Remove Page Numbers.
Insert headers and footers
Headers and footers are areas in the top, bottom, and side margins (margin: The blank space
outside the printing area on a page.) of each page in a document.
You can insert or change text or graphics in headers and footers. For example, you can add
page numbers, the time and date, a company logo, the document title or file name, or the author's name.
If you want to change a header or footer that you inserted, the Headers & Footers tab under
Header & Footer Tools gives you more header and footer options.
Insert or change the headers or footers
You can insert predesigned headers or footers in your document and easily change the header
and footer designs. Or you can create your own header or footer with a company logo and custom look, and save the new header or footer to the gallery.
Insert the same header and footer throughout a document
1.
On the Insert tab, in the Header & Footer group, click Header or Footer.
2.
Click the header or footer design that you want.
The header or footer is inserted on every page of the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 44
[If necessary, you can format text in the header or footer by selecting the text and using the formatting options on the Mini toolbar.]
Add WordArt
1. On the Insert tab, in the Text group, click WordArt, and then click the WordArt style that you
want.
2. Type your text in the Text box.
3. You can customize the shape surrounding the WordArt as well as the text in the WordArt.
Insert a symbol
1.
Click where you want to insert the symbol.
2.
On the Insert tab, in the Symbols group, click Symbol.
3.
Do one of the following:
Click the symbol that you want in the drop-down list.
If the symbol that you want to insert is not in the list, click More Symbols. In the
Font box, click the font that you want, click the symbol that you want to insert, and then click
Insert.
[If you are using an expanded font, such as Arial or Times New Roman, the Subset list appears. Use this list to choose from an extended list of language characters, including Greek and
Russian (Cyrillic), if available.]
4.
Click Close.
Insert a special character
1.
Click where you want to insert the special character.
2.
On the Insert tab, in the Symbols group, click Symbol, and then click More Symbols.
3.
Click the Special Characters tab.
4.
Click the character that you want to insert, and then click Insert.
5.
Click Close.
Insert a page break
You can insert a page break anywhere in your document, or you can specify where Microsoft
Word positions automatic page breaks.
If you insert manual page breaks in documents that are more than several pages in length, you
might have to frequently rebreak pages as you edit the document. To avoid the difficulty of manually rebreaking pages, you can set options to control where Word positions automatic page
breaks.
Insert a manual page break
1.
Click where you want to start a new page.
2.
On the Insert tab, in the Pages group, click Page Break.
Insert a section break
1.
Click where you want to make a formatting change.
You might want to select a portion of the document around which to insert a pair of section
breaks.
2.
On the Page Layout tab, in the Page Setup group, click Breaks.
3.
In the Section Breaks group, click the section break type that fits the type of formatting
change that you want to make.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 45
For example, if you're separating a document into chapters, you might want each chapter to
start on an odd page. Click Odd Page in the Section Breaks group.
Change or set page margins
Page margins are the blank space around the edges of the page. In general, you insert text and
graphics in the printable area between the margins. However, you can position some items in
the margins — for example, headers, footers, and page numbers.
Change or set page margins
1.
On the Page Layout tab, in the Page Setup group, click Margins.
2.
Click the margin type that you want. For the most common margin width, click Normal.
When you click the margin type that you want, your entire document automatically changes to
the margin type that you have selected.
3.
You can also specify your own margin settings. Click Margins, click Custom Margins,
and then in the Top, Bottom, Left, and Right boxes, enter new values for the margins.
Set margins for facing pages
When you choose mirror margins, the margins of the left page are a mirror image of those on
the right page. That is, the inside margins are the same width, and the outside margins are the
same width.
1.
On the Page Layout tab, in the Page Setup group, click Margins.
2.
Click Mirrored.
3.
To change the margin widths, click Margins, click Custom Margins, and then, in the
Inside and Outside boxes, enter the widths that you want.
Set gutter margins for bound documents
A gutter margin setting adds extra space to the side margin or top margin of a document that
you plan to bind. A gutter margin helps ensure that text isn't obscured by the binding.
1.
On the Page Layout tab, in the Page Setup group, click Margins.
2.
Click Custom Margins.
3.
In the Multiple pages list, click Normal.
4.
In the Gutter box, enter a width for the gutter margin.
5.
In the Gutter position box, click Left or Top.
[The Gutter position box is not available when you use the Mirror margins, 2 pages per
sheet, or Book fold option. For those options, the gutter position is determined automatically.]
Select a paper source
1.
On the Page Layout tab, in the Page Setup group, click the Page Setup Dialog Box
Launcher.
2.
In the Page Setup dialog box, click the Paper tab.
3.
Under Paper source, click the paper source that you want.
Change the orientation of your entire document
1.
On the Page Layout tab, in the Page Setup group, click Orientation.
2.
Click Portrait or Landscape.
Insert Hyphen
When you use automatic hyphenation, Office Word 2007 automatically inserts hyphens where
they are needed. If you later edit the document and change line breaks, Office Word 2007 will
rehyphenate the document.
1.
Make sure that no text is selected.
2.
On the Page Layout tab, in the Page Setup group, click Hyphenation, and then click
Automatic.
Add a border to a page
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 46
1.
On the Page Layout tab, in the Page Background group, click Page Borders.
Make sure you are on the Page Border tab in the Borders and Shading dialog box.
2.
Click one of the border options under Settings.
To specify that the border appears on a particular side of a page, such as only at the top, click
Custom under Setting. Under Preview, click where you want the border to appear.
3.
Select the style, color, and width of the border.
To specify an artistic border, such as trees, select an option in the Art box.
4.
Do any of the following:
To specify a particular page or section for the border to appear in, click the option
that you want under Apply to.
To specify the exact position of the border on the page, click Options, and then
select the options that you want.
[You can see the page borders on your screen by viewing your document in Print Layout view.]
Remove a border from a page
1.
On the Page Layout tab, in the Page Background group, click Page Borders.
Make sure you are on the Page Border tab in the Borders and Shading dialog box.
2.
Under Setting, click None.
[To remove the border from only one edge of the document — for example, to remove all but
the top border — click the borders that you want to remove in the diagram under Preview.]
Create a table of contents
Mark entries for a table of contents
The easiest way to create a table of contents is to use the built-in heading styles (heading style:
Formatting applied to a heading. Microsoft Word has nine different built-in styles: Heading 1
through Heading 9.). You can also create a table of contents that is based on the custom styles
that you have applied. Or you can assign the table of contents levels to individual text entries.
Mark entries by using built-in heading styles
1.
Select the heading to which you want to apply a heading style.
2.
On the Home tab, in the Styles group, click the style that you want.
For example, if you selected text that you want to style as a main heading, click the style called
Heading 1 in the Quick Style gallery.
Mark individual text entries
If you want the table of contents to include text that is not formatted as a heading, you can use
this procedure to mark individual text entries.
1.
Select the text that you want to include in your table of contents.
2.
On the References tab, in the Table of Contents group, click Add Text.
3.
Click the level that you want to label your selection, such as Level 1 for a main level display in the table of contents.
4.
Repeat steps 1 through 3 until you have labeled all of the text that you want to appear in
the table of contents.
Create a table of contents
After you mark the entries for your table of contents, you are ready to build it.
Create a table of contents from built-in heading styles
Use this procedure if you created a document by using heading styles.
1.
Click where you want to insert the table of contents, usually at the beginning of a document.
2.
On the References tab, in the Table of Contents group, click Table of Contents, and
then click the table of contents style that you want.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 47
[For more options, click Insert Table of Contents to open the Table of Contents dialog box.]
Create a table of contents from custom styles that you applied
Use this procedure if you already applied custom styles to your headings. You can choose the
style settings that you want Word to use when it builds the table of contents.
e.
Click where you want to insert the table of contents.
f.
On the References tab, in the Table of Contents group, click Table of Contents, and
then click Insert Table of Contents.
g.
Click Options.
h.
Under Available styles, find the style that you applied to the headings in your document.
i.
Under TOC level, next to the style name, type a number from 1 to 9 to indicate the level
that you want the heading style to represent.
[If you want to use only custom styles, delete the TOC level numbers for the built-in styles, such
as Heading 1].
j.
Repeat step 4 and step 5 for each heading style that you want to include in the table of
contents.
k.
Click OK.
l.
Choose a table of contents to fit the document type:
Printed document If you are creating a document that readers will read on a
printed page, create a table of contents in which each entry lists both the heading and the page
number where the heading appears. Readers can turn to the page that they want.
Online document For a document that readers will read online in Word, you
can format the entries in the table of contents as hyperlinks, so that readers can go to a heading
by clicking its entry in the table of contents.
m.
To use one of the available designs, click a design in the Formats box.
n.
Select any other table of contents options that you want.
Update the table of contents
If you added or removed headings or other table of contents entries in your document, you can
quickly update the table of contents.
1.
On the References tab, in the Table of Contents group, click Update Table.
2.
Click Update page numbers only or Update entire table.
Delete a table of contents
1.
On the References tab, in the Table of Contents group, click Table of Contents.
2.
Click Remove Table of Contents.
Insert a footnote or an endnote
Microsoft Office Word automatically numbers footnotes and endnotes for you, after you specify
a numbering scheme. You can use a single numbering scheme throughout a document, or you
can use different numbering schemes within each section in a document. When you add, delete,
or move notes that are automatically numbered, Word renumbers the footnote and endnote reference marks.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 48
[If the footnotes in your document are numbered incorrectly, your document may contain
tracked changes. Accept the tracked changes so that Word will correctly number the footnotes
and endnotes.]
1.
In Print Layout View, click where you want to insert the note reference mark.
2.
On the References tab, in the Footnotes group, click Insert Footnote or Insert Endnote.
Keyboard shortcut To insert a subsequent footnote, press CTRL+ALT+F. To insert a subsequent endnote, press CTRL+ALT+D.
By default, Word places footnotes at the end of each page and endnotes at the end of the document.
3.
To make changes to the format of footnotes or endnotes, click the Footnotes Dialog
Box Launcher, and do one of the following:
In the Number format box, click the format that you want.
To use a custom mark instead of a traditional number format, click Symbol next
to Custom mark, and then choose a mark from the available symbols.
4.
Click Insert.
[This will not change the existing symbols. It will only add new ones.]
Word inserts the note number and places the insertion point next to the note number.
5.
Type the note text.
6.
Double-click the footnote or endnote number to return to the reference mark in the document
Delete a footnote or an endnote
When you want to delete a note, you work with the note reference mark in the document window, not the text in the note.
Note reference mark
If you delete an automatically numbered note reference mark, Word renumbers the notes in the
new order.
Delete a note
[In the document, select the note reference mark of the footnote or endnote that you want to delete, and then press DELETE]
Create a bibliography
A bibliography is a list of sources, usually placed at the end of a document, that you consulted
or cited in creating the document. In Microsoft Office Word 2007, you can automatically generate a bibliography based on the source information that you provide for the document.
Each time that you create a new source, the source information is saved on your computer, so
that you can find and use any source you have created.
Add a new citation and source to a document
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 49
When you add a new citation to a document, you also create a new source that will appear in
the bibliography.
1.
On the References tab, in the Citations & Bibliography group, click the arrow next to
Style.
2.
Click the style that you want to use for the citation and source.
For example, social sciences documents usually use the MLA or APA styles for citations and
sources.
3.
Click at the end of the sentence or phrase that you want to cite.
4.
On the References tab, in the Citations & Bibliography group, click Insert Citation.
5.
Do one of the following:
To add the source information, click Add New Source.
To add a placeholder, so that you can create a citation and fill in the source information later, click Add new placeholder. A question mark appears next to placeholder
sources in Source Manager.
6.
Begin to fill in the source information by clicking the arrow next to Type of source.
For example, your source might be a book, a report, or a Web site.
7.
Fill in the bibliography information for the source.
To add more information about a source, click the Show All Bibliography Fields check box.
Find a source
The list of sources that you consult or cite can become quite long. At times you might search for
a source that you cited in another document by using the Manage Sources command.
1.
On the References tab, in the Citations & Bibliography group, click Manage Sources.
If you open a new document that does not yet contain citations, all of the sources that you used
in previous documents appear under Master List.
If you open a document that includes citations, the sources for those citations appear under
Current List, and all sources that you have cited, either in previous documents or in the current
document, appear under Master List.
2.
To find a specific source, do one of the following:
In the sorting box, sort by author, title, citation tag name, or year, and then
search the resulting list for the source that you want to find.
In the Search box, type the title or author for the source that you want to find.
The list dynamically narrows to match your search term.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 50
[You can click the Browse button in Source Manager to select another master list from which
you can import new sources into your document. For example, you might connect to a file on a
share, on a research colleague's computer or server, or on a Web site that is hosted by a university or research institution.]
Edit a citation placeholder
Occasionally, you may want to create a placeholder citation, and then wait until later to fill in the
complete bibliography source information. Any changes that you make to a source are automatically reflected in the bibliography, if you have already created one. A question mark appears
next to placeholder sources in Source Manager.
1.
On the References tab, in the Citations & Bibliography group, click Manage Sources.
2.
Under Current List, click the placeholder that you want to edit.
[ Placeholder sources are alphabetized in Source Manager, along with all other sources, based
on the placeholder tag name. Placeholder tag names are numbers by default, but you can customize the placeholder tag name with whatever tag you want.]
3.
Click Edit.
4.
Begin to fill in the source information by clicking the arrow next to Type of source.
For example, your source might be a book, a report, or a Web site.
5.
Fill in the bibliography information for the source. Use the Edit button to fill in fields instead of having to type names in the appropriate format.
To add more information about a source, click the Show All Bibliography Fields check box.
Create a bibliography
You can create a bibliography at any point after you insert one or more sources in a document.
If you don't have all of the information that you need about a source to create a complete citation, you can use a placeholder citation, and then complete the source information later.
1.
Click where you want to insert a bibliography, usually at the end of the document.
2.
On the References tab, in the Citations & Bibliography group, click Bibliography.
3.
Click a predesigned bibliography format to insert the bibliography into the document.
Create an index
An index lists the terms and topics that are discussed in a document, along with the pages that
they appear on. To create an index, you mark the index entries by providing the name of the
main entry and the cross-reference in your document, and then you build the index.
About index entries
You can create an index entry:
For an individual word, phrase, or symbol
For a topic that spans a range of pages
That refers to another entry, such as "Transportation. See Bicycles"
When you select text and mark it as an index entry, Microsoft Office Word adds a special XE
(Index Entry) field that includes the marked main entry and any cross-reference information that
you choose to include.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 51
After you mark all the index entries, you choose an index design and build the finished index.
Word collects the index entries, sorts them alphabetically, references their page numbers, finds
and removes duplicate entries from the same page, and displays the index in the document.
Mark index entries and create an index
To create an index, you mark the entries, select a design, and then build the index.
Step 1: Mark index entries
To mark index entries, do one of the following:
Mark words or phrases
Mark entries for text that spans a range of pages
Mark words or phrases
1.
To use existing text as an index entry, select the text. To enter your own text as an index
entry, click where you want to insert the index entry.
2.
On the References tab, in the Index group, click Mark Entry.
3.
To create the main index entry that uses your own text, type or edit the text in the Main
entry box.
4.
If you want, you can customize the entry by creating a subentry , a third-level entry, or a
cross-reference to another entry:
To create a subentry, type the text in the Subentry box.
To include a third-level entry, type the subentry text followed by a colon (:), and
then type the text of the third-level entry.
To create a cross-reference to another entry, click Cross-reference under Options, and then type the text for the other entry in the box.
5.
To format the page numbers that will appear in the index, select the Bold check box or
the Italic check box below Page number format.
To format the text for the index, select the text in the Main entry or Subentry box, right-click,
and then click Font. Select the formatting options that you want to use.
6.
To mark the index entry, click Mark. To mark all occurrences of this text in the document, click Mark All.
7.
To mark additional index entries, select the text, click in the Mark Index Entry dialog
box, and then repeat step 3 through step 6.
Mark entries for text that spans a range of pages
1.
Select the range of text that you want the index entry to refer to.
2.
On the Insert tab, in the Links group, click Bookmark.
3.
In the Bookmark name box, type a name, and then click Add.
In the document, click at the end of the text that you marked with a bookmark.
4.
On the References tab, in the Index group, click Mark Entry.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 52
5.
In the Main entry box, type the index entry for the marked text.
6.
To format the page numbers that will appear in the index, select the Bold check box or
the Italic check box below Page number format.
To format the text for the index, select the text in the Main entry or Subentry box, right-click,
and then click Font. Select the formatting options that you want to use.
7.
Under Options, click Page range.
8.
In the Bookmark box, type or select the bookmark name that you typed in step 3, and
then click Mark.
Step 2: Create the index
After you mark the entries, you are ready to select an index design and insert the index into your
document.
1.
Click where you want to add the index.
2.
On the References tab, in the Index group, click Create Index, and then click Insert
Index.
3.
Do one of the following:
Click a design in the Formats box to use one of the available index designs.
Design a custom index layout:
1.
In the Formats box, click From template, and then click Modify.
2.
In the Style dialog box, click the index style that you want to change, and
then click Modify.
3.
Under Formatting, select the options that you want.
4.
To add the style changes to your template , click All documents based
on the template.
5.
Click OK twice.
4.
Select any other index options that you want.
To update the index, click the index, and then press F9. Or click Update Index in the
Index group on the References tab.
If you find an error in the index, locate the index entry that you want to change, make the
change, and then update the index.
If you create an index in a master document , expand the subdocuments before you insert or update the index.
Edit or format an index entry
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 53
1.
tab.
If you don't see the XE fields, click Show/Hide
in the Paragraph group on the Home
2.
Find the XE field for the entry that you want to change, for example, { XE "Callisto" \t
"See Moons" }.
3.
To edit or format an index entry, change the text inside the quotation marks.
4.
To update the index, click the index, and then press F9. Or click Update Index in the
Index group on the References tab.
If you find an error in the index, locate the index entry that you want to change, make the
change, and then update the index.
To quickly find the next XE field, press CTRL+F, click Special, and then click Field. If
you don't see the Special button, click More.
Delete an index entry
1.
Select the entire index entry field, including the braces ({}), and then press DELETE.
If you don't see the XE fields, click Show/Hide
in the Paragraph group on the Home tab.
2.
To update the index, click the index, and then press F9. Or click Update Index in the
Index group on the References tab.
Use mail merge to create and print letters and other documents
You use mail merge when you want to create a set of documents, such as a form letter that is
sent to many customers or a sheet of address labels. Each letter or label has the same kind of
information, yet the content is unique. For example, in letters to your customers, each letter can
be personalized to address each customer by name. The unique information in each letter or
label comes from entries in a data source.
The mail merge process entails the following overall steps:
1.
Set up the main document. The main document contains the text and graphics that are
the same for each version of the merged document. For example, the return address or salutation in a form letter.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 54
2.
Connect the document to a data source. A data source is a file that contains the information to be merged into a document. For example, the names and addresses of the recipients of
a letter.
3.
Refine the list of recipients or items. Microsoft Office Word generates a copy of the main
document for each item, or record, in your data file. If your data file is a mailing list, these items
are probably recipients of your mailing. If you want to generate copies for only certain items in
your data file, you can choose which items (records) to include.
Add placeholders, called mail merge fields, to the document. When you perform the mail
4.
merge, the mail merge fields are filled with information from your data file.
5.
Preview and complete the merge. You can preview each copy of the document before
you print the whole set.
You use commands on the Mailings tab to perform a mail merge.
[You can also perform a mail merge by using the Mail Merge task pane, which leads you step
by step through the process. To use the task pane, in the Start Mail Merge group on the Mailings tab, click Start Mail Merge, and then click Step by Step Mail Merge Wizard.]
Set up the main document
1.
Start Word.
A blank document opens by default. Leave it open. If you close it, the commands in the next
step are not available.
2.
On the Mailings tab, in the Start Mail Merge group, click Start Mail Merge.
3.
Click the type of document that you want to create.
For example, you can create:
A set of form letters or e-mail messages The basic content is the same in all the letters or messages, but each contains information that is specific to the individual recipient, such
as name, address, or some other piece of information. Click Letters or E-mail messages to
create these types of documents.
Connect the document to a data source
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 55
To merge information into your main document, you must connect the document to a data
source, or a data file. If you don't already have a data file, you can create one during the mail
merge process.
Choose a data file
2.
On the Mailings tab, in the Start Mail Merge group, click Select Recipients.
3.
Do one of the following:
•
If you want to use your Contacts list in Outlook, click Select from Outlook Contacts.
•
With the mail merge main document open, in the Start Mail Merge group of the Mailings tab, click Select Recipients, and then click Use Existing List.
•
If you want to create new document, Click Type New List.
Type content and add fields
1.
In the main document, click where you want to insert the field.
2.
Use the Write & Insert Fields group on the Mailings tab.
3.
Add any of the following:
Address block with name, address, and other information
1.
Click Address block.
2.
In the Insert Address Block dialog box, select the address elements that you
want to include and the formats that you want, and then click OK.
3.
If the Match Fields dialog box appears, Word may have been unable to find
some of the information that it needs for the address block. Click the arrow next to (not
matched), and then select the field from your data source that corresponds to the field that is
required for the mail merge.
Greeting line
4.
Click Greeting line.
5.
Select the greeting line format, which includes the salutation, name format, and
following punctuation.
6.
Select the text that you want to appear in cases where Microsoft Word can't interpret the recipient's name, for example, when the data source contains no first or last name for
a recipient, but only a company name.
7.
Click OK.
8.
If the Match Fields dialog box appears, Word may have been unable to find
some of the information that it needs for the greeting line. Click the arrow next to (not
matched), and then select the field from your data source that corresponds to the field that is
required for the mail merge.
Preview and complete the merge
After you add fields to your main document, you are ready to preview the merge results. When
you are satisfied with the preview, you can complete the merge.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 56
Preview the merge
You can preview your merged documents and make changes before you actually complete the
merge.
To preview, do any of the following in the Preview Results group of the Mailings tab:
Click Preview Results.
Page through each merged document by using the Next Record and Previous Record
buttons in the Preview Results group.
f.
Preview a specific document by clicking Find Recipient.
You can print the merged documents or modify them individually. You can print or change all or
just a subset of the documents.
Print the merged documents
1.
On the Mailings tab, in the Finish group, click Finish & Merge, and then click Print
Documents.
d.
e.
2.
Choose whether to print the whole set of documents, only the copy that's currently visible, or a subset of the set, which you specify by record number.
Change individual copies of the document
1.
On the Mailings tab, in the Finish group, click Finish & Merge, and then click Edit Individual Documents.
2.
Choose whether you want to edit the whole set of documents, only the copy that's currently visible, or a subset of the set, which you specify by record number. Word saves the copies that you want to edit to a single file, with a page break between each copy of the document.
Check spelling and grammar
As a deadline approaches, often there is not enough time to check a document for spelling and
grammar mistakes. Your Microsoft Office program provides tools that can help you correct these
mistakes faster. You decide if you want to set up the Microsoft Office program so that you can
easily see potential mistakes while you work. Or, if you find the wavy red and green lines distracting, you can just check your document when you are ready to finish it.
Check spelling and grammar automatically (wavy red, blue, and green lines)
Maybe you are looking for a way to find and fix spelling mistakes in your document more quickly
and easily? Or maybe you don't want to see the wavy red lines that your Microsoft Office program displays in your document? This section explains how automatic spelling and grammar
checking works and how to turn it on or off.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 57
There is no option to check spelling while you type in Microsoft Office Access, Microsoft
Office Excel, or Microsoft Office Project.
Grammar checking is available only in Microsoft Office Outlook and Microsoft Office
Word.
How automatic spelling checking works
When you check spelling automatically while you type, you can be more confident that you
won't have to correct a lot of spelling mistakes when you are ready to deliver your document.
Your Microsoft Office program can flag misspelled words while you work so that you can easily
spot them, as in the following example.
You can right-click the misspelled word to see suggested corrections.
Depending on the Microsoft Office program you are using, right-clicking a word can provide you
with other options, such as adding the word to your custom dictionary.
How automatic grammar checking works (Outlook and Word only)
After you enable automatic grammar checking, Word and Outlook flag the potential grammar
and style mistakes while you work in Word documents and in opened Outlook items (except
Notes), as shown in the following example.
You can right-click the mistake for more options.
On the menu that is shown, you may be given a suggested correction. You also can choose to
ignore the error or
Do one of the following:
Press F7.
Use the mouse in one of these Microsoft Office programs:
Word, Excel, or PowerPoint
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 58
On the Review tab, in the Proofing group, click Spelling (in Word, click Spelling & Grammar).
2.
Click the word in the document, and edit the word as needed to fix the word.
3.
After you fix the word, click Resume, Find Next (in InfoPath), or Start Spell
Check (in OneNote).
4.
Click the Not in Dictionary box.
5.
Edit the word.
6.
Click Change.
7.
Click the Change to box.
8.
Edit the word.
9.
Click Change.
Click Add or Add to Dictionary.
I want to ignore the misspelled word and move on to the next word
Click Ignore Once.
Click Ignore Once.
Click Find Next.
I want to ignore all instances of the misspelled word and move on to the next word
I tend to make this mistake a lot, so I want the program to automatically fix this mistake for me
whenever I type it
Select the correct word from Suggestions, and then click AutoCorrect.
15.
Click AutoCorrect options.
16.
Type the mistake in the Replace box, and then type the correct spelling in the
With box.
17.
Click Add.
18.
First you must either cancel or complete the spelling check.
19.
On the Tools menu, select AutoCorrect Options.
20.
Type the mistake in the Replace box, and then type the correct spelling in the
With box.
21.
Click Add.
After you resolve each misspelled word, the program flags the next misspelled word, so
that you can decide what you want to do.
In Outlook or Word only, after the program finishes flagging the spelling mistakes, it begins showing you the grammar mistakes. For each mistake, select an option in the Spelling
and Grammar dialog box.
Look up words in the thesaurus
Using the Research feature, you can look up synonyms (different words with the same meaning) and antonyms (words with the opposite meaning) in the thesaurus.
In Microsoft Office Word, Microsoft Office PowerPoint, and Microsoft Office Outlook, you can
look up a word quickly if you right-click anywhere in the document, presentation, open message,
or previewed message in the Reading Pane, and then click Synonym on the shortcut menu.
1.
Do the following in these Microsoft Office programs:
Excel, PowerPoint, or Word
On the Review tab, click Thesaurus.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 59
2.
Press ALT and click the word that you want to look up. Results appear in the Research
task pane.
Using ALT+Click is not supported in Microsoft Office PowerPoint. Instead, type the word or
phrase in the Search for box, and then click Start Searching
.
3.
To use one of the words in the list of results or to search for more words, do one of the
following:
To use one of the words, point to it, click the down arrow, and then click Insert or
Copy.
To look up additional related words, click a word in the list of results.
[You can also look up words in the thesaurus of another language. If, for example, your document is in French and you want synonyms, click Research options in the Research task pane,
and then under Reference Books, select the thesaurus options that you want.]
Insert or delete a comment
You can insert a comment (comment: A note or annotation that an author or reviewer adds to a
document. Microsoft Word displays the comment in a balloon in the margin of the document or
in the Reviewing Pane.) inside balloons (balloons: In print layout view or Web layout view, markup balloons show markup elements, such as comments and tracked changes, in the margins
of your document. Use these balloons to easily see and respond to reviewers' changes and
comments.) that appear in the document margins. You can also hide comments from view.
If you don't want comments to appear in your document during a review, you must clear your
document of comments by deleting them. To find out whether comments remain in your document, click Show Markup on the Review tab in the Tracking group.
Insert a comment
You can type a comment. On a Tablet PC (Tablet PC: A computer that runs Microsoft Windows
XP Tablet PC Edition. With a Tablet PC, you can write directly on the screen by using a tablet
pen and use the pen to perform mouse functions. Also known as a tablet computer.), you can
insert a voice comment or a handwritten comment.
Type a comment
1.
Select the text or item that you want to comment on, or click at the end of the text.
2.
On the Review tab, in the Comments group, click New Comment.
3.
Type the comment text in the comment balloon or in the Reviewing Pane.
To respond to a comment, click its balloon, and then click New Comment in the Comments
group. Type your response in the new comment balloon.
Insert a handwritten comment
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 60
If your computer is a Tablet PC, you can make handwritten comments in your document. The
ink is added and displayed inside comment balloons.
1.
On the Review tab, in the Comments group, click New Comment.
2.
Write the comment in the comment bubble.
Delete a comment
•
To quickly delete a single comment, right-click the comment, and then click Delete
Comment.
•
To quickly delete all comments in a document, click a comment in the document. On the
Review tab, in the Comments group, click the arrow below Delete, and then click Delete All
Comments in Document.
Track changes while you edit
You can easily make and view tracked changes and comments while you work in a document.
By default, Microsoft Office Word 2007 uses balloons to display deletions, comments, formatting
changes, and content that has moved. If you want to see all of your changes inline, you can
change settings so that tracked changes and comments display the way you want.
Balloons show formatting changes, comments, and deletions.
To prevent you from inadvertently distributing documents that contain tracked changes and
comments, Word displays tracked changes and comments by default. Final Showing Markup
is the default option in the Display for Review box.
Track changes while you edit
1.
Open the document that you want to revise.
2.
On the Review tab, in the Tracking group, click the Track Changes image.
To add a track changes indicator to the status bar, right-click the status bar and click Track
Changes. Click the Track Changes indicator on the status bar to turn track changes on or off.
3.
Make the changes that you want by inserting, deleting, moving, or formatting text or
graphics. You can also add comments.
If you use change tracking and then save your document as a Web page (.htm or .html), tracked
changes will appear on your Web page.
Turn off change tracking
On the Review tab, in the Tracking group, click the Track Changes image.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 61
If you customized the status bar to include a track changes indicator, clicking Track Changes in
the Tracking group will also turn off the indicator in the status bar.
Turning off change tracking does not eliminate the tracked changes in your document. To ensure that there are no more tracked changes in your document, be sure that all changes are
showing, and then use the Accept or Reject commands for each change in the document.
Change the way that markup is displayed
Do any of the following:
You can change the color and other formatting that Word uses to mark changed text and graphics by clicking the arrow next to Track Changes and then clicking Change Tracking Options.
While you can't assign specific colors for changes made by different reviewers, each reviewer's
changes appear as a different color in the document so that you can track multiple reviewers.
You can view all changes, including deletions, inline instead of inside balloons that appear in the
margins of your document. To show changes inline, in the Tracking group, click Balloons, and
then click Show all revisions inline.
When you click Show all revisions inline, all of the revisions and comments in the document
appear inline.
To highlight the margin area where all balloons appear, click Markup Area Highlight under
Show Markup.
Help protect your document against unwanted changes and comments
You can use document protection to restrict the types of changes that reviewers can make to
your document.
Let reviewers insert comments and tracked changes
1.
On the Review tab, in the Protect group, click Protect Document, and then click Restrict Formatting and Editing.
2.
In the Protect Document task pane, under Formatting restrictions, select the Limit
formatting to a selection of styles check box, and then click Settings to specify which styles
a reviewer can apply or change.
3.
Under Editing restrictions, select the Allow only this type of editing in the document check box.
4.
In the list of editing restrictions, click Tracked changes. (This includes comments as
well as insertions, deletions, and moved text.)
For a different set of protection features use Active Directory directory service, click Restrict
Permission to use Information Rights Management.
5.
Under Start enforcement, click Yes, Start Enforcing Protection.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 62
6.
To assign a password to the document so that only reviewers who know the password
can remove the protection, type a password in the Enter new password (optional) box, and
then confirm the password.
If you choose not to use a password, all reviewers can change your editing restrictions.
Let reviewers insert comments only
1.
On the Review tab, in the Protect group, click Protect Document, and then click Restrict Formatting and Editing.
2.
In the Protect Document task pane, under Editing restrictions, select the Allow only
this type of editing in the document check box.
3.
In the list of editing restrictions, click Comments.
4.
If you want to give some people editing options for specific pieces of the document, you
can select areas in the document, and then choose which users (a group or individuals) can edit
the selected areas of the document. Click the dropdown arrow next to the group or individual
name to find the next region or all regions that the group or individual can edit, or to remove
permissions for the group or individual.
For a different set of protection features use Active Directory directory service, click Restrict
Permission to use Information Rights Management.
5.
Under Start enforcement, click Yes, Start Enforcing Protection.
6.
To assign a password to the document so that only reviewers who know the password
can remove the protection, type a password in the Enter new password (optional) box, and
then confirm the password.
If you choose not to use a password, all reviewers can change your editing restrictions.
Stop protection for comments and changes
1.
On the Review tab, in the Protect group, click Protect Document, and then click Restrict Formatting and Editing.
2.
In the Protect Document task pane, click Stop Protection.
If you use a password to add protection to the document, you need to type the password before
you can stop the protection.
Read documents in Word
Full Screen Reading view is optimized for reading a document on the computer screen. In Full
Screen Reading view, you also have the option of seeing the document as it would appear on a
printed page.
Read a document
On the View tab, in the Document Views group, click Full Screen Reading.
Page through the document
You can use any of the following options to move from page to page in a document:
Click the arrows in the lower corners of the pages.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 63
Press PAGE DOWN and PAGE UP or SPACEBAR and BACKSPACE on the keyboard.
Click the navigation arrows at the top center of the screen.
Click View Options, and then click Show Two Pages
time.
Move one screen at a time
to view two pages, or screens, at a
1.
Click View Options, and then click Show Two Pages
to view two pages, or screens,
at a time.
2.
Press CTRL+RIGHT ARROW or CTRL+LEFT ARROW to move one screen at a time.
Adjust the view of the document
Click View Options, and then do one of the following:
To display the text in a larger size, click Increase Text Size.
To display more text on the screen, click Decrease Text Size.
To display the page as it would appear when printed, click Show Printed Page.
To display two pages at once, click Show Two Pages .
Jump to a screen
To jump to the first or last screen of the document, press HOME or END.
To jump to a specific screen, type the screen number, and then press ENTER.
Jump to a section of the document
You can use the Document Map or the Thumbnails pane to find the section of the document
that you want to jump to.
1.
If the Document Map or the Thumbnails pane are not visible, click Jump to a page or
section in a document at the top center of the screen, and then click Document Map or
Thumbnails.
2.
Do one of the following:
To jump to any heading in the document, click that heading in the Document
Map.
To jump to a particular page, click the thumbnail image for that page.
Mark up a document
In Full Screen Reading view, you can highlight content, track your changes, add comments, and
review changes.
Highlight content that you want to remember
1.
Click Reading Tools, and then click Text Highlight Color.
2.
Select the text or graphic that you want to highlight.
To turn off highlighting, click Reading Tools, click Text Highlight Color, and then click Stop
Highlighting, or press ESC.
To change the highlighter color, click Reading Tools, click the arrow next to Text Highlight
Color, and then click the color that you want.
Track changes in the document
1.
To allow typing in the document, click View Options, and then click Allow Typing.
2.
Click View Options again, point to Track Changes, and then click Track Changes.
3.
Make the changes that you want.
Add comments
Place the insertion point where you want to add the comment, click Reading Tools, and then
click New Comment.
Find or look up words and phrases
Find or replace a word or phrase
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 64
1.
Click Reading Tools, and then click Find.
2.
In the Find what box, type the text that you want to search for, just as you would in any
other view in Microsoft Office Word.
3.
If you want to replace the text that you find in the document with some other text, click
the Replace tab, and then, in the Replace with box, type the replacement text.
Look up or translate a word, or find more information about it
1.
Select a word or phrase in the document.
2.
Click Reading Tools, and then click Research.
To select a particular type of research material — such as a dictionary, translation dictionary,
encyclopedia, or thesaurus — choose a research service in the Research task pane.
Turn off Full Screen Reading view
Click Close in the upper-right corner of the screen, or press ESC.
Zoom in or out of a document
You can zoom in to get a close-up view of your document or zoom out to see more of the page
at a reduced size. You can also save a particular zoom setting with a document or template.
Quickly zoom in or out of a document
1.
On the status bar, click the Zoom slider
.
2.
Slide to the percentage zoom setting that you want.
Choose a particular zoom setting
You can choose how much of a document you view on the screen. Do one of the following:
On the View tab, in the Zoom group, click Zoom 100%.
On the View tab, in the Zoom group, click One Page, Two Pages, or Page Width.
On the View tab, in the Zoom group, click Zoom, and then enter a percentage or choose any
other settings that you want.
Save a particular zoom setting with a document or template
To save a particular zoom setting with your document or template so that the document or template always opens with that zoom setting, you must make a change in the document or template first. Adding and deleting a single space are all that is necessary to make sure the document or template is edited and the setting is saved.
1.
Open the document or template that you want to save with a particular zoom setting.
2.
On the View tab, in the Zoom group, click Zoom.
3.
Choose the setting that you want.
4.
Add and delete a single space in the document or template.
5.
Click the Microsoft Office Button
, and then click Save.
Compare documents side by side
For more information about how to compare revisions in a pair of documents,
Open both of the files that you want to compare.
1.
On the View tab, in the Window group, click View Side by Side.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 65
To scroll both documents at the same time, click Synchronous Scrolling in the
Window group on the View tab.
If you don't see Synchronous Scrolling, click Window on the View tab, and then click Synchronous Scrolling.
To close Side by Side view, click View Side by Side in the Window group on the
View tab.
If you don't see View Side by Side, click Window on the View tab, and then click View Side by
Side.
Write or record a macro
In Microsoft Office Word 2007, you can automate frequently used tasks by creating macros. A
macro is a series of commands and instructions that you group together as a single command
to accomplish a task automatically.
Typical uses for macros are:
To speed up routine editing and formatting
To combine multiple commands — for example, to insert a table with a specific size and borders, and with a specific number of rows and columns
To make an option in a dialog box more accessible
To automate a complex series of tasks
You can use the macro recorder to record a sequence of actions, or you can create a macro
from scratch by entering Visual Basic for Applications (Visual Basic for Applications (VBA): A
macro-language version of Microsoft Visual Basic that is used to program Microsoft Windowsbased applications and is included with several Microsoft programs.) code in the Visual Basic
Editor (Visual Basic Editor: An environment in which you write new and edit existing Visual Basic for Applications code and procedures. The Visual Basic Editor contains a complete debugging toolset for finding syntax, run-time, and logic problems in your code.).
To work with macros in Office Word 2007, you need to show the Developer tab.
Show the Developer tab
1.
Click the Microsoft Office Button
, and then click Word Options.
2.
Click Popular.
3.
Under Top options for working with Word, select the Show Developer tab in the
Ribbon check box.
Use the macro recorder
1.
On the Developer tab, in the Code group, click Record Macro.
2.
In the Macro name box, type a name for the macro.
If you give a new macro the same name as a built-in macro in Office Word 2007, the new macro
actions will replace the built-in macro. To view a list of built-in macros, on the Developer tab, in
the Code group, click Macros. In the Macros in list, click Word Commands.
3.
In the Store macro in box, click the template (template: A file or files that contain the
structure and tools for shaping such elements as the style and page layout of finished files. For
example, Word templates can shape a single document, and FrontPage templates can shape
an entire Web site.) or document in which you want to store the macro.
4.
In the Description box, type a description of the macro.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 66
5.
Do one of the following:
To begin recording the macro without assigning it to a button on the Quick
Access Toolbar or to a shortcut key, click OK.
To assign the macro to the Quick Access Toolbar, do the following:
1.
Click Button.
2.
Under Customize Quick Access Toolbar, select the document (or all
documents) for which you want to add the macro to the Quick Access Toolbar.
3.
Under Choose commands from dialog box, click the macro that you are
recording, and then click Add.
4.
Click OK to begin recording the macro.
To assign the macro to a keyboard shortcut, do the following:
1.
Click Keyboard.
2.
In the Commands box, click the macro that you are recording.
3.
In the Press new shortcut key box, type the key sequence that you
want, and then click Assign.
4.
Click Close to begin recording the macro.
6.
Perform the actions that you want to include in the macro.
When you record a macro, you can use the mouse to click commands and options, but not to
select text. You must use the keyboard to select text. For more information about selecting text
by using the keyboard, To stop recording your actions, click Stop Recording in the Code
group.
Javascript
What is Javascript?
Javascript is the client side scripting language, developed by netscape,
used along with HTML to build a efficient web site / webpage.
In the beginning stages, web pages were developed only using html, which are
nothing but static pages. User interaction and dynamic changes are not possible
with html. With the advent of scripting languages the problem was solved. There
are two types of script languages server side and client side.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 67
When a page is requested, the request is sent to the server and data is fetched and
viewed in the browser.
If the dynamic changes in the webpage are caused in the client side (the browsers
like mozilla / IE) its called client side scripting language (E.g. - Javascript).
If the dynamic changes in the web page are caused in the server side (the server
checks the request and based on the data it makes changes in the page before
sending the data to the browser) its called server side scripting language (E.g. php).
Java script codes are embedded in HTML files. Whenever a browser requests for
a webpage, the HTML file along with script is transferred to the browser. This tutorial will give you an introduction and help you learn java script
JavaScript is used in to create dynamic changes, validate forms, detect visitor details, create/use cookies, etc.. JavaScript works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera, Safari and more.
Java and Javascript:
Never confuse javascript with java. Java is an application development language
developed by SUN Microsystems and has no links with javascript. Javascript was
created long before java was developed. Javascript is many times denoted as java
script.
Escape Sequence
These are special characters used in JS with a “\” and then the letter.
Character
Description
\n
\t
\r
New line
Tab
Carriage
Return
Form Feed
Backspace
Null character
Vertical
tab
Single
quote
Double
quote
Backslash
\f
\b
\0
\v
\’
\”
\\
Ex: Using escape sequence on the fly
<html><body>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 68
<pre>
<script type="text/javascript">
document.write("<html><head><title>Using escape sequence</title></head>");
document.write("<h1 align=center>Hello World!</h1>");
document.write("<hr><h2 align=center>one \t two \t three \t four \t five\n");
document.write("six \t seven \t eight \t nine \t ten\n\n");
document.write("<hr><h1>This \"Hello World!\" is in double quotes\”");
document.write("<hr><h2>This is a url : \“ \\\\ http:\\ z:\\tests\\css\\blureffects.html\”");
document.write(" ");
</script></pre></body></html>
How to start using the Javascript?
Script tag is the primary tag which identifies javascript. Any javascript code
should be written in between the script tag.
<script language="javascript">
</script>
Here the attribute language defines the language used. For VBscript user it will be
vbscript.
The script tag can be written anywhere inside head or body tag of html.
Ex:<html>
<head></head>
<body>
<script language=javascript>
//code comes here.....
//code comes here.....
//code comes here.....
</script>
</body>
</html>
First Javascript program using document.write?
Ex:-
<html>
<head></head>
<body>
<script language=javascript>
document.write("This is my first javascript program");
</script>
</body>
</html>
Ex:<script language=javascript>
document.write("-- <b>bold</b> <font color=red> red </font>--");
</script>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 69
Ex:<script language=javascript>
document.write(" -- first line --- <br>");
document.write(" -- second line --- <br>");
</script>
What is a variable?
What are the variable types supported by javascript?
A variable is a named area in computer memory that is used to store information and from
which information can be retrieved. As JavaScript is a relatively high-level language, it is
not necessary to know most of the details of how information is stored in memory by a
JavaScript interpreter. JavaScript provides for the automatic creation of variables whenever values are assigned to them. Here is a very short example showing how the assignment operator ( = ) is used to assign a value to a variable:
X=3.5;
Variables
Variable stores a reference to the location of the memory.
It can hold any value of a given type.
Variable can be used with or without declaration.
Declare variable using “var”. Ex. Var name = ”Raja”;
Variable names can use alphanumeric type of text but not precede with a number.
Variable names can start with “_”(underscore).
While using the variables JS automatically sets the type of variable itself.
Datatypes
Basic data types are :(a) Numbers are values of integer like 234, 456, 58777 and floating types like 23.35, 44.657 etc.
(b) Strings are values of text embedded inside quotes like “my name”, ‘who’ etc.
(c) Boolean values carry either “true” or “false”.
(d) Null means empty/no value.
What is an operator?
An operator is a symbol or sign used in javascript to identify a specific operation.
For example, when we want to define an expression for adding two numbers, we use 3+4.
Here let us assume that we have defined variable a and b for the number, so the expression will become a+b;
The symbol "+" defines that the operands a and b has to be added. So "+" is called as an
operator.
Arithmetic Operators: They are operators or syntax used to do arithmetic or math
operations like addition, subtraction, multiplication, division, increment, decrement, etc.. These are some time misspelled as arithmatic, arithematic.
Operator Syntax
+
Description
Used for addition of two numbers
-
Used for subtraction of two numbers
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 70
Used for multiplication of two numbers
Used for division of two numbers
Used to find the division remainder
*
/
%
++
Used to increment a value
--
Used to decrement a value
Ex:<script language="javascript">
var c = (2+4-2)*10;
document.write(" Arithmetic Operations -> "+c);
</script>
Logical Operators: There are used mainly for boolean operations.
Operator Syntax
&&
||
!
Description
Used for logical "and" operation, condition
Used for logical "or" operation, condition
Used for logical "not" operation, condition
Local operators or used along with if statements and while loops to check multiple criterias.
example usage1: if a is animal && (and) b is man, print something.
example usage2: if a is tany || (or) a is ramani, say good morning.
Ex:<script language="javascript">
var a = "tany";
var b = "ramani";
if(a == "tany" && b == "ramani")
{
document.write(" Logical Operator AND '&&', OR '||', NOT '!' ");
}
</script>
Comparison Operators: They are used to compare numerical (numbers), string or
boolean values.
OperatorSyntax
Description
==
validates the condition whether two numbers or string values are equal
!=
validates the condition whether two numbers or string values are not equal
>
validates the condition whether one numbers is greater than other
<
validates the condition whether one numbers is less than other
>=
compares the numbers and checks whether one numbers is greater than or equal to
other
<=
compares the numbers and checks whether one numbers is less than or equals other
===
used to compare and check whether two values are strictly equal
!==
used to compare and check whether two values are strictly not equal
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 71
The main difference between "equal to (==)" and "strictly equal to (===)" is that
the equality comparison takes place after type conversion for "equal to (==)" and
before type conversion for "strictly equal to (===)".
Ex:<script language="javascript">
var a = "5";
var b = 5;
if(a == b)
{
document.write(" Testing Comparative Operator for equals ");
}
if(a === b)
{
document.write(" Testing Comparison Operator for strictly equals ");
}
</script>
Assignment Operators: Assignment Operators are use to assign a value to a variable.
Operator
Syntax
Description
Example
=
used to assign a value on the right side to the variable of the
left side of the operator.
b = 3;
+=
it adds the value on the right to the previous value of the variable on the left and assign the new value to the variable.
-=
it subtracts the value on the right to the previous value of the
variable on the left and assign the new value to the variable.
*=
it multiplies the operand on the right to the previous value of
the variable on the left and assaigns the new value to
the variable.
b = 4;
b *= 2;
// Now b
will become 8
/=
it divides the operand on the right to the previous value of the
variable on the left and assaigns the new value to the
variable.
b = 6;
b /= 2;
// Now b
will become 3
b = 3;
b += 4;
// Now b
will become 7
b = 4;
b -= 2;
// Now b
will become 2
Ex:<script language="javascript">
var a = 15;
var b = 5;
var c=++a
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 72
var d=--a
document.write(" Testing Assignment Operator for c+" +c);
document.write("Testing Assignment Operator for c-" +d);
</script>
Dialogue Boxes
Dialogue boxes are small windows that help in interacting with the user. Three dialogue
boxes are commonly used.
The alert dialog box :- The alert dialog box can be used to display a cautionary message
or display some information for in stance.
A message is displayed to the user when in correct information is keyed in form
an invalid result is the out put of a claculation.
A warning that a service is not available on a given date/time.
Syntax:alert("message")
EX:- <script>
alert("Welcome to my website !");
The prompt dialog box:- The prompt () method is used t instantiate be use a dialog box
the method requird two blocks ofinformation.
A message to be displayed as a prompt to the user.
Any message to be displayed in the textbox.
Syntax:- prompt (" message","default value");
Ex:-<head><script>
var name=prompt("enter your name", " " );
</script>
</head>
<body>
<script>
doc.write("<h1> hello" + name + "</h1>");
</script>
</body>
Confirm:
Will display a message to confirm.
Contains two buttons “OK” and “cancel”.
If clicked “OK” will pass “true” and “cancel” will pass “false” as value.
Concatenation
In JS concatenation is done by using “+” operator. This is a special operator which appends
any type of data or objects together.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 73
Ex.
<html>
<head><title>concatenation</title></head>
<body>
<script language="javascript">
var one=prompt("enter a value","xxx");
var two=prompt("enter a value", "xxx");
if(confirm("do you want to confirm"))
alert ("concatenation of "+one+" and "+two+" is :"+ one+two);
else alert("sorry! cancelled");
</script>
</body>
</html>
WAP that takes 2 values from the user and display the greater one.
Parsing Strings
For converting strings to numbers we have (a) parseInt (b) parseFloat functions.
(a) parseInt()
If given string does not contain number/white space/minus sign it returns “NaN”.
It takes second parameter as radix, ie base 2-36 ex. parseInt(“17”,8) gives base 8 no.
Ex.
parseInt("3 chances")
//returns 3
parseInt(" 5 alive")
//returns 5
parseInt("I have 3 computers") //returns NaN
parseInt("17", 8)
//returns 15
parseInt(“13.34”)
//returns 13
(b) parseFloat()
This is similar to parseInt() except for useful to extract decimal places of a float number.
Ex. parseFloat("-3.98 points")
//returns -3.98
eval() method
Evaluates the given string to a numerical value.
Ex. eval("8+3+1") //returns 12
var a=5
var b=23
Eval(a+b) //returns 28
Ex. Using eval method
<html><body>
<script language=”javascript”>
var quest = prompt(“enter the expression to evaluate”, “xxxx”);
document.writeln(“<b><br>the result of this expression is </b></br>”);
document.write(eval(quest));
</script>
</body></html>
WAP that takes two numbers and operation from user and perform the operation using eval().
Statement
If Statement:
If statement is used to check or verify a condition and execute a set of statement only if the condi-
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 74
tion is true. This should be referred as a statement and not as a function.
Syntax:
if(condition)
{
// set of statements that will be executed
// only if the condition is true or satisfied
}
Example
<script language="javascript">
var a = "if check";
if(a == "if check")
{
document.write(" inside if statement ");
}
</script>
In the above example the condition is to check whether variable 'a' equals (==) the
string "if check". As the condition satisfies, the statements inside the brackets are
executed.
Nested If:
Nested if statement is nothing but using an if statement inside another if statement. Nested if is used when we check a condition only when another condition is
true. For an example when we purchase a car, first we verify is the car looks
good, only if it satisfies we go to the next condition color, then next and so on..
Syntax:
Nested if
if(condition 1)
{
if(condition 2)
{
// set of statements that will be executed
}
}
If-Else Statement:
If else statement also has the same format as of "if" statement. Only additional thing
is that an else part is added to if statement. So if the condition satisfies the statements inside if part will be executed else the statement inside else part will be executed
Syntax:
if(condition){
// set of statements if condition satisfies
}
else{
// set of statements if condition fails
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 75
Example
<script language="javascript">
var a = "1234abc";
if(a == "adcdefa"){
document.write(" inside if statement ");
}else{
document.write(" inside else part of statement ");
}
</script>
In the above example the condition is to check if variable 'a' equals (==) "abcdefa". The
condition fails as we have assigned a as "1234abc". So the else part is executed.
How to use switch case statements in javascript?
What are the options when a condition may have numerous result?
Ex:-1 <script>
var day="saturday"
document.write(prompt("enter your day"));
if(day=="saturday")
{
document.write("it's the weekend");
}
</script>
Ex:-2 <script>
age=parseInt(prompt("enter your age", ""));
if (age>=18)
{
alert("your can vote");
}
else
{
alert("you can't vote");
}
</script>
Ex:- 3 Find out entered number is positive or negative.
<script>
num=parseInt(prompt("ente any number:" ,""));
if(num>0)
{
document.write(num + " is a pasitive number");
}
else if (num<0)
{
document.write(num + "is a negative number");
}
else
{
document.write(num + "is a zero");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 76
}
Switch Case Statement:
Switch case is used to when a condition may have multiple results and a different set of operation is done based on each result..
Syntax:
Switch(condition)
{
case result1:
// Operation for result1
case result2:
// Operation for result2
.
.
.
default :
// If result belongs to none of the case specified
}
Using 'for' loop in javascript?
I want to execute the same set of statements numerous time based on a incremental or decremental value?
Ex:- <script>
Day=eval(prompt(“enter a day in number(1-7)”));
Switch (day)
{
Case 1:
Doc.write(“Sunday”);
Case 2:
Doc.write(“Monday”);
Case 3:
Doc.write(“……”);
Default :
Doc.write(“invalided number”)
}
</script>
for LOOP:
As we state it, for loop is a looping syntax.
A set of statements are executed as a loop until a condition is satisfied, the condition is based on an incremental or decremental counter. In other words "Looping
statements in javascript are used to execute the same set of code a specified number of times".
Syntax:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 77
for(intialvalue; condition; increment)
{
// set of statements that will be executed
}
As defined in the syntax, for loop takes three parameters, the initial value (e.g
i=0), condition - the statements inside "for" will be executed until this condition is
satisfied (e.g i<7), increment - this is where we set the initial value to be increased
or decreased after each loop.
All the three parameters are separated by semicolon ";".
For an example, we will consider a situation where we want to add all numbers
between one and ten.
Example
<script language="javascript">
var i=0; var total=0;
for(i=1; i<11; i++)
{
total = total+i;
}
document.write("--------- The total ------: "+total);
</script>
The example worked as follows,
a) Initially we created the for loop by setting variable i as 1.
b) then we set the condition that the loop should execute till i is less than 11
(i<11).
c) We made the variable to be incremented at the end of each loop (i++)
First loop: i=0, i<11 is true so the statement is executed, now the total becomes
0+1=1 and i is incremented to 2.
Second loop: now i=1, i<11 is true so the statement is executed, now the total becomes 1+2=3 and i is incremented to 2.
this continues till i=11
Last loop: now i=11, i<11 becomes false and the loop ends here.
Note: i++ increments the value at the end on the loop, while ++i to increase the
value of i at the start of the loop.
while LOOP:
'while' loop is used to execute a set of statements repeatedly until a condition
works true. The difference between 'for' and 'while' loop is that 'while' does not
take counter as an argument.
Syntax:
while(condition)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 78
{
// set of statements that will be executed
}
As defined in the syntax, while loop has only one parameter, condition to be validated. The statements inside "while" will be executed until this condition becomes
false.
For an example, we will consider a situation where we want to print first 5 number.
Example
<script language="javascript">
var i=0;
while(i<5)
{
document.write("The value of i is - "+i+" ");
i++;
}
</script>
The execution process is as,
a) The initialization of the variable "i" as 1 was done before starting the loop.
b) In while loop, the condition was checked,
the condition is satisfied (true) as i<5 and so the statements are executed.
c) In the last line of the statement we has increased or incremented the value of i
by 1. So after the end of the loop the pointer goes back to the beginning of the
loop and checks the condition.
d) Now "i" will be 1 and i is less than 5. The condition satisfies and the statements
are executed. This continues till i is 5.
e) When i is five, the condition becomes false and the pointer comes out of the
loop.
Note: The very important thing to note here is the i++ statement. If i++ has not
been included 'i' will always be zero, so the condition will always be true and the
loop becomes an infinite loop. This will cause memory issue or infinite loading of
the page.
Using 'do-while' loop in javascript?
Difference between while and do-while?
do-while LOOP:
'do-while' loop is similar to while loop and the only difference here is that
the set of statements are executed first and the condition is checked next.
Syntax:
do
{
// set of statements that will be executed
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 79
}
while(condition)
Here the statements are added under do loop and while condition is checked at the
end of loop. In 'Do While' the statements are executed once even if the condition
will fail.
An example
Example
<script language="javascript">
var i=0;
do
{
document.write("Testing DO-While loop");
}
while(i!=0)
</script>
In the example the condition is 'i' should not be equal to zero. The statements are
executed and the condition is checked. The condition failed. The pointer comes
out of the loop. So the statements are executed once even when the condition
fails.
How to exit from a loop in-between an iteration in javascript?
break statement:
Break is a statement used to exit or terminate a loop in execution. It is used
in "for, while, do-while" looping statements. Break statement is used mostly with
a conditional statement inside the loop. When the condition satisfies the control
breaks/terminates from the loop and moves to the next line below the loop.
For an example, we will use a for loop that prints 1 to 5 but will use break or exit
the loop iteration when i is 3.
Example
<script language="javascript">
for(var i=0; i<5; i++)
{
if(i == 3)
break;
document.write("i is - "+i);
}
document.write(" --------- After Looping------ ");
</script>
The example worked as follows,
a) "for loop" has five iterations from i=0 to i=4.
b) It executes document.write at every iteration for i=0,i=1,i=2.
c) when i is 3 the condition above document.write becomes true and so break
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 80
statement is called.
d) break statement exits or terminates the looping sequence and brings the control
to the line next to the end of loop.
How to terminate or stop from a loop for only one iteration in javascript?
continue statement:
Continue statement is used to stop or terminate one iteration of the loop in
execution. It is used in "for, while, do-while" looping statements. Continue statement unlike break statement does not completely terminate the loop. It stops
processing for only one iteration and brings the control back to the beginning of
the loop.
For an example, we will try to stop processing inside a for loop when i is 2.
Example
<script language="javascript">
for(var i=0; i<5; i++)
{
if(i == 2)
continue;
document.write("i is - "+i);
}
</script>
The example worked as follows,
a) This for loop has five iterations from i=0 to i=4.
b) It executes document.write at every iteration.
c) when i is 2 the condition above document.write becomes true and so continue
statement is called.
d) continue statement terminates the looping sequence and brings the control to
the beginning of loop, starting the next iteration.
e) Thus the print was not done for i as 2.
Ex:-1
<script language="javascript">
Var i=1
{
document.write("NIIT")
doc.write(“<br>")
}
While(i<=10)
</script>
Ex:-2
<script language="javascript">
Doc.write(“<font color=red size=7>”)
For (i=1; i/,=10; i++)
{
For (j=1; j<=i; j++)
{
Doc.write(“*”);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 81
}
Doc.write(“<br>”)
}
</script>
Ex:-3
<script language="javascript">
document.write("<pre>")
document.write("<center>")
for(a=1; a<=5; a++)
{
for(b=1; b<=5-a; b++)
{
document.write("* ");
}
for(c=1; c<=2*a-1; c++)
{
document.write("")
}
document.write("<br>");
}
document.write("</center>")
document.write("</pre>");
</script>
What is a function?
How to use functions in javascript?
Function:A function is nothing but a group or block of statements doing a specific
task.
Syntax:
function name()
{
// set of statements that will be executed
}
A function has to be defined in the above syntax.
The name "function" followed by the name we choose for the function and then
open and close brackets. The statements that will do the specific operation are
then group together under this name using braces.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 82
A function may or may not return a value. A function may or may not have parameters value.
Invoking a function:
The statements inside the function will not be executed automatically. We
have to invoke or call the function to execute the statements. Just calling the name
of the function will invoke the function. i.e. if we write a function with the name
"test" calling it as "test();" will invoke the function.
Example
<script language="javascript">
function test()
{
document.write(" ---- This is a test function ---- ");
}
test();
</script>
Using or Passing parameters to a function?
Function with Parameters:
Syntax:
function name(parameter 1,parameter 2,...)
{
// set of statements that will be executed
}
In many cases we pass parameters or arguments to functions, these arguments will be used inside the function for required calculations. For an example
we will use two numbers to add, subtract using function.
Here we write separate function for each operations add, subtract.
Example
<script language="javascript">
function add(number1, number2)
{
var c = number1+number2;
document.write(" ---- This added value is ---- "+c;
}
function sub(number1, number2)
{
var c = number1-number2;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 83
document.write(" ---- This subtracted value is ---- "+c;
}
var a = 7;
var b = 3;
add(a,b);
sub(a,b);
</script>
Here you can clearly see that the two functions where invoked as "add(a,b);" and
"sub(a,b);" where a and b are defined variables. You can even call the function directly with the variables as say "add(9,1);".
A function can be invoked any number of times with any proper value.
Returning a value from a function!
How to get the result of a function to be used in other operations?
Function - Returning a value:
Syntax:
function name(parameter 1,parameter 2,...)
{
// set of statements that will be executed
return thevalue;
}
A function can also return a value after doing the specified operations. To
explain, we would consider a requirement where we have to calculate x2/2.
We will calculate x2 in a function and return the result of x2. After getting the return value, we will divide it by 2.
Example
<script language="javascript">
function square(number1)
{
var c = number1*number1;
// Now we will return the result
return c;
}
var x = 4;
// Here we invoke the function and capture the result
var des = square(x);
var res = des/2;
document.write(" The result - "+res);
</script>
In the above example we calculate x2 in the function "square(xxx)". We returned
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 84
the result.
Getting the Result:
As the function is to return a value, while we invoke the function we assigned a
variable to capture the result as "var des = square(xxxx);".
Now the result of x2 is assigned to the variable des.
Using the variable 'des' further operations were completed.
Note: Once the return statement is called in a function it will break, i.e no further
statements below it will be executed.
Ex:- 1
<head>
<script>
Function display message()
{
Alert (“hello world !”)
}
</script>
</head>
<body>
<input type=”button” value=”cluck me !” onclick=” display message()”>
</body>
Ex:-2
<head>
<script>
Function product(a,b)
{
Return a*b
}
</script>
</head>
<body>
<script>
Doc.write(product ( 4,3))
</script>
</body>
Ex:-3
<head>
<script>
Function myfunction(text)
{
Alert (“text”)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 85
}
</script>
</head>
<body>
<form>
<input type=”button” onclick=”myfunction(‘good morning!’)” value=”in the morning”>
<input type=”button” onclick=”myfunction(‘good evening!’)” value=”in the evenning”>
</form>
</body>
Ex:<script>
Var name
Function hello()
{
Name=prompt(‘ enter your name: ’, ‘name’);
Alert(‘greatings’ + name + ‘welcome to my page !’);
}
Function goodbye()
{
Alert (‘goodbye’ + name + ‘sorry to see you go ! ’);
}
</script>
</head>
<body on load=”hello()”; onunload=”goodbye()”>
</body>
JavaScript Events
JavaScript Events are items that transpire based on an action. A document event is the loading of
an HTML document. A form event is the clicking on a button. Events are objects with properties.
Event handler
Applies to:
onAbort
Image
onBlur
Button, Checkbox, FileUpload, Layer, Password,
Radio, Reset, Select,
Submit, Text, TextArea,
Window
onChange
FileUpload, Select, Text,
TextArea
Triggered when:
The loading of the image
is cancelled.
The object in question
loses focus (e.g. by
clicking outside it or
pressing the TAB
key).
The data in the form
element is changed
by the user.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 86
onClick
Button, Document, Checkbox, Link, Radio, Reset,
Submit
onDblClick
Document, Link
onDragDrop
Window
onError
Image, Window
onFocus
Button, Checkbox, FileUpload, Layer, Password,
Radio, Reset, Select,
Submit, Text, TextArea,
Window
onKeyDown
Document, Image, Link,
TextArea
The user presses a key.
onKeyPress
Document, Image, Link,
TextArea
The user presses or
holds down a key.
onKeyUp
Document, Image, Link,
TextArea
The user releases a key.
onLoad
Image, Window
onMouseDown
Button, Document, Link
onMouseMove
None
onMouseOut
Image, Link
onMouseOver
Image, Link
onMouseUp
Button, Document, Link
onMove
Window
onReset
Form
onResize
Window
onSelect
Text, Textarea
The object is clicked on.
The object is doubleclicked on.
An icon is dragged and
dropped into the
browser.
A JavaScript error occurs.
The object in question
gains focus (e.g. by
clicking on it or
pressing the TAB
key).
The whole page has finished loading.
The user presses a
mouse button.
The user moves the
mouse.
The user moves the
mouse away from
the object.
The user moves the
mouse over the object.
The user releases a
mouse button.
The user moves the
browser window or
frame.
The user clicks the
form's Reset button.
The user resizes the
browser window or
frame.
The user selects text
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 87
onSubmit
Form
onUnload
Window
within the field.
The user clicks the
form's Submit button.
The user leaves the page.
Event Properties
•
•
x -Mouse x coordinate when the event happened.
y -Mouse y coordinate when the event happened.
JavaScript defines five types of events which are form, image, image map, link, and window
events. Events are associated with HTML tags. The definitions of the events described below are
as follows:
Form Events
•
•
•
•
•
•
blur - The input focus was lost.
change - An element lost the focus since it was changed.
focus - The input focus was obtained.
reset - The user reset the object, usually a form.
select - Some text is selected
submit - The user submitted an object, usually a form.
Image Events
•
•
•
abort - A user action caused an abort.
error - An error occurred.
load - The object was loaded.
Image Map Events
•
•
mouseOut - The mouse is moved from on top a link.
mouseOver - The mouse is moved over a link.
Link Events
•
•
•
click - An object was clicked.
mouseOut - The mouse is moved from on top a link.
mouseOver - The mouse is moved over a link.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 88
Window Events
•
•
•
•
•
blur - The input focus was lost.
error - An error occurred.
focus - The input focus was obtained.
load - The object was loaded.
unload - The object was exited.
Event Association
Events are associated with HTML tags. The definitions of the events described below are as follows:
•
•
•
•
•
•
•
•
•
•
•
•
abort - A user action caused an abort of an image or document load.
blur - A frame set, document, or form object such as a text field loses the focus for input.
click - Happens when a link or image map is clicked on
change - Happens when a form field is changed by the user and it loses the focus.
error - An error happened loading a image or document.
focus - A frame set, document, or form object such as a text field gets the focus for input.
load - The event happens when an image or HTML page has completed the load process in the
browser.
mouseOut - The event happens when the mouse is moved from on top of a link or image map
mouseOver - The event happens when the mouse is placed on a link or image map.
reset - The user reset the object which is usually a form.
submit - The user submitted an object which is usually a form.
unload - The object such as a framesed or HTML document was exited by the user.
The events for each HTML tag are as follows:
•
<A>
click (onClick)
mouseOver (onMouseOver)
mouseOut (onMouseOut)
<AREA>
o mouseOver (onMouseOver)
o mouseOut (onMouseOut)
<BODY>
o blur (onBlur)
o error (onError)
o focus (onFocus)
o load (onLoad)
o unload (onUnload)
<FORM>
o submit (onSubmit)
o reset (onReset
<FRAME>
o blur (onBlur)
o
o
o
•
•
•
•
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 89
•
•
•
•
•
•
•
•
•
o focus (onFocus)
<FRAMESET>
o blur (onBlur)
o error (onError)
o focus (onFocus)
o load (onLoad)
o unload (onUnload)
<IMG>
o abort (onAbort)
o error (onError)
o load (onLoad)
<INPUT TYPE = "button">
o click (onClick)
<INPUT TYPE = "checkbox">
o click (onClick)
<INPUT TYPE = "reset">
o click (onClick)
<INPUT TYPE = "submit">
o click (onClick)
<INPUT TYPE = "text">
o blur (onBlur)
o focus (onFocus)
o change (onChange)
o select (onSelect)
<SELECT>
o blur (onBlur)
o focus (onFocus)
o change (onChange)
<TEXTAREA>
o blur (onBlur)
o focus (onFocus)
o change (onChange)
o select (onSelect)
JavaScript Objects
Object Oriented Programming
JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to
define your own objects and make your own variable types.
However, creating your own objects will be explained later, in the Advanced JavaScript section.
We will start by looking at the built-in JavaScript objects, and how they are used. The next pages
will explain each built-in JavaScript object in detail.
Note that an object is just a special kind of data. An object has properties and methods.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 90
Hierarchy Objects
Event
Han
dlers
Object
Properties
Methods
Window
defaultStatus
frames
opener
parent
scroll
self
status
top
window
alert
blur
close
confirm
focus
open
prompt
clearTimeout
setTimeout
onLoad
onUn
load
onBlur
onFo
cus
Frame
defaultStatus
frames
opener
parent
scroll
self
status
top
window
alert
blur
close
confirm
focus
open
prompt
clearTimeout
setTimeout
none
(The
onLoad
and
onUn
load
event
handlers
belong
to the
Window
object)
Location
hash
host
hostname
href
pathname
por
protocol
reload
replace
none
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 91
search
History
length
forward
go
back
none
Navigator
appCodeName
appName
appVersion
mimeTypes
plugins
userAgent
javaEnabled
none
document
alinkColor
anchors
applets
area
bgColor
cookie
fgColor
forms
images
lastModified
linkColor
links
location
referrer
title
vlinkColor
clear
close
open
write
writeln
none (the
onLoad
and
onUn
load
event
handlers
belong
to the
Window
object.
image
border
complete
height
hspace
lowsrc
name
src
vspace
width
none
none
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 92
form
action
elements
encoding
FileUpload
method
name
target
submit
reset
onSubmit
onRe
set
text
defaultValue
name
type
value
focus
blur
select
onBlur
onCharge
onFo
cus
onSelect
Built-in Objects
Array
length
join
reverse
sort xx
none
Date
none
getDate
getDay
getHours
getMinutes
getMonth
getSeconds
getTime
getTimeZoneoffset
getYear
parse
prototype
setDate
setHours
setMinutes
setMonth
setSeconds
setTime
setYear
toGMTString
none
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 93
toLocaleString
UTC
String
length
proto
type
anchor
big
blink
bold
charAt
fixed
fontColor
fontSize
indexOf
italics
lastIndexOf
link
small
split
strike
sub
substring
sup
toLowerCase
toUpperCase
String Object
An object is nothing but a class or file with a group of functions or methods. In
javascript strings are stored as string objects. We can declare a string in either of
the two ways
a) var sname = "testing string object";
b) var sname = new String("testing string object");
Both results in the same string object. String object contains some predefined
function or methods that are extensively used in javascript.
String object has the following functions
length
Description: This will count the total number of characters (length or size)
present in the string and returns the value.
Example
<script language=javascript>
var ss = "a character count - size test ";
var result = ss.length;
document.write(result);
</script>
Result: 30
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 94
Explanation:
In the above example,
the string is stored in a variable ss.
then the function is called as "ss.length".
the method counts the total characters in the string and returns it.
the result is of variable type, integer.
charAt(int)
Description: This method takes an integer value as argument and returns the character at that position in the string. The positioning of the string starts from zero to
n. i.e. The first character of the string is assumed to be at position zero (0), next at
1 and so on.
Example
<script language=javascript>
var ss = "a string test ";
var result = ss.charAt(3);
document.write(result);
</script>
Result: t
Explanation:
In the above example,
the string is stored in a variable ss.
then we called the function or method charAt(3), to get the character at position 3
in the string.
the positioning is as 0-a, 1- , 2-r, 3-t, ....
character at position 3 is 't' and so 't' is returned as result.
the result is of variable type, string.
indexOf(string)
Description: This method takes a character or string as an argument. Searches the
given string in the main string and returns the index or starting (first occurrence)
position of the string. Returns -1 if the search string is not present in the main
string.
Example
<script language=javascript>
var ss = "a string index of test ";
var result = ss.indexOf("ri");
document.write(result);
</script>
Result: 4
Explanation:
In the above example,
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 95
the main string is stored in a variable ss.
the method takes a string "ri" as argument.
this function searches in main string (ss) for the search string (ri).
the first occurrence of the search word is found at the position 4 and is returned as
the result.
lastIndexOf(string)
Description: This method is similar to indexOf() function and takes a character or
string as an argument. Searches the given string in the main string and returns the
last occurrence position of the string. Returns -1 if the search string is not present
in the main string.
Example Code:
<script language=javascript>
var ss = "a last index test ";
var result = ss.lastIndexOf("e");
document.write(result);
</script>
Result: 14
Explanation:
In the above example,
the main string is stored in a variable ss.
the method take a character "e" as argument.
the method searches in main string (ss) for the search string "e".
"e" is at two positions 10 and 14. last occurrence value 14 is returned as result.
substring(integer, integer)
Description: Takes two integer arguments. The first argument is the start index
and the second argument is the end index. This method returns a part or portion of
the main string beginning from begin index to last index.
Example
<script language=javascript>
var ss = " string test ";
var result = ss.substring(3,6);
document.write(result);
</script>
Result: rin
Explanation:
In the above example,
the main string is stored in a variable ss.
the method substring takes two arguments 3 and 6.
this method takes a portion of the string from the position 3 up to 6 and forms a
new string. i.e "rin"
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 96
the result is of variable type string.
split(string)
Description: It takes one argument called as delimiter. The argument is used to
split the string in to an array of string. Every part that comes in between the delimiter is separated as a string. A delimiter can be any string or a character or even
blank space.
Example
<script language=javascript>
var ss = "testing-delimiter-split-function";
var result = ss.split("-");
document.write(result);
</script>
Result: testing,delimiter,split,function
Explanation:
In the above example,
the main string is stored in a variable ss.
the method split takes the one argument, here it is "-".
the delimiter character "-" is used to split or concatenate the string.
any thing that comes in between the delimiter ("-") is separated in to a new string.
the result variable is an array of string.
toLowerCase(), toUpperCase()
Description: These methods are used to cover a string or alphabet from lower
case to upper case or vice versa. e.g: "and" to "AND".
Converting to Upper Case:
Example
<script language=javascript>
var ss = " testing case conversion method ";
var result = ss.toUpperCase();
document.write(result);
</script>
Result: TESTING CASE CONVERSION METHOD
Converting to Lower Case:
Example
<script language=javascript>
var ss = " TESTING LOWERCASE CONVERT FUNCTION ";
var result = ss.toLowerCase();
document.write(result);
</script>
Result: testing lowercase convert function
Explanation:
In the above examples,
toUpperCase() method converts any string to "UPPER" case letters.
toLowerCase() method converts any string to "lower" case letters.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 97
toLowerCase(), toUpperCase()
Description: These methods are used to cover a string or alphabet from lower
case to upper case or vice versa. e.g: "and" to "AND".
Converting to Upper Case:
Example Code:
<script language=javascript>
var ss = " testing case conversion method ";
var result = ss.toUpperCase();
document.write(result);
</script>
Result: TESTING CASE CONVERSION METHOD
Converting to Lower Case:
Example
<script language=javascript>
var ss = " TESTING LOWERCASE CONVERT FUNCTION ";
var result = ss.toLowerCase();
document.write(result);
</script>
Result: testing lowercase convert function
Explanation:
In the above examples,
toUpperCase() method converts any string to "UPPER" case letters.
toLowerCase() method converts any string to "lower" case letters.
What is an array - Basic Tutorial, example? or How to use arrays in javascript?
Arrays:
Arrays are special type of javascript objects. It is used to store data's in contiguous manner. In other words arrays help you to store similar data's under one
name in a defined order.
Syntax:
var varname = new Array(3);
In the above syntax we have declared a new array of size 3 under the name
varname. We can create new array only using the syntax new Array. It is case
sensitive and so "Array" should not be defined as "array".
The size of the array is set as 3. So, we can store 3 variables in the array varname.
It can be declared with any size according to our requirement.
Assigning Vales:
Arrays always start from 0th index or position. If we have set the size as 3, the
array will have 3 position 0,1 & 2. We can assign values to the array as follows,
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 98
varname[0] = "testing array";
varname[1] = "position 2";
varname[2] = "position 3";
To assign a value in to an array, we have to call the variable name on which the
array was created, followed by the position [where we want to store the value]
and then assign the value.
Retrieving Values:
To retrieve a value from an array is very simple. Just calling the array with
its position will retrieve the value at that position in the array.
E.g: var val = varname[0];
Example
<script language="javascript">
var varname = new Array(2);
varname[0] = "testing array";
varname[1] = "position 2";
document.write("Result of array is - "+varname[1]);
</script>
Result:
Result of array is - position 2
The above example shows how to create a new array of size two, add values in to array and retrieve them.
In next tutorial chapter, you will learn dense array, dynamic array..
Dynamic Arrays:
In many a cases we will not want to create the array with a fixed size or
length. In such cases we can create an array with out passing length. This array
will dynamically set its value as and when a new variable or entry is added.
Syntax:
var araay = new Array();
Now we can assign value at any position in this array as it has no length limit. We
can test this by using the attribute "length".
e.g:
varname[6] = "testing array";
As we have assigned a value at 6th position the length of array will now be 7.
Example
<script language="javascript">
var araay = new Array();
araay[6] = "testing array";
document.write("Size of dynamic array is - "+araay.length);
</script>
Result:
Size of dynamic array is - 7
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 99
Dense Array:
Dense array is nothing different in functionality from a normal array. The
only difference is that the values are assigned to the array at the time of initialization of the array.
E.g: var arraa = new Array("index 0","index 1","index 2");
Example
<script language="javascript">
var arraa = new Array("array test 1","array test 2");
document.write("Result from dense array is - "+arraa[1]);
</script>
Result:
Result from dense array is - array test 2
Array Methods :
Array has the following predefined methods.
toString()
joint()
reverse()
sort()
toString() :
This method is used to convert the array elements in to a string. The string
will have each element in the array separated by comma(,).
Example
<script language="javascript">
var varname = new Array();
varname[0] = "testing to string 1";
varname[1] = "testing to string 2";
document.write("toString -- "+varname.toString());
</script>
Result:
toString -- testing to string 1,testing to string 2
join() :
This method is used to join the elements in the array separated by a separator. This function is much similar to toString method. Here we can specify the delimiter or separator that comes instead of comma.
Example
<script language="javascript">
var aarray = new Array();
aarray[0] = "element 1";
aarray[1] = "element 2";
var xx = aarray.join(" +++ ");
document.write("join() -- "+xx);
</script>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 100
Result:
join() -- element 1 +++ element 2
sort() :
This method is used for sorting elements in the array. The values will be
sorted in a dictionary order.
Example
<script language="javascript">
var sorting = new Array();
sorting[0] = "b for balloon";
sorting[1] = "d for donkey";
sorting[2] = "a for apple";
aarray.sort();
document.write("sort function -- "+sorting.toString());
</script>
Result:
sort function -- a for apple,b for balloon,d for donkey
concat() :
This function is used to concat two or more arrays into a single array. The
concatenation function appends the second array with first array.
Syntax:
array1.concat(array2,array3,...arrayx);
Example
<script language="javascript">
var alphabets = ["a", "b","c"];
var numbers = ["1", "2"];
var symbols = ["@", "$","^"];
var alphano = alphabets.concat(numbers,symbols);
document.write(alphano);
</script>
Result:
a,b,c,1,2,@,$,^
pop() :
This method is used to delete the last element of an array and to return the
deleted element. The length of the array gets affected by this function.
Syntax:
array1.pop();
Example Code:
<script language="javascript">
var stack=["a","b","c","d"]
var ele = stack.pop();
document.write(ele);
</script>
Result:
d
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 101
push() :
This function add new elements to the end of array and gives the length of
the array as the return value
Syntax:
array1.push(element1,element2,...);
Example
<script language="javascript">
var stack=["0","1"]
var leng = stack.push(2,3);
document.write(leng);
</script>
Result:
4
shift() :
This function delete the first element of the array and shift the index of the
subsequent elements to the lower value to occupy the vacant space and returns the
deleted element.
Syntax:
array1.shift();
Example
<script language="javascript">
var a=["H","E","L","L","O"];
var ele = a.shift();
document.write(ele);
</script>
Result:
H
unshift() :
This function add new elements into the Beginning of the array and shift the
index of the subsequent elements to the higher value. It also returns the new
length of the array.
Syntax:
array1.unshift();
Example
<script type="text/javascript">
var a["a","b","c","d"]
var ele = stack.unshift(3);
document.write(ele);
</script>
Result:
5
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 102
slice()
This function is used to select a part of an array. The resultant new array contains the element specified by the first argument and all the subsequent elements
but not including the element specified by the second argument.
Syntax:
array1.slice(firstargument,secondargument);
Example
<script language="javascript">
var name = ["john", "peter","samuels","joseph","marry"];
var subarray = name.slice(1,3);
document.write(subarray);
</script>
Result:
peter,samuels
splice() :
This function is used to insert or delete element in the given array. It returns
deleted items.
Note: The method modifies the value of the original array.
Syntax:
array1.splice(argument1,argument2,.....);
argument1 - specifies the array position in which the insertion/deletion to be
performed.
argument2 - specifies the number of elements should be deleted.
The arguments following after second argument specifies the elements that are
to be included after the first argument.
Example : Deleting elements
<script type="text/javascript">
var name = ["john", "peter","samuels","joseph","marry"];
var subarray = name.splice(1,3);
document.write(subarray);
</script>
Result:
peter,samuels,joseph
Example : Inserting elements
<script type="text/javascript">
var name = ["john", "peter","samuels","joseph","marry"];
name.splice(1,0,"reobuck","ram");
document.write(name);
</script>
Result:
john,reobuck,ram,peter,samuels,joseph,marry
Date Object
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 103
Manipulation of dates like (a) setting date and time, (b) Using system
clock for DHTML effects, (c) making a time stamp on a file, (d) knowing the time
difference between different time zones while comparing with Universal Time
(GMT) etc are performed with the help of functions available in Date class.
Basic functions of Date.
Function
Date()
getDay()
getMonth()
getYear()
getHours();
getMinutes();
getSeconds();
getMilliSeconds();
getUTCHours();
Description
Creates a new
date object
returns the
day from
the date
object
returns the
month
from the
date object
Returns the
year from
the date
object
Returns hours
from the
date object
Returns minutes
from the
date object
Returns
seconds
from the
date object
Returns milli
seconds
from the
date object.
Returns the
Usage/Example
var d = new Date();
var day=d.getDay();
var day=d.getMonth();
var day=d.getYear();
var day=d.getHours();
var day=d.getMinutes();
var
day=d.getSeconds();
var
day=d.getMilliSecon
ds();
var
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 104
setFullYear();
standard
GMT Universal
time
Sets the date
for the
time object
Sets the
Month
Sets the Year
setHours();
Sets the hours
setMinutes();
Sets the minutes
Sets the
seconds
Changes the
date obj
into string
representation
Changes the
date into
standard
GMT time
string.
setDate();
setMonth();
setSeconds();
toString();
toGMTString();
day=d.getUTCHours(
);
var newday =
d.setDate(21);
var newmonth
=d.setMonth(1);
var newyear =
d.setFullYear(2012);
var newhours =
d.setHours(12);
var newMinutes =
d.setMinutes(30);
var newSeconds =
d.setSeconds(15);
Date.toString();
Date.toGMTString();
Ex. Calculations with time
<html>
<body>
<script language="javascript">
var start=new Date();
var startmilsec = start.getTime();
var num=0;
for(var i=0;i<250000;i++) num++;
var stop= new Date();
var stopmilsec = stop.getTime();
var difference = (stopmilsec - startmilsec)/1000;
document.write("It took "+difference+" seconds for calculating the loop");
</script>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 105
</body>
</html>
WAP to print the following:
Current Time in Nepal
Good Afternoon Anmol
Hours : 17
Minutes: 39
Seconds: 16.45
Universal time
Mon Jul 2009 11:15:06 GMT+0545 (GMT Daylight Time)
Using Timeouts:
Two more methods of the window object enable you to set timeouts.
method has two parameters. The first is a JavaScript statement, or group of
statements, enclosed in quotes. The second parameter is the time to wait in milliseconds (thousandths of seconds). For example, this statement displays an alert dialog after 10 seconds:
The setTimeout()
ident=window.setTimeout("alert('Time's up!')",10000);
A variable (ident in this example) stores an identifier for the timeout. This enables you to set
multiple timeouts, each with its own identifier. Before a timeout has elapsed, you can stop it with
the clearTimeout() method, specifying the identifier of the timeout to stop:
window.clearTimeout(ident);
These timeouts execute only once; they do not repeat unless you set another timeout each time.
Example:
<HTML>
<HEAD><TITLE>Timeout Example</TITLE>
<SCRIPT>
var counter = 0;
// call Update function in 2 seconds after first load
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 106
ID=window.setTimeout("Update();",1000);
function Update() {
counter ++;
window.status="The counter is now at " + counter;
document.form1.input1.value="The counter is now at " + counter;
// set another timeout for the next count
ID=window.setTimeout("Update();",1000);
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Timeout Example</H1>
<HR>
The text value below and the status line are being updated every
one second.
Press the RESET button to restart the count, or the STOP button
to stop it.
<HR>
<FORM NAME="form1">
<INPUT TYPE="text" NAME="input1" SIZE="40"><BR>
<INPUT TYPE="button" VALUE="RESET" onClick="counter = 0;"><BR>
<INPUT TYPE="button" VALUE="STOP" onClick="window.clearTimeout(ID);">
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 107
<HR>
</BODY>
</HTML>
This program displays a message in the status line and in a text field every one second, including
a counter that increments each time. You can use the RESET button to start the count over and
the STOP button to stop the counting.
Example creating digital clock:
<HTML>
<HEAD>
<TITLE>JavaScript Clock</TITLE>
<script Language="JavaScript">
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timevalue=""
if(hours>12)
timevalue=hours-12;
else
timevalue+=hours
if(minutes<10)
timevalue+=":0"+minutes
else
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 108
timevalue+=":"+minutes
if(seconds<10)
timevalue+=":0"+seconds
else
timevalue+=":"+seconds
if(hours>=12)
timevalue+=" P.M. "
else
timevalue+=" A.M. "
document.myform.myclock.value=timevalue;
window.status=timevalue;
setTimeout("showtime()",1000);
}
</script>
</HEAD>
<BODY onLoad="showtime()">
<form name="myform">
<input type="text" name="myclock" size=12>
</form>
</BODY>
</HTML>
Example: Scrolling Text in the Status Bar
<HTML>
<HEAD>
<TITLE>Scrolling Text</TITLE>
<script language="JavaScript">
window.status="This is a simple text scroll"
function scroll()
{
text=window.status;
ftext=text.substring(0,1);
text=text.substring(1);
text+=ftext;
window.status=text;
setTimeout("scroll()",200)
}
</script>
<Body onload="scroll()">
<h3>Example of Scrolling text on the status bar
</body>
</head>
Using System clock
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 109
The Window object has “setTimeout()” function which can be used to repeatedly call
a function with a specified time gap. It takes two parameters (a) function which
should be called (b) time in milliseconds after which every call should be made.
Ex.System clock
<html>
<head><title>Untitled Document</title></head>
<body>
<script language="javascript">
var num=0, tim;
function timeout(){
num++;
if(num==3){
alert("ok- I told you twice");
window.clearInterval(tim);
}
else{
alert("this is 10-second message No :"+num);
tim=window.setTimeout("timeout()",1000);
}
}
timeout();
</script>
</body>
</html>
Ex.JS Digital clock
<html>
<head>
<title>digital clock</title>
</head>
<script language="javascript">
function tick(){
//create a new Date Object
var now= new Date();
//extract the current hours, minute and seconds
var hh = now.getHours();
var mn = now.getMinutes();
var ss = now.getSeconds();
//ensure each component has to digits
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 110
if(hh <=9) hh = "0"+hh;
if(mn <= 9) mn = "0"+mn;
if(ss <=9) ss="0"+ss;
//assign the current time string to the form field
document.forms.f.clock.value = hh + ": " + mn + ": " + ss;
//set the interval to one second
window.setTimeout("tick()",1000);
}
</script>
<body>
<form name="f">
<input type="text" style="background-color:#000" name="clock" value=" "
size="36" style="width:175;background-color:#000;color:#0F0;fontsize:36px;font-family:impact;">
<p><input type="button" name="sb" onClick="tick()" value="click to start the
clock"
</form>
</body>
</html>
PHP
History
PHP was first coded by Rasmus Lerdorf, an IT contractor, tracking his own clients.
It was known as Personal Home Page, written using pearl script.
In 1996, PHP-FI(Form Interpreter) was released seeing the popularity and inflowing enquiries.
In 1998 PHP 3 was released and updated to PHP 4 later on.
Advantages
Speed: it uses very less resources.
Stability : because it has cross browser compatibility in terms of Operating system platform and also different server and database technologies
Ease of usage: There is no need of any prior knowledge of programming, only basic
knowledge in HTML is enough to handle PHP.
Working of PHP
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 111
As Javascript is between server code(file/program) and the user (browser), the PHP is
between the Server and the Database.
The PHP will parse the users code(HTML/Browser) on behalf of Web server and communicate with the database.
It is known as server side coding/technology.
It is not by itself a server but it is build as an “add on”(extra programming/parsing technique) to help the web server. This is the reason why it is a light weight component and
has good speed.
PHP works with server and also database. It is more specific to database and server
techniques. The communication between website users and database becomes easy
with PHP coding.
It works on varied platforms of windows and linux.
It works with most of the servers available in market.
It works with most of the database systems also.
The most favoured are “Linux” “Apache server”, “My SQL” with “PHP”(LAMP). Since
these are open source codes, which are freely available for download on the net, it has
taken the popularity by storm. It accounts to 56% of web servers using PHP.
Important NOTE:
Wamp Server is a collection of My SQL, Apache, PHP loaded on network server by name
“phpserver”.
Open the browser and type //phpserver/php/apt108 in the address bar.
Create a folder on your name/reg number and save your files in that.
To see the output of your files double click on the file you saved, after coding it, from
the same directory in the browser.
This means that the file you are saving is saved on the server which is going to be used
by the user when connected. So when you double click the file you are opening as a
user in the browser.
If using dreamweaver also, give the same directory when asked to save the file. It
should look something like “//phpserver/php/apt108/B555”
Open the dreamweaver and click on “PHP” to open a new file. Save the file after coding
without any extension. The extension “php” will automatically allotted by dreamweaver.
Click on browser while saving and point towards “Mynetwork – Entire network – Microsoft windows network – Aptech – PHPSERVER(phpserver) – www – PHP – Apt108 “ and
enter the folder you have created the name with.
Basics of PHP
PHP is not case sensitive. echo, Echo, ECHO are same.
It is a loosely typed language. For example when PHP pharser sees the character $ it
expects an variable/any object. So you can mix the variable with all other text as simply
writing English language.
A PHP statement is a command for browser.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 112
Use semicolon (;) at the end of each statement, it confirms the end of one command
like a full stop for english language.
Using ; you can write more commands in a single line.
“{“ and “}” are used to create one single block of commands to ensure that all the executed.
PHP code is embedded anywhere inside HTML file with any one tag style given below.
(a) <?php Code for php?>
(b) <?php Code for ?>
(c) <script language=”php”> code for php </script>
Comments in PHP are given with “//” or “#” for single line and /* and */ for multi line
comments.
Ex.
<html>
//saying hello
<?php echo(“<h1> Hello world </H>”); ?>
# even this is single line comment in php.
/*
echo command is used more often to display the text on the users browser. There is
no hard and fast rule to concatenate strings you can just type the $ symbol for
any variable inside the text itself.
*/
</html>
Adding Dynamic content
You can use all html tags inside the text while displaying using the echo() function.
This will result in producing dynamically an HTML webpage. Ex. Echo(“<h1> hello </h1>”);
Escape Sequence
Escape sequence is a series of characters followed by a “\” (back slash).
It gives instructions to the PHP pharser that it is a special symbol following the slash.
Ex. Escape sequence
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Escape Sequence</title>
</head>
<body>
<?php echo ("<textarea rows=5 cols=54>");
echo ("\"this is a textarea created dynamically using the php echo command");
echo ("you will be finding this line broken into two pieces from here \n and ");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 113
echo("you will see that tabs are also functionings \t\t\t\t\t properly ");
echo("this is closing the textarea </textarea>");
?>
</body>
</html>
Reserved Words
Reserved words are words reserved for the system to use. These words are not to
be used by the user for naming either variables, functions etc.
and
E_PARSE
$argv
E_ERROR
old_function
E_WARNING
parent
$argc
Eval
PHP_OS
break
exit()
$PHP_SELF
case
Extends
PHP_VERSION
cfunction
FALSE
print()
class
For
require()
continue
Foreach
require_once()
declare
Function
return()
default
Global
static
$HTTP_COOKIE_VARS
switch
die()
$HTTP_GET_VARS
stdclass
echo()
$HTTP_POST_VARS
$this
else
$HTTP_POST_FILES
TRUE
elseif
$HTTP_ENV_VARS
var
empty()
$HTTP_SERVER_VARS
xor
enddeclare
virtual()
endfor
include()
while
endforeach
include_once()
_FILE_
endif
list()
_LINE_
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 114
endswitch
New
_sleep
endwhile
Not
_wakeup
E_ALL
NULL
Variables
Variable stores a reference to the location of the memory.
It can hold any value of a given type.
Every variable should start with “$” symbol.
You can use numbers, alphabets and Underscore (“_“) for naming a variable.
Variable name should not begin with number.
While using the variables, PHP automatically sets the type of variable itself.
Variable names are case sensitive. ie, $name, $Name and $NAME is different.
Ex.
$abc
$my_first_variable
$var123
Values are assigned using the “=” operator.
Every statement should end with a semicolon.
A variable once declared can hold any type of data there is no restriction on the type of
data values.
Datatypes
Basic data types are :(a) Floating type: these data types have a number with a decimal value ie., 3.142, 4.555
etc.
(b) Integer type : these data types are numbers without any decimal value. ie integer
like 234, 456, 58777.
(c) Strings are values of text embedded inside quotes like “my name”, ‘who’ etc.
(d) Boolean values carry either “true” or “false”.
(e) Null means empty/no value. (null is case insensitive).
Ex.Data types
<html>
<?php $str = “here is a string”, $non=NULL;
$int=77; $flt = 3.142;
echo(“string:$str<br>”);
echo(“Integer:$int<br>”);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 115
echo(“Floating- point : $flt<br>”);
echo(“Null:$non”);
?>
</html>
Functions
Functions are small set of programme codes/statements used to execute a certain task
whenever called.
They do not execute unless called.
Names of functions should be same as names of variables.
Two types of functions are found in PHP (a) inbuild like “echo()” (b) User defined.
A function should be written with keyword “function” followed by a space and a name.
Followed by a pair of parenthesis. Then by a pair of curly braces “{}”, in which the code
to be executed is enclosed. Ex. function go() { echo(“<br>”);}
Functions should be defined( ie., code should be written) before we call the function.
While calling a function use the name followed by a pair of parenthesis. Ex. go();
Ex.functions
<html><head><title>functions demo</title></body>
<body>
<?php function go(){
Echo(“<hr>”);
} ?>
<?php go();?>
<p>**** HTML is great for static content ****<p>
<?php go();?>
</body></html>
Passing values to functions
The values are passed to the function by writing them within the braces while calling.
They should be seperated by a comma.
These are called as arguments.
There is no restriction on number of arguments to send, but the serial of values should
match. When we call the function, the series of arguments used, should match the
function which is receiving the arument series.
Ex. go(‘hello”, “ramesh”); is calling; and function go(“greeting”, “name”) is receiving
the first argument is received properly. If you alter to go(“ramesh”, “hello”)
there will be a problem because the function is expecting greeting first and not
the name.
You can pass values or even variables inside the brackets while calling the functions.
A php file may have any number of functions inside it.
A call can be made from any code to a function.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 116
Function can also call another function from within it.
All the functions can be called any number of times.
Ex. Multiple functions
<? Php
function make_double($num){
$new_number = twice($num);
echo (“The value is $new_number”);
}
function twice($arg){
return $arg + $arg;
}
?>
<html><head><title>Multiple functions </title></head><body>
<h3> <?php make_double(4); ?> </h3>
</body>
</html>
Variable Scope
Variables carry certain value. These values are not available wherever you need for
usage. But are available within the scope you declare.
A “scope” means the area of the program when the value will be accessible.
Generally the scope would be the place inside the curley braces “{ }”.
If the variable is declared within the function then the variable will be known only to the
function. Outside the function the variable is not known. Then this is said to be the local variable for the function.
If the variable is declared outside the function, then that variable value can be used by
all the functions and code outside the function. This is called a global variable.
If the code is trying to access the variable even before its creation then there would be
a error.
The code or functions can access the variable only after the declaration/creation.
Global variables are created with simple declarations but while addressing them from inside a function they have to be re-declared before using them, with the key word “global”.
It is always a good practice to place all the functions and variables of the PHP before
even starting the HTML code. It signals a clean coding system.
Ex. Variable scope
<?php $num;
function make_triple($arg){
global $num;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 117
$num = $arg + $arg + $arg:
thrice();
}
function thrice(){
global $num;
echo(“the value is $num”);
}
?>
<html><head><title>variable scope</title></head>
<body> <h3><?php make_triple(4); ?>
</h3></body></html>
Multiple Arguments
You can provide multiple arguments for the function by separating them with a comma.
In PHP you can also provide a default value to the arguments right inside the receiving
parenthesis.
If the argument is received with a value then this default value is overwritten else the
default value is taken into consideration.
Ex. function multiply($a=45, $b=50).
This function will receive two arguments as its parameters if the values are received
they will be assigned to a and b. Otherwise a will be assigned with 45 and b
with 50.
Note that giving default value is optional and not compulsory. These values are given
so that you don’t have any runtime error in the code.
Arithmetical operators
For performing mathematical operations on the values we a set of operators.
OperaDescription
Example
tor
Basic Arithmetic Operators
+
*
Adds
$a=15,
$b=10
,
$c =
$a+$b
;
Subtracts
$c = $a$b;
Multiplica$c=$a*$b
tion
;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
$c=25
$c=5
$c=150
MRR 118
/
%
Division
Modulus
$c=$a/$b;
$c=
$a%$
b; results
in 5.
++
Increments
the
operand
with 1.
$a=15,
$b=10
$a++;
$c=($
a++)$b =5;
++$a;
$c=(+
+$a)$b =6;
--
decreases
the
operand
with 1.
$a=15,
$b=10
$a--;
$c=($
a--)$b =5;
$c=1.5
Gives
the
remai
nder
after
division.
$a++
results
in
operation
first
and
incre
men
t
next
.
++$a
results
in
incre
men
t
first
and
operation
next
.
$a—
results
in
opera-
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 119
--$a;
$c=(-$a)-$b
=6;
tion
first and
incre
men
t
next
.
--$a results
in
incre
men
t
first ad
operation
next
.
All *, -, /,+ will work perfectly as you expected.
“.” (dot) is used for concatenating two strings/values/variables and produce a single
string.
NOTE THAT “+” OPERATOR WORKS FOR ADDITION AND NOT FOR CONCATENATION AS IN JAVA SCRIPT.
Ex. Arithematic Operators
<?php
$addnum = 20+3;
$addstr="php is "."just like java script";
$sub=35.75 - 28.25;
$mul= 8* 50;
$mod= 67%2;
$inc=5; $inc=++$inc;
$dec = 5; $dec = --$dec;
$result =
$result.=
$result.=
$result.=
$result.=
$result.=
$result.=
"addnum: $addnum <br>";
"addstr: $addstr <br>";
"sub : $sub <br>";
"mul: $mul <br>";
"mod: $mod <br>";
"inc : $inc <br>";
"dec : $dec <br>";
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 120
?>
<html>
<head> <title>arithmetical operators</title></head>
<body>
<h2><?php echo ($result) ; ?></h2>
</body></html>
Ex.Using Unary Operator
<HTML><HEAD><TITLE>USING INCREMENT OPS</TITLE></head>
<body>
<SCRIPT language="php">
$no=1000;
echo("<h1>The given number is :$no</h1>");
echo("<h2> $no operated with ++ gives :".(++$no));
echo("<p>".(--$no)." operated with -- gives :".(--$no));
echo("<p>negation of $no is ". -(no));
echo("<hr><h1> PUT THE ++ AND -- AFTER THE NO AND SEE THE DIFFERENCE");
</SCRIPT></body></HTML>
Logical operators
&&
and
||
or
Returns true when
both the operands
are true
Can use both “&&” or
“and”.
Returns true when either operand is
true
Can use both “||” or
“or”.
$a=10, $b=15;
if($a>10 &&$b>10)
$c=20;
results in $c=null.
if($b>10) $c=$b;
results in $c=15
if($a>10 || $b>10)
$c=20;
results in $c=20;
xor
Logical exclusive XOR.
Only one condition
should be true,
then the result will
be true else false.
if($a>10 xor $b>10)
$c=20;
results in $c=20;
(because only second
condition is true).
!
Returns true if operand is false and
false if operand is
true.
$a=true; $b=false;
if($a) $c=40 results in
$c=40;
if(!$b) $c=50 results in
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 121
$c=50;
Logical operators are used only with expressions which can evolve into a true or false or
with boolean type of data.
&& and “and” operator are one and same. These operators result into true if both the
conditions are true and result into false even if one operand is false.
“&&/and” operators are useful when we want to take a decision path if two conditions
are true.
|| and “or” are one and same. You can use any of them. When used these operators
result in true if atleast one of the condition is true, and results in false if both the conditions are false.
“||, or” operator in php is useful when we want to take a decision path based on atleast
one condition is true from two.
“xor” will result in true only if one of the condition is true. Even if two conditions are
true, it results in false.
“xor” is useful when we want to take decision based on two conditions out of which only
one should be true while other being false.
“!” Logical not operator results in opposite of what the condition is. If condition is true it
results in false, if the condition is false it results in true.
“!” logical not works like a toggle(on/off) when we want to use in a loop, by changing
the value to true and false alternatively.
Ex. Logical Operators
<?php
$a=50;
$b=66;
$c = false;
if($a>45 && $b<100) echo("Result of addition is : ".($a+$b)."<br>");
if($b<50 and $b==66) echo("This may not be printed");
if($a==50 or $b<10) echo("This is passing the test because one condition is true
<br>");
if($a<100 || $b<10) echo("This also passed the test because one condition is
true <br>");
if(!$c) echo("Result of logical not<br>");
if($a<100 XOR $b<10) echo("This is the result of exclusive or<br>");
?>
Ex. Logical Operators
<?php
$a=true; $b=false;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 122
# test both operands for true
$test1 = ($a and $a)? "true" : "false";
$test2 = ($a and $b)? "true" : "false";
$test3 = ($b and $b)? "true" : "false";
# test either operand for true
$test4 = ($a or $a)? "true" : "false";
$test5 = ($a or $b)? "true" : "false";
$test6 = ($b or $b)? "true" : "false";
#test for single operand is true
$test7 = ($a xor $a)? "true" : "false";
$test8 = ($a xor $b)? "true" : "false";
$test9 = ($b xor $b)? "true" : "false";
#invert values
$test10 = (!$a)? "true" : "false";
$test11 = (!$b)? "true" : "false";
$result = "AND -1:$test1 2:$test2 3:$test3<br>";
$result .= "OR -1:$test4 2:$test5 3:$test6<br>";
$result .= "XOR -1:$test7 2:$test8 3:$test9<br>";
$result .= "NOT -1:$test10 2:$test11<br>";
?>
<HTML><HEAD><TITLE>LOGICAL OPERATORS </TITLE></head>
<BODY>
<?PHP ECHO($result); ?>
</BODY></HTML>
Assignment Operators
The “=” operator assigns the value to the left hand side with the value equal to the right
hand side. It is not checking for equality of two values.
For rest of the assignment operators we have the read the expressions as “The new value
of left side is the old value of it plus/multiply/divide/minus the given value on the right hand
side.
Assignment Operators
=
Number on the
right side is
assigned to
left side.
-=
New value of
$a=15; $ b=10;
$a = $b; results in
$a=10;
$a = ($b*100)/10 results
in $a=100;
$a=$15; b=10
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 123
+=
(for
numbers)
/=
%=
*=
.=
left side will
be old value of it minus the
number on
right side.
New value of
left side will
be old value of it plus
the number
on right
side.
New value of
left side will
be old value of it divided with
the number
on right
side.
$a-=4; results in (15-4)
$a=11;
$b-=2; results in (10-2)
$b=8;
New value of
left side will
be old value of it
modulus
with the
number on
right side.
New value of
left side will
be old value of it
multiplied
with the
number on
right side.
New value of
left side
string will
be equal to
old value of
it appended
with the
$a=15; $b=10
$a %= 3; remainder of
(15 / 3) $a=0;
$b %= 3; remainder of
(10 / 3) $b=1;
$a=15; $b=10
$a+=$b; results in
(15+10) $a=25;
$b+=2; results in (10+2)
$b=12;
$a=15; $b=10
$a /= 2; results in (15 /
2) $a=7.5;
$b /= 2; results in (10 /
2) $b=5;
$a=15; $b=2;
$a*=2; results in 30
$b*=4l; results in 8
$a=”this is”;
$a.=”text”;
result in $a=”This is text”
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 124
new string
on the
right.
Ex. Assignment Operators
<?php
$a = "php "; $aa = "script" ; $storea=$a;
$a.=$aa;
$b=8; $bb = 4; $storeb=$b;
$b+=$bb;
$c = 7.5; $cc = 2.25; $storec=$c;
$c -=$cc;
$d = 8; $dd = 4; $stored=$d;
$d *= $dd;
$e = 8; $ee=4; $storee=$e;
$e /= $ee;
$f = 8; $ff = 3; $storef=$f;
$f %= $ff;
$result
$result
$result
$result
$result
$result
= "\"$storea \" add and assigned with string \"$aa\" is : $a<br>";
.= "\n $storeb added and assigned with interger $bb is : $b <br>";
.= "\n $storec substracted and assigned wth float $cc is : $c<br>";
.= "\n $stored multiplied and assigned with $dd is : $d<br>";
.= "\n $storee divided and asigned with $ee is : $e<br>";
.= "\n $storef modulo and assign with $ff is : $f";
?>
<html><head><title> assignment operators </title></head>
<body> <?php echo($result); ?> </body></html>
Comparison Operators
Comparison
==
Returns true if operands are equal
$a=10; $b=15
if($a==$b) $c=14; result $c=null;
$a=10; $b=10
if($a==$b) $c=14; result $c=14;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 125
!=
Returns true if operands are not equal
>
Returns true if left operand is greater than
right operand.
Returns true if left operand is less than
right operand.
Returns true if left operand is greater than
or equal to right
operand.
<
>=
<=
Returns true if left operan is less than or
equal to right.
$a=15; $b=24;
if($a!=$b) $c=12; result $c=12;
$a=15; $b=15;
if($a!=$b) $c=12; result $c=null
$a=10, $b=10;
$a>$b //result false;
$b>$a //result false;
$a=19, $b=23;
$a<$b //result true;
$b<$a //result false;
$a=14, $b=14;
$a>=$b //result true;
$a=14, $b=16;
$b>= $a //result true;
$a=213, $b=234;
$a<=$b result true;
$a=313, $b=313;
$a<=$b result true;
Note that “=” is used for assignment of a value to a variable but “==” is used to compare two values.
“==” results in either true or false based on the types of the values.
“==” results in true if two numbers are equal.
“==” results in true if two strings contain same characters in same positions.
“!=” (not equal to) results in true if two number/strings are not equal in some manner, if
they are equal this operator will return false.
“>” (greater than) results in true if the left hand side is greater in value when compared
to the right hand side.
Note that expressions like (a+b), (23+34) etc., can also be used in the place
of variables/values.
“<” (lesser than) equals to true if the left hand side is lesser than the right hand side in
value.
Note that strings cannot be compared using “<” , “>”, “<=”,”>=” operators.
“<=” (lesser than or equal to) if the left side is equal to right side or lesser than the
right hand side then this operator will result in “true” else it will result in false.
“>=” (greater than or equal to) if the left side is equal or greater than the right hand
side then this operator will result in true else it will result in false.
Ex. Comparison operators
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 126
<?php
$a = ("php" == "php")? "true" : "false";
$b = ("php" == "PHP")? "true" : "false";
$c = (1.758 == 1.758)? "true" : "false";
$d = (5 != 5 )? "true" : "false";
$e = (true == true)? "true" : "false";
$f = (false != false)? "true" : "false";
$g = (100 < 100 )? "true" : "false";
$h = (100 < 200)? "true" : "false";
$i = (100 <= 100 )? "true" : "false";
$j = ( -1 > 1 )? "true" : "false";
$result
$result
$result
$result
$result
$result
= "Test Strings \$a:$a \$b:$b<br>";
.= "Test Numbers \$c:$c \$d:$d<br>";
.= "Test Boolean \$e:$e \$f:$f<br>";
.= "Test Less Than \$g:$g \$h:$h<br>";
.= "Test Greater Than Or Equal \$i:$i <br>";
.= "Test Greater Than \$j:4j";
?>
<html><head><title>Comparison Operators </title></head>
<body>
<?php echo ("<h2>$result</h2>"); ?>
</body>
</html>
Conditional Operator
SYNTAX: (condition) ? if true do this : if false do this;
First the condition is evaluated and if it results in true the first statement is executed
and if it is false the second condition is executed.
Generally, this operator is used to assign a value or take a function based on a decision.
Ex. Conditional Operator
<?php
function is_odd(){
global $num;
echo ("$num is an odd number <hr> ");
}
function is_even(){
global $num;
echo ("$num is an even number <hr>");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 127
}
?>
<html><head><title>Conditional operator </title></head>
<body>
<?php
$num=57;
($num % 2 != 0) ? is_odd() : is_even();
$num = 44;
($num %2 != 0 ) ? is_odd() : is_even();
?>
</body>
</html>
If conditional statement
Syntax: if(test expression) statement to execute when true else statement to excute for
default.
First the condition is evaluated. If the condition is true the immediate statement/s executed.
The “else” clause is executed if the condition is false or as default.
“test expression” can comprise of number, strings expressions or variable comparisons
but the end result should be either true or false.
If there is no more than one statement there is no need of any parenthesis.
If there are more than one statmement to be executed then they should be kept in curly
braces. “{ }”.
Ex. If Statement
<html>
<head><title> if statment </title></head>
<body>
<?php
$num = 7;
if ($num % 2 != 0){
$msg = "$num is an odd number .";
echo ($msg);
}
?>
</body></html>
“If else” statement (conditional branching)
Syntax : if(test expression) do this; else do this;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 128
First the condition in the first “if” is evaluated if its true the statements following the
condition are executed.
Else next if codition is tested.
Several conditions are tested until you reach a true expression.
If no condition is found true it ignores the rest of the code.
If an else clause is mentioned then it is executed by default.
This is also known as “if else ladder”.
Ex. If else statement
<html><head><title>If-else Statement</title></head>
<body>
<?php
$num=2; $bool=false;
if($num == 1 and $bool == true) echo("Test 1 success") ;
else
if($num == 2 and $bool == true) echo("Test 2 success") ;
else
if($num == 2 and $bool == false) echo("Test 3 success") ;
else
if($num == 3 and $bool == false) echo("Test 4 success") ;
?>
</body></html>
“Switch” statement
Syntax:
switch(n)
{
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
}
Expression n (most often a variable) is evaluated once. The value is then compared with
the values for each “case” in the structure. If there is a match, the block of code associated with that case is executed.
Use “break” to prevent the code from running into the next case automatically.
Ex: switch (no){
Case 1:
Case 2:
Case 3:
Case 4: echo (“all options are contained till 4 in this statement”);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 129
break;
}
If you need to execute a single set of statement/s for two or more consecutive options.
avoid break statement as given above.
You can use any type of data inside the “switch()” like numbers, strings, boolean.
You can also use expressions which will result in one value.
Ex. Switch statement
<html><head><title>switch Statement</title></head>
<body>
<?php
$num=2;
switch($num){
case 1: echo("This is case 1 code") ;
break;
case 2: echo("This is case 2 code") ;
break;
case 3: echo("This is case 3 code") ;
break;
default :echo("This is default code") ;
}
?>
</body></html>
“for” loop
Syntax : for (initialization ; test condition; iteration) { statement/s}
First the initialization section will initialize the variable.
Then the “test condition” is tested.
If the condition is true the statement/s following are executed.
Next, the condition is checked, if its true the statements are executed again and in the
iteration section the value is either incremented or decremented.
This process is repeated till the condition becomes false.
“for” loop should be used if you know the number of times you want to execute a given
code.
You can initialize multiple variables at a time inside the for loop. But commas(,) should
be should be used between them.
You can also use multiple variables in iteration section separated by a comma.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 130
Ex. For Loop
<html><head><title>switch Statement</title></head>
<body>
<?php
$a=0; $b=0;
for($i=0; $i<5; $i++){
$a += 10; $b +=5;
}
echo("at the end of the loop a=$a and b=$b");
?>
</body></html>
While loop
Syntax: while (test condition){
Code;
}
First the test condition is tested, if its true the code inside the curly braces is executed else not executed.
Test condition can be any expression but it should evaluate into a “true” or “false”.
The loop will continue unless the condition is broken from inside the code. So the
code inside should ensure that the condition will become false at some point. Otherwise the loop will become infinite loop.
This loop should be used when there is a situation where we do not know how many
times the loop should be executed to achieve a target.
Note that if the condition is false the loop will not execute even once.
Ex. While loop
<html><head><title> If Statement</title></head>
<body>
<?php
$num = 0; $i=50;
while ( $num < 10){
$i--;
$num++;
}
echo( "loop stopped at $num \$i is now $i" );
?>
</body></html>
Do while loop
Syntax : do {
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 131
} while (test condition)
Firs the set of commands/statements given in the block are executed and then the condition is tested.
If the condition results in true the statements will be executed again else the loop will
stop.
“do while” loop construct should be used when you need some information to be executed before taking the decision. And when we do not know the number of times we
are going to execute the loop for a search.
Ex. Do while statement
<html>
<head><title>do while loop </title></head>
<body>
<?php
$i=0; $num=50;
do {$num = 50; $i++;}
while($i<1);
echo (“loop stopped at $i<br/> \$num is now $ num”);
?>
</body></html>
Breaking loops
It is not necessary that the loop has to complete unless the condition is complete. We
can even break the loop based on certain condition.
The condition for break should be mentioned within the block of the loop.
A simple “break” statement followed by a semicolon will break the loop at any point inside the loop block.
Generally the break statement will be accompanied with a “if” condition.
Ex.Break statement
<html><head><title> Break statement</title></head>
<body>
<?php
$i-0;
While ($i<6){
if($i == 3) break;
$i++;
}
Echo (“loop stopped at $i by break statement”);
?>
</body></html>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 132
Continue Statement
The continue statement is used to “bypass” certain code under a given situation and go
ahead with the next iteration.
First give a “if” statement and test for the given condition and use “continue” statement
to bypass the rest of the code written in the block of the loop.
It will go ahead with the next iteration.
Ex. Continue statement
<html><head><title>continue statement</title></head>
<body>
<?php
$i = 0; $passes;
While($i<5){
if($i<5) continue;
$passes .=”$i “;
}
echo(“loop stopped at $i<br>”);
echo(“completed iterations : $passes”);
?>
</body></html>
“return” statement
The “return” statement is used within a function to return the values to the calling
statement.
Only one value can be returned from any function.
Ex. Return statement
<?php
function multiply ($a=1, $b=1, $c=1, $d=1, $e=1){
$total = $a * ($b * ($c * ($d * $e)));
Return $total;
}
?>
<html><head><title>return statement <title></head>
<body>
Each year has 3651/4 days <br/>
Each day has 24 hours <br/>
Each hour has 60 minutes <br/>
Each year has <?php echo (multiply (365.25, 24, 24, 60)) ?>
Minutes
</body></html>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 133
Arrays
An array can be defined as a single variable containing many values.
In php an array can contain different types of data in one single array. There is no restriction of type of data unlike in java script etc. A single array can hold different types
of data in itself.
There are three basic types of arrays in PHP.
(a) Numeric Array – Array with a numeric ID key.
(b) Associative Array – Array where each ID is associated with a value.
(c) Multi-dimensional Array – Array containing one or more arrays in it.
Numeric Array
Numeric IDs are automatically assigned to the array.
All the values can be addressed using an index number. Ex. $a[3], $myarr[0] …
The index value starts from 0.
All the values can be assigned while declaring the array itself.
Ex.
$subjects = array(“English”, “Maths”, “Science”, “Social”);
$marks = array(45, 65, 66, 76, 78);
elements of the array should be seperated with a comma.
An array containing 5 elements will have index values from 0 – 4.
The last element may be addressed as $marks[4].
While giving the index numbers square brackets”[ ]” should be used.
Values can also be assigned using individual index numbers.
Ex. $subjects[0] = “english” ;
$subjects[1] = “Maths” ;
$subjects[2] = “science” ;
$subjects[3] = “social” ;
Individual values can be used as we use normal variables.
Ex. echo $subjects[0].” is the first language and ”.$subjects[1].” ,”.$subjects[2].” , “.
$subjects[3].” are compulsory subjects” ;
//output:
english is the first language and Maths, science, social are compulsory
subjects.
If you need to use the index values from 1 instead of 0 you can do so by inserting
“1=>” inside the array before the first element, while assigning the values.
Ex. $subjects = array(1=> ”english”, “maths”, “science”, “social”);
Now $subjects[1] will cause the result as “english” and there is no element like
$subjects[0].
Ex. using arrays
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 134
<?php
$dy = array("19th ", "20th ", "7th ");
$mo = array("Aug ", "Aug ", "Feb ");
$yr = array("1979 ", "2009", "1973 ");
echo ($dy[0].$mo[0].$yr[0]."<br>");
echo ($dy[1].$mo[1].$yr[1]."<br>");
echo ($dy[2].$mo[2].$yr[2]."<br>");
?>
An php array can contain different types of data items in a single array.
Array can also change values after assigned to the array variable.
These feature are demonstrated in the following example.
Associative Arrays
Associative arrays have values and keys assigned to it.
There is no id assigned to it automatically by the system, instead we have to assign
key and value both.
Ex. $marks=array(“Ram” => 456, “sham”=>396, “rajesh”=>512, “ramesh”=>443);
The key and value can be of any data types. But each value is associated with its
key.
In the above example the names of the students are keys and the values are the
marks held by the array.
“ => ” is used to associate the values with the keys.
For addressing individual marks we have to use $marks[‘Ram’]. This will produce
the value of 456 which is associated with it.
Note that the id here is ‘Ram’ which is enclosed in single quotes. Though there is
no hard rule that we have to use single or double quotes for ids within the square
brackets, it is a convention to use single quotes, to differentiate between strings and
ids.
The key string used in above example is case sensitive because data type is of
string.
Ex. $marks[‘ram’] will not give result.
$marks[‘Ram’] will give the result of 456.
You can also use the individual values as we use variables.
Ex. echo (“ram and sham together scored “.($marks[‘Ram’]+$marks[‘sham’]) );
NOTE: Remember that since the associative array are having its own keys we cannot
use the for loop for displaying the results. You have evaluate your own technique to
display the elements.
Multidimentional Arrays
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 135
In this type of arrays the array element can contain another in itself as an element.
Even the sub element of the array can contain another array. Rest of the conditions for forming the arrays are same. There is no restriction on the type of the
data it contains.
Ex. changing data types
<html><head><title>changing data types in arrays</title></head>
<body>
<?php
#create an array containing 3 strings
$arr = array("red ", "green ", "blue ");
echo ("<h3>String Array before changes </h3><br>");
echo ($arr[0].$arr[1].$arr[2]."<br>");
#assign new numeric values of different data types
$arr[0] = 44;
$arr[1] = 12.5;
$arr[2] = $arr[0] + $arr[1];
echo("<h3>After changing String array to numeric array </h3><br>");
echo ("$arr[0] + $arr[1] = $arr[2]");
?>
</body></html>
Note that the “+” symbol in the above example is printed as it is on the screen.
Using foreach() function
foreach() function in php is used to list the items of the array in sequence.
syntax : foreach(arr as var) {current value}
This is a loop just like “for loop” which will execute only that many times as the elements in the array. There is no necessity of initialization or increment or condition. “arr” is the array from which we are extracting the elements.
“var” is the variable in which the elements are assigned one by one each time the
loop is executed.
The value of the variable can be used within the curly braces with the current value.
Ex. using foreach
<html><head><title>using foreach loop</title></head>
<body><ol>
<?php
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 136
$arr = array("red ", "green ", "blue ", "cyan", "magenta", "black", "yellow");
foreach($arr as $value){
echo ("<li> Do you like $value?");
}
?>
</ol></body></html>
Finding size of arrays
size of the array can be found with sizeof() and count() functions.
Both the functions take the array as the argument inside the brackets.
Ex. finding size of arrays
<html><head><title>finding size of arrays</title></head>
<body><ol>
<?php
$arr = array();
#assign three elements
for($i=0; $i<3; $i++){
$arr[$i] = "<li>this is element $i";
}
foreach($arr as $value){
echo ($value);
}
#assign the number of array elements
$size = count($arr);
echo ("<li> total number of elements found using \"count\" function is $size");
$size = sizeof($arr);
echo ("<li> total number of elements found using \"sizeof\" function is $size");
?>
</ol></body></html>
Inbuilt Array functions
array_unshift :
Syntax : array_unshift(array, element1, element2 ……elementn);
This function adds elements at the beginning of the array.
It takes minimum two arguments.
The first element is the array in which the element is to be set.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 137
And the second and next elements are the values to be inserted into the given
array.
array_push :
Synntax : array_push(array, element1, element2 ……elementn);
This function is same as array_unshift, but inserts elements at the end of the array.
The first argument is the array in which the elements are to be inserted and the
second and next arguments are meant for elements which are to be inserted into
the given array.
Ex. Inserting elements
<html>
<head>
<title>inserting elements in array</title>
</head>
<body>
<?php
$arr = array("red", "green", "blue");
echo("<h2>Before modifying the array</h2><br>");
foreach($arr as $colorname){
echo("$colorname<br>");
}
#add elemetns at begininig of the the array
array_unshift($arr, "cyan", "magenta");
#add elements at ending of the array
array_push($arr, "yellow", "maroon");
echo("<h2>After adding elements to the array</h2><br>");
foreach($arr as $colorname){
echo("$colorname<br>");
}
?>
</body>
</html>
array_shift()
Syntax : array_shift(arrayname).
This function takes one array as its argument and returns the extracted element
from the starting point of the element.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 138
Only one element is derived. You have to save the element in other variable.
After deriving the element the element is lost permanently from the given array.
array_pop()
Syntax : array_pop(arrayname).
This function takes one argument, ie the name of the array from which you need to
extract one element from the ending point.
You have to save the element in your own variable.
After deriving the element the element is lost permanently from the given array.
sort()
Syntax : sort(arrayname).
This function takes one array as its argument and sorts the contents in ascending
order.
When sorting is complete first the values with alphabets is sorted and values starting
with numbers is sorted after alphabets. (alphabets first and numbers next).
When associative arrays are used with this function sort() will sort according to the
values of the arrays and not index.
While sorting if multidimentional array, associative array and normal values are
combined together as elements then, normal values are taken by their values, associative arrays are taken by their associated values and multidimentional arrays are
displayed as “Array” at the end of the sorted list.
Ex. Extracting elements from array
<html><head><title>extracting elements from array</title></head>
<body><?php
$arr = array("red", "green", "blue", "yellow", "pink");
echo("<h2>Before modifying the array</h2><br>");
foreach($arr as $colorname){
echo("$colorname<br>");
}
#extract element from begininig of the array
$temp = array_shift($arr);
echo ("<h4>extracted element from begining is: $temp</h4><br>");
#extract element from the ending of the array
$temp = array_pop($arr);
echo ("<h4>extracted element from last is: $temp</h4><br>");
echo("<h2>After removing the elements from the array</h2><br>");
foreach($arr as $colorname){
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 139
echo("$colorname<br>");
}
sort($arr);
echo("<h2>After sorting the elements of the array</h2><br>");
foreach($arr as $colorname){
echo("$colorname<br>");
}
?>
</body></html>
array_merge:
Syntax: array_merge(array1, array2, array3 ….arrayn)
This function takes minimum two arguments of type array and returns the combined
elements of the arrays.
The resultant array should be stored in another variable.
You can merge more than two arrays together.
Always the first array elements are figured first and then the elements of arrays as
they appear in sequence.
Ex. Merging arrays
<html><head><title>merging arrays</title></head>
<body><?php
$arr1 = array("red","green", "blue");
$arr2 =
array(56.3453, 34, 566, "pink");
$arr3 = array(345, "test", 43, "mesh");
#merging all the three arrays together and forming a new array
$arr = array_merge($arr1, $arr2, $arr3);
echo("<h2>After merging the three arrays</h2><br>");
foreach($arr as $colorname){
echo("$colorname<br>");
}
?>
</body></html>
array_slice:
Syntax: array_slice(array, startindex, numberofelements)
This function takes minimum two elements.
First argument is the array from which we want to slice and remove the elements.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 140
Second argument is the starting index of the element which you want to slice from
the given array.
Third argument is the number of the elements which you need to slice from the given array.
First two arguments are compulsory, ie array name and starting index.
Third argument is optional. If you mention the number of elements to be extracted
they will be extracted otherwise the elements till the end of the array are extracted
completely.
Slicing an array does not effect the original array in any way.
The sliced elements from the array should be stored in a different variable.
Ex. Slicing arrays
<html><head><title>slicing arrays</title></head>
<body><?php
$arr = array("red","green", "blue", 56.3453, 34, 566, "pink");
echo("<h2>Before slicing the array</h2>");
foreach($arr as $name){
echo("$name<br>");
}
#slicing the array and forming a new array
$temp =array_slice($arr, 2, 3);
echo("<h2>The sliced and extracted elements are </h2>");
foreach($temp as $name){
echo("$name<br>");
}
echo("<h2>After slicing elements the original array is </h2>");
foreach($arr as $name){
echo("$name<br>");
}
?>
</body></html>
Browser details
The environment of the user is enclosed in the variable “HTTP_USER_AGENT”.
We have to seek this variable by using the “getenv()” function.
Preg_match() function in php allows to match the given string with the environment variable and results in true or false if found.
Syntax of preg_match(): preg_match(“/string to seek/”, “string to search”);
“string to seek” is the string which we have to find within the environment variable
which is stored using getenv()function.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 141
“String to search” is a variable in which the environment of the user is saved using getenv() function.
Ex. Browser details
<html><head><title>Browser content</title></head>
<body>
<?php $viewer = getenv("HTTP_USER_AGENT");
$browser ="an unidentified browser";
if(preg_match("/MSIE/i", "$viewer"))
{$browser ="Internet explorer";}
else if(preg_match("/Netscape/i","$viewer"))
{$browser="Netscape";}
else if(preg_match("/Opera/i", "$viewer"))
{$browser = "Opera";}
$platform ="an unidentified platform";
if(preg_match("/Windows/i", "$viewer"))
{$platform = "Windows"; }
else if(preg_match("/Linux/i","$viewer"))
{$platform = "Linux";}
echo ("you are using $browser on $platform");
?>
</body></html>
Date and time
The PHP date() function returns the current date and time on the server.
It takes only one argument as the string.
The string is formatted with the characters listed in the table below.
The hours returned is the standard GMT if you need the correct time you have to adjust
according to the time zone.
Character
A
Meaning
prints “am” or “pm”
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 142
a
G
H
g
h
I
S
z
prints “AM” or “PM”
Hour in 12- hour format (1-12)
Hour in 12- hour format (01-12)
Hour in 24-hour format (0-23)
Hour in 24-hour format (01-23)
Minutes (00-59)
Seconds (00-59)
Time zone offset in seconds (-43200 to
43200)
Seconds since January 1, 1970 00:00:00
GMT
Day of the Month (1-31)
Day of the Month (01-31)
Day of the week (Mon – Sun)
Day of the week (Monday – Sunday)
Day of the week (0-6) from Sunday to
Saturday
Month (Jan – Dec)
Month (January – December)
Month (1-12)
Month (01-12)
Year (09)
Year (2009)
day of the year (0-365)
Number of days in a given month (28 –
31)
English ordinal suffix (1st, 2nd etc)
U
J
D
d
i
W
M
F
N
m
Y
y
Z
T
s
Ex.
$today = date (“j M,
$today = date (“d.m.y”);
$today = date (“g:I a”);
$today = date (“H:i:s”);
Y”);
prints
prints
prints
prints 3 Sep, 2009
11.20.05
11.20 am
11.20.50
Ex. Date function
<html><head><title>Date function</title></head>
<body>
<?php
$hour = date("G");
$now = date ("g:i:s a");
$msg = "Good Evening.";
if($hour <12) $msg = "Good Morning.";
if($hour <18) $msg = "Good Afternoon.";
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 143
echo ("$msg! the time is $now");
?>
</body></html>
Random Numbers
Random numbers are numbers generated between the given value every time you
call for display.
rand() function takes two arguments.
First is the starting number and second is the last number. Both should be integers.
Before using rand() function you have seed the microtime by using “srand()” function.
srand() function takes microtime() function multiplied to one million.
This is useful in showing images continuosly one after the other.
The example demonstrates the random numbers. See that everytime you refresh
the browser the numbers are different.
Ex. Random numbers
<html><head><title>random numbers</title></head>
<body>
<?php
srand(microtime() * 1000000);
$num = rand (1,100);
echo ("microtime : ".microtime()."<br>");
echo ("Random number : ".$num."<br>");
$num = rand (1,100);
echo ("another random number : ".$num);
?>
</body></html>
Reading the form values
When the submit button is pressed in the web page, all the form data of HTML is sent to
the server in variable and value pairs.
The forms “action” attribute specifies the php file which is going to handle the form.
The html “name” attributes are sent as variable names to php.
The variable names are same as name in html except for we use them putting a dollar
symbol before all the names.
Ex.using form values(form values.html)
<html><head><title>html form</title>
</head><body>
<form name="f" action="form values.php" method = "post">
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 144
<b>Please enter your first name</b><br>
<input type="test" size="45" name="username"><br>
<p><b> Please select your favourite color wine : </b><br>
<input type="radio" name = "color" value="white"> white
<input type="radio" name = "color" value="rose"> Rose
<input type ="radio" name = "color" value="red"> Red <br>
<p><b> Please enter your favourite dish :</b><br>
<input type="text" size="45" name = "dish"><br><br>
<input type="submit" value = "submit this form">
<p> <input type="reset" value="clear">
</form></body></html>
Ex.using form values(form values.php)
<html><head><title>form response</title>
</head><body>
<?php
if($_POST[username] != null)
$_POST[username]<hr>");
echo ("Thanks for your selecting
if(($_POST[color] != null) && ($_POST[dish] != null)){
$msg = "you really enjoy $_POST[dish] <br>";
$msg.= " - especially with a nice $_POST[color] wine";
echo ($msg);
}
?>
</body></html>
String manipulation
strlen(), strrev(), strtoupper(), strtolower(), ucwords() are few functions which
are used for manipulation of strings in php.
They take one string as their argument.
strlen() returns the length of the given string.
strrev() returns the reversed string of the argument.
strtoupper() returns the value of argument in upper case characters.
strtolower() returns the value of the argument in lower case characters.
ucwords() returns the string with each word of the given string capitalized.
Ex.string manipulation(HTML file)
<html><head><title>string manipulation</title>
</head><body>
<form action = "string manipulation.php" method="post">
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 145
<b> Enter some text here: </b><br/>
<textarea name ="txt" rows = "3" cols ="45"></textarea><br>
<p><input type="radio" name="fcn" value="strlen">Find the text length
<p><input type="radio" name="fcn" value="strrev">Reverse the text
<p><input type="radio" name="fcn" value="strtoupper">Change text to Uppercase
<p><input type="radio" name="fcn" value="strtolower">Change text to Lowercase
<p><input type="radio" name="fcn" value="ucwords">Change every first character
of word to uppercase
<hr>
<input type="submit" value="change">
</form>
</body></html>
Ex. String manipulation (php file)
<html><head><title>string manipulation</title>
</head><body>
<?php
echo($_REQUEST['fcn']($_REQUEST['txt']));
?>
</body></html>
Reloading a page
In php, the file will simply be reloaded if it has a form and its action is given as value
“PHP_SELF”.
This “PHP_SELF” variable has a special meaning to the PHP pharser. It simply tells the
server to reload the given page.
LOGIC: The code for html (on the client side) and the code for response (on the server
side) both are written in the same file with PHP extension. The complete file will consist
of two codes one for dynamically creating a html file for the user and the other for response as php code. A variable or a if condition is set to null in the first loading of the
file and when the user responds by changing the values of the variables. The block for
the response for the user is initiated. The same is demonstrated in the following example.
header() this function has a special meaning for the php pharser. These are generally
server directives.
syntax: header(string header, [bool replace],[int http_response_code])
For example: header(“Location: url”) will take the browser to the new location as specified by the
url in the above string, when the php pharser reads this command.
header(“Cache-Control: no-cache”) will load the page afresh everytime it is refreshed
or reloaded by the internal commands of the php file. It avoids the conventional
reload of the page from the history.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 146
Ex.reloading page
<html><head><title>switch Statement</title></head><body>
<?php
header("Cache-Control : no-cache");
global $num;
$num= $_POST['fnum'];
global $guess;
$guess= $_POST['fguess'];
function setnum(){
global $num;
srand((double)microtime() * 1000000);
$num= rand(1,20);
}
?>
<html><head><title>Number guess </title></head><body>
<?php
if($num==null){
$msg="I have thought of a number between 1 and 20";
$msg.="<h3>guess what it is ...</h3>";
}
#error message for invalid entries
if($num != null and !is_numeric($guess)){
$msg="Your guess was invalid <h3> Try Again!</h3>";
}
else if($guess == $num){
if($num != null){
$msg="CORRECT! - THE NUMBER WAS ".$num;
$msg.="<h3><a href=\"$PHP_SELF\">";
$msg.="CLICK HERE TO TRY AGAIN??</a></h3>";
}
setnum();
}
else if($guess > $num){
$msg="You guessed $guess <h3>My number is lower!</h3>";
}
else if($guess < $num){
$msg="You guessed $guess <h3>My number is higher!</h3>";
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 147
}
echo($msg);
?>
<form action="<?php $PHP_SELF ?>" method ="post">
<input type="hidden" name ="fnum" value="<?php echo($num);?>" >
Guess: <input type="text" name="fguess">
<input type="submit" value="submit">
</form></body></html>
Browser Redirection
Browser when reloaded using the “PHP_SELF” variable you can use headers to relocate
it to another page on the web or local drive.
When the location object remains “null” when the web page is loaded for the first time,
there is no change in the page but when the user selects a choice of page and clicks
submit, the browser initializes the location object in the header() function to the given
choice and the page gets redirected to the given option.
This code is demonstrated in the example below.
Examine that the exit() function is used in the header. This will come into action when
the location object is initialized.
This function will stop the browser from executed further code after this code.
Ex. Redirecting web page
<?php
if($_POST['location'] != null){
$loc = $_POST['location'];
header("Location:$loc");
exit();
}
echo($loc);
?>
<html><head><title>Redirection</title></head>
<body>
choose a site to visit:
<form action="<?php $PHP_SELF ?>" method="post">
<select name="location">
<option value="http://www.google.com.np/">Google</option>
<option value="http://www.yahoo.com/">Yahoo</option>
<option value="\\cserver\staffdata$\chandra\tests\marquedemo.html">Marque Demo on Z
drive</option>
</select>
<input type="submit" name="submit" value ="Go">
</form>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 148
</body></html>
Working with files
Displaying directory
Directories in the server can be displayed in the browser.
First the name of an existing directory is assigned to a variable.
The opendir() takes one string as its argument, that is the name of the existing directory, and returns an handle to the directory.
This reference should be stored in a variable for further use.
The readdir() and closedir() functions take one argument, that is the handle of a directory.
closedir() function closed the connection to the directory handle.
readdir() reads the files on the directory one by one.
Each time the file is read, a true is returned, else if no file is read, then it returns a
false.
Each time the file is read from the directory, the pointer stops at the next file.
So this reading is accomplished by keeping the code inside a while loop and stopped
when the readdir() returns a false when it encounters the end of the directory.
Ex. Display directory
<?php
#for windows...
$dirname = "c:\program files";
$dir = opendir($dirname);
while(($file = readdir($dir)) != false) {
if(($file !=".") and ($file !=".."))
$file_list.= "<li> $file";
}
closedir($dir);
?>
<html><head><title>Display directory</title></head>
<body>
<p>Files in <?php echo ($dirname); ?> </p>
<ol type="1" >
<?php echo ($file_list); ?>
</ul>
</body></html>
Copying and renaming files
Files in the server can be copied and renamed using php code.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 149
copy() function requires two strings viz., first string giving the name of the source
file in string format and the second argument giving the name of the destination file
in string format.
The following programe tries to copy the file and if it fails it displays a message regarding the error.
If the copy() function is successful in copying the file it returns true, else false.
Since the files follow the DOS convensions in windows, the file names are not case
sensitive.
Files are overwritten.
Ex. Copying files
<?php
$source = "welcome.php";
$dest = "C:\wamp\www\PHP\WELCOME.php";
if(copy($source, $dest)) $msg="copied $source<br> to $dest";
else $msg="Unable to copy $source";
?>
<html><head><title>copying files</title></head>
<body>
<?php echo($msg);?>
</body></html>
Renaming files
rename() function allows us to copy files.
rename() function takes two arguments, one for the original file which has to be
changed and the second argument for the file into which the original file has to be
renamed to.
Both the name s of the files should be in the format of a string.
rename() function returns a true if it succeeds or returns a false in case of failure.
Ex.renaming file
<?php
$source = "welcome.php";
$dest = "welcome to aptech.php";
if(rename($source, $dest)) $msg="renamed $source to $dest";
else $msg="Unable to rename $source";
?>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 150
<html><head><title>copying files</title></head>
<body>
<?php echo($msg);?>
</body></html>
Deleting File
unlink() function is used to delete a file from the server directory. To delete rename
and copy files you need to have the permission.
This function takes one argument in the format of a string, which is the name of the
existing file name.
unlink() function returns “true” if the given file has been deleted else returns a false.
Ex.deleting file
<?php
function try_delete($file){
if(unlink($file))
echo("$file<br/> has been deleted<hr>");
else
echo("Unable to delete $file<hr/>");
}
?>
<html><head><title>Deleting files</title></head><body>
<?Php
$fileA = "welcome to aptech.php";
$fileB = "non existing";
try_delete($fileA);
try_delete($fileB);
?>
</body></html>
Opening & closing files
By default files in php can be opened on the server’s default directory(web root).
there are different modes of opening files.
fopen() is a php function to open the files. it takes two arguments.
first argument specifies the file name and second argument specifies the mode.
if the fopen() is successful in opening a file it returns a “file pointer” else it will return
“false”.
File modes for php are “r” for read , “w” for write, “a” for append and “+” symbol
means both read and write.
Meaning of the modes for opening the files is given as below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 151
r+
w+
a+
x+
Opens the file for reading only.
Places the file pointer at the beginning of the file.
Opens the file for reading and writing.
places the file pointer at the beginning of the file.
opens the file for writing only
places the file pointer at the beginning o the file and truncates the
file to zero length.
if the file does not exist this will attempt to create it.
opens the file for reading and writing.
places the file pointer at the beginning o the file and truncates the
file to zero length.
if the file does not exist this will attempt to create it.
opens the file for writing only.
places the file pointer at the end of the file.
if the file dos not exist this will attempt to create it.
opens the file for reading and writing.
places the file pointer at the end of the file.
If the file does not exist this will attempt to create it.
Write only. Creates a new file. Returns FALSE and an error if file
already exists
Read/Write. Creates a new file. Returns FALSE and an error if file
already exists
after using the file it is important to close the file using fclose() function which takes
the file pointer as its only argument.
fclose() returns “true” if it has succeeded to close the file or returns “false”.
Check End-of-file
The feof() function checks if the "end-of-file" (EOF) has been reached.
The feof() function is useful for looping through data of unknown length.
Note: You cannot read from files opened in w, a, and x mode!
ex. f (feof($file)) echo "End of file";
Reading a File Line by Line
The fgets() function is used to read a single line from a file.
Note: After a call to this function the file pointer has moved to the next line.
Ex. reading file
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 152
<?php
$file = fopen("welcome.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
{
echo fgets($file). "<br />";
}
fclose($file);
?>
Reading a File Character by Character
he fgetc() function is used to read a single character from a file.
Note: After a call to this function the file pointer moves to the next character.
Ex. reading file
?php
$file=fopen("welcome.txt","r") or exit("Unable to open file!");
while (!feof($file))
{
echo fgetc($file);
}
fclose($file);
?>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 153
Server Side Includes (SSI)
You can insert the content of one PHP file into another PHP file before the server executes it, with the include() or require() function.
The two functions are identical in every way, except how they handle errors:
include() generates a warning, but the script will continue execution
require() generates a fatal error, and the script will stop
These two functions are used to create functions, headers, footers, or elements that will
be reused on multiple pages.
Advantages
Server side includes saves a lot of work. This means that you can create a standard header,
footer, or menu file for all your web pages. When the header needs to be updated, you can only update the include file, or when you add a new page to your site, you can simply change the
menu file (instead of updating the links on all your web pages).
PHP include() Function
The include() function takes all the content in a specified file and includes it in the current file.
If an error occurs, the include() function generates a warning, but the script will continue execution.
Ex: include demo
First make a file called menu.php with the code given below.
<a
<a
<a
<a
<a
<a
href="/home.php">Home</a>
href="/tutorials.php">Tutorials</a>
href="/references.php">References</a>
href="/examples.php">Examples</a>
href="/about.php">About Us</a>
href="/contact.php">Contact Us</a>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 154
Now include the line “<?php include("menu.php"); ?>” in all the files listed in the menu
file given above. This line should be included in all the six files containing the above line as
given below. This will produce the links at the top of every file as a menu without the need to
repeat the code.
<html>
<body>
<div class="leftmenu">
<?php include("menu.php"); ?>
</div>
<h1>Welcome to my home page.</h1>
<p>The main content of the file will go here</p>
</body>
</html>
PHP require() Function
The require() function is identical to include(), except that it handles errors differently.
If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop. The error message will
look like the one given below.
Error message:
Warning: include(wrongFile.php) [function.include]:
failed to open stream:
No such file or directory in C:\home\website\test.php on line 5
Warning: include() [function.include]:
Failed opening 'wrongFile.php' for inclusion
(include_path='.;C:\php5\pear')
in C:\home\website\test.php on line 5
Cookies
Cookies are small files stored in the user computer.
We can store upto 4000 characters in one cookie.
20 cookies are allowed for one site.
Max of 300 cookies can held by one client system.
Setcookie() is the function used to create the cookies in PHP.
This function takes six arguments but only one first argument (that is the name
of the cookie is enough to create the cookie).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 155
Arguments for setcookie():
Name : this sets the name of the cookie and is stored in an environment variable called
HTTP_COOKIE_VARS. This named variable will be accessible to subsequent
PHP page scripts.
Value: this sets the value of the named variable and is the content that you a ctualy
want to store.
Expiry: This specifies a future time, in seconds since 00;00;00 GMT on 1st Jan 1970, at
which the cookie will become inaccessible. If this argument is not explicitly
set the cookie will automatically expire when the web browser is closed.
Path : This specifies the directories for which the cookie is valid. A single forward slash
character permits the cookie to be valid for all directories on the server. If a
directory is explicitly specified then the cookie is only valid for pages within
that directory.
Domain: This can be used to specify the domain name in very large domains and must
contain at least two periods to be valid. It this argument is not explicitly specified the default value is the host name of the server that created the cookie.
All coopkies are only valid for the host and domain which crated them.
Security: This can be set to 1 to specify that the cookie should only be sent by secure
transmission using HTTPS, otherwise if set to 0 the cookie can be sent by
regular HTTP.
Ex.
Setcookie(“id”, “x12345”, time() + 86400, “/”, “”,0);
Setcookie(“id”, “x12345”, time() + 87666);
EX. Set cookie
<?php
if(($_POST[user] != null) and ($_POST[color] !=null)){
setcookie("firstname", $user, time()+259200);
setcookie("fontcolor", $color , time()+259200);
header("location:get cookie.php");
exit();
}
?>
<html><head><title>set cookie data</title></head><body>
<form action ="<?php echo($PHP_SELF); ?>" method = "post">
Please enter your first name:
<input type="text" name = "user"> <br><br>
please choose your favourite fot color : <br>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 156
<input type ="radio" name = "color" value = "#FF0000">Red
<input type ="radio" name = "color" value = "#00FF00">Green
<input type ="radio" name = "color" value = "#0000FF">Blue
<br><br>
<input type= "submit" value = "submit">
</form></body></html>
Reading cookie data
To read the cookie from the cookies which are set by the form earlier you need
to access them using the system variable $_COOKIES[ ] variable.
The name of the cookie which you have set should be given in between the parenthesis of $_COOKIES[ name ].
Ex.get cookie
<html><head><title>get cookie data</title>
<style type="text/css">
body {color:<?php echo($_COOKIES[fontcolor]); ?>}
</style>
</head>
<body>
<h1 align="center"> Hello <?php echo($_COOKIES[firstname]);?> ! </h1>
<h1 align="center"> Welcome to Cookies world </h1>
</body>
</html>
DATABASE CONNECTIVITY USING MYSQL
Connecting to MYSQL
PHP has mysql_connect() function for connecting to the database.
It has three arguments viz domain name, user name, & password.
If the connection succeeds true is returned and if it fails false is returned.
NOTE: “grant all privileges on *.* to <username>@localhost identified by
<”password”> with grant option;” is used to create a new user with grant permission.
Ex. Getting connected
<?php
$user = "john";
$con = mysql_connect("localhost", $user, "aptech");
if($con){$msg = "congratulations $user, you got connected to MYSQL"; }
?>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 157
<html><head><title>getting connected</title></head><body>
<h3> <?php echo ($msg); ?> </h3>
</body></html>
Showing Databases
“show databases” in SQL is equal to “mysql_list_dbs()” in php.
But the result received from the database cannot be accessed directly in php.
First the result is received by the php and placed in the result set which is in
the form of a table.
To know the number of rows received in result set, we have
mysql_num_rows() function which takes “result set” as its argument.
After knowing the number of rows received in the result set we can read the values one after the other row using mysql_tablename() function. Names of
both databases and tables can be read from the result set using this function.
mysql_tablename() receives two arguments (a) result set and (b) row number.
Prefix “@” symbol before this function to suppress the warning messages.
Ex. Showing databases
<?php
$user = "john";
$con = @mysql_connect("localhost", $user, "aptech") or
die("sorry - could not connect to MYSQL");
$rs = mysql_list_dbs($con);
for($row=0; $row < mysql_num_rows($rs); $row++)
$db_list.=mysql_tablename($rs, $row)."<br>";
?>
<html><head><title>showing databases</title></head><body>
<h3> <?php echo ($db_list); ?> </h3>
</body></html>
Showing tables
While in sql you have to use atleast one database before you select and list the
names of the tables. Without the use command you cannot list the tables.
In php we don’t need to give the command “use database” Once you have listed
the databases, then automatically you can list the tables of any database by using the “mysql_list_dbs()”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 158
Mysql_list_dbs() function takes the name of the database you want to use,
from which you would like to list the names of the tables.
Ex. Showing tables
<?php
$user="john";
$con = @mysql_connect("localhost","john","aptech") or
die("sorry no connection please");
$rs=mysql_list_dbs($con);
$rs1 = mysql_list_tables(cc);
for($row=0; $row < mysql_num_rows($rs1); $row++)
echo(mysql_tablename($rs1,row));
?>
Ex. Listing databases and tables
<?php
$user="john";
$con = @mysql_connect("localhost","john","aptech") or
die("sorry no connection please");
$rs1=mysql_list_dbs($con);
for ($row =0; $row < mysql_num_rows($rs1); $row++){
$this_db = mysql_tablename($rs1,$row);
$list.="<b>".$this_db."</b><br>";
if($this_db != "mysql"){
$rs2 = mysql_list_tables($this_db);
for($num=0; $num < mysql_num_rows($rs2); $num++){
$list.="-".mysql_tablename($rs2, $num)."<br>";
}
}
}
?>
<htmL><HEAD><TITLE>LISTING TABLES</TITLE></HEAD>
<BODY><?php echo($list); ?> </body></html>
Creating a database
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 159
In SQL we use ‘create database’ for creating a database while in PHP we use
mysql_create_db().
This function takes the name of the database to be created as its argument as a
string.
EXPLANATION OF BELOW EXAMPLE:
PROCESS:
The whole process is complete in three steps.
First we have to ask for the number of columns/fields which the user needs to
create.
Then we have to create the number of lines with field name, type, size etc. We
have also to provide two text boxes for the user to enter the name of the database and table to be created.
The table should be created with the given table name and database using the
mysql_query() function.
LOGIC:
The form uses the reloading technique using the $PHP_SELF variable.
Only one “if-else if- else” construct is used to load the page three times.
First “if” construct will allow the user to enter the number of fields/columns to
create.
Second “else if” construct will allow the user to enter the details of the columns/fields of the table including type and size etc.
We use only HTML till this place.
All the HTML code is generated using PHP.
The complete HTML code is formed in a string and echoed to the user.
Third “else” clause will actually select the database which it has received from
the user and then try to create the table. If successful it will display the query
string and also the message that the database is successful.
Ex.creating database
<htmL><HEAD><TITLE>creating databases</TITLE></HEAD>
<body>
<?php
if(!$_POST[fields] and !$_POST[db]){
$form = "<html><head><title>Column selections</title></head><body>";
$form.= "<form action=\"$PHP_SELF\" method=\"post\">";
$form.= "<h3>How many fields do you need to include in the new table?<hr>";
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 160
$form.="<br><input type=\"text\" name=\"fields\">";
$form.="<input type=\"submit\" value\"submit\">";
echo($form);
}
else if(!$_POST[db]){
$form="<form action =\"$PHP_SELF\" method=\"post\">";
$form.="Database: <input type=\"text\" name=\"db\"><br>";
$form.="Table Name: <input type=\"text\" name=\"table\"><br><hr>";
$form.="<h3>Select the Fields</h3><br>";
for($i=0; $i<$_POST[fields]; $i++){
$form.="Column Name:<input type=\"text\" name=\"name[$i]\">";
$form.="&nbsp &nbsp Type: <select name=\"type[$i]\">";
$form.="<option value=\"varchar\">varchar</option>";
$form.="<option value=\"int\">int</option>";
$form.="<option value=\"char\">char</option></select>";
#....include more options here if you need.
$form.="&nbsp &nbsp size:<input type=\"text\" name=\"size[$i]\"
size=\"5\"><br>";
}
$form.="<br><input type=\"submit\" value=\"submit\">";
$form.="</form>";
echo($form);
}
else{
#make the connection to mysql
$con = @mysql_connect("localhost","john","aptech")
or die("Sorry : no connection");
#select the specified database
$rs = @mysql_select_db($_POST[db], $con)
or die ("Error in Database name");
#create the query
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 161
$sql = "create table $_POST[table](";
$namearr = $_POST[name];
$typearr = $_POST[type];
$sizearr = $_POST[size];
for($i=0; $i < count($namearr); $i++){
#field name & data type
$sql.="$namearr[$i] $typearr[$i]";
#allow size specification for char and varchar types
if(($typearr[$i] =="char") or ($typearr[$i] == "varchar")){
#if a size has been specified add it to the query
if($sizearr[$i] != ""){
$sql.="($sizearr[$i])";
}
}
#if this is not the final field add a comma
if(($i+1) != count($namearr)){
$sql.=",";
}
}
$sql.=")";
# display the SQL query
echo ("SQL COMMAND:$sql <hr>");
#execute the query - attempt to create the table
$result = mysql_query($sql, $con) or die ("err:query");
#confirm if successful
if($result) echo ("Result : table \"$_POST[table]\" has been created. ");
}
?>
</body></html>
Inserting table data
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 162
Adding records to the database takes the same procedure as the earlier example. It
takes the database name and table. To select the table use mysql_select() function, then an SQL query containing the record data is supplied as the argument to
the mysql_query() function.
the SQL query string would be “insert into <table name>” followed by the field
names and list of values.
All the values which are of type string should be enclosed within a pair of quotes.
Ex. Using the above database creating example first create a table as given below:Name of table : St (student)
Column
sid
sname
m1
m2
Type
Int
varchar(25)
Int
Int
Ex.Inserting records
<html><head><title>Inserting records</title></head>
<body>
<form action="<?php echo($PHP_SELF); ?>" method="post">
Student ID :<input type="text" name="sid" size="5"><br>
Student Name:<input type="text" name="sname" size="25"><br>
Maths: <input type="text" name="m1" size="5"><br>
Science: <input type="text" name="m2" size="5"><br>
<input type="submit" value="submit">
</form>
<?php
#ensure all fields have entries
if($_POST[sid] and $_POST[sname] and $_POST[m1] and
$_POST[m2]){
$con = @mysql_connect("localhost","john","aptech") or
die("sorry no connection please");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 163
#select the specified database
$rs=mysql_select_db("student",$con) or die("sorry database not
available");
#Create the query
$sql="insert into st (sid, sname, m1, m2) values
($_POST[sid],\"$_POST[sname]\", $_POST[m1], $_POST[m2])";
#execute the query
$rs = mysql_query($sql, $con);
#confirm the added record details
if($rs){echo("Record added:$_POST[sid], $_POST[sname], $_POST[m1],
$_POST[m2]");}
}
?>
</body></html>
Altering the table structure
The altering process does not need any additional functions.
Get connected using the mysql_connect().
Select the specified database using mysql_select_db().
Execute the query using mysql_query().
Use the sql query syntax as you use at command prompt of MYSQL.
Ex.Altering table
<html><head><title>Inserting records</title></head>
<body>
<?php
#Get connected first
$con = @mysql_connect("localhost","john","aptech") or
die("sorry no connection please");
#select the specified database
$rs=mysql_select_db("student",$con) or die("sorry database not
available");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 164
#Create the query to modify sid as not null
$sql="alter table st modify sid int not null";
#execute the query
$rs = mysql_query($sql, $con) or die("error in query:$sql");
#confirm the modified details.
if($rs) {
echo("Field \"sid\" has been modified to not null");
}
?>
</body></html>
Retrieving data records from tables
Get connected using the mysql_connect().
Select the specified database using mysql_select_db().
Execute the query using mysql_query().
While reading the data from the result set we can use mysql_fetch_array().
This array takes one parameter “result set” and returns a single row/record of
information from the table.
Each field is read from the table using the variable name as an array with field
names as its index as demonstrated below.
The result from mysql_fetch_array is assigned to $row variable.
Then the field is extracted one by one using $row[field name].
For better presentation a table has been used.
Ex.Retriving data
<html><head><title>Inserting records</title></head>
<body>
<?php
#Get connected first
$con = @mysql_connect("localhost","john","aptech") or
die("sorry no connection please");
#select the specified database
$rs=mysql_select_db("student",$con) or die("sorry database not
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 165
available");
#Create the query to select from table st
$sql="select * from st";
#execute the query
$rs = mysql_query($sql, $con) or die("error in query:$sql");
#write the data
echo("<table border=\"2\" width=\"50%\">");
while($row=mysql_fetch_array($rs)){
echo("<tr><td><b>SID </b></td><td>".$row['sid']."</td>");
echo("<td><b>SName </b></td><td>".$row['sname']."</td>");
echo("<td><b>M1 </b></td><td>".$row['m1']."</td>");
echo("<td><b>M2 </b></td><td>".$row['m2']."</td>");
echo("</tr>");
}
?>
</body></html>
E-Mail And Internet (1 Day)
Introduction Internet, E-mail, Protocol
Internet: The internet is a “network of networks”. It is a global collection of high powered
computers that are connected to each other with network cables telephone lines, microwave dishes, satellites etc.
Server: Computer storing documents, sound files, video clips, program files, electronic
shopping centres, animations, pictures, interactive contents and other information and
presenting them electronically to others on net are known as servers.
Gateway: A Gateway is a communication device or program that pases data between networks having similar funtions but dissimilar implemetations.
Ineternet Service Providers(ISP): ISP is a interenet service provider on periodical charges
and/or installation charges. Serial Line Input Protocol(SLIP) or Point to Point Protocol
(PPP) is used for connecting internet. This allows the users to surf without any intervention of the ISP servers. TCP/IP connection internet must have PPP and SLIP protocols.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 166
Modem: (Modular/Demodular) Modem is a device to translate the digital signals to analog
and vice versa. (Integrated Services Digital Network) ISDN is a digital telephone network
which provides fastest internet for the users.
How Internet Works : Once you send the mail. The user and the Recipient may be on different networks, its like calling a local telephone number and asking for the area code.
The exact IP Address may be away from the User. There may be many networks which
the user mail has to cross to reach the recipient. The email is broken into many pieces
and sent in many packets, routers will redirect the packets to the destination. The mails
while passing through networks are stored in different places with a table of contents &
addresses, and sent at their leisure.
WWW: Berner Lee is known as father of Word Wide Web. It’s a consortium.
Search Engines: Search engines provide the information based on certain keyword/keyword
combination. Ex : Google.com, infoseek.com, altavista.digital.com, cyber411.com.
Helper Application: Helper applications are small programs which take little space in the
memory of your computer to play certain files, audio, video, etc on your system. They
will be downloaded by the browser automatically and play the file on your system. Ex:
Quick Time, Real Player etc.
Types of Emails :
(a) Web Based Free E-Mail These mails are free on the net, but you have to bear with the advertisements they pose. Ex. Google, yahoo, hotmail etc.
(b) Internet – Based Forwarding Services NetForward.com is an example, which will allow you give
all your emails of different free-email services and get one email and address from them so that
you can attend to all the emails with one ID and Password.
(c) E-mail Service Providers They are superior in quality of service and solutions. ESPs use X.25 or
X400 protocol for email. Return confirmation, prioritization of mails are few advantages of this
system. Charges are made as per the volumes of mails.
(d) Email through Internet Service Provider: This is known as Gateway Internet Service, generally
based on Unix and text based mails.
Protocol: A protocol is a set of rules to be followed while communicating with other computers. The protocol mentions the style of bits on net for lower levels (the bit sequence
for reading information) and exchange for high level application programs (the way two
programs send a file on net).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 167
TCP/IP(Transmission Control Protocol/Internet Protocol) is a collection of protocols. It uses
five layers of the ISO/OSI model (International Standard Organization’s Open System Interconnect). ISO/OSI model defines (1) Application (2)Presentation (3)Session (4) Transport (5) Network (6) Data Link (7) Physical layers.
HTTP (Hyper Text Transmission Protocol) is web Native Protocol.
SLIP(Serial Line Internet Protocol) and PPP(Point to Point Protocol) are used by ISPs to connect their users on their servers.
POP (Post Office Protocol) & SMTP(Simple Mail Transport Protocol) are two protocols used
for mail services.
FTP (File Transfer Protocol) is a protocol used for transferring files on net. To transfer files
using FTP, one needs a client program and a server program. FTP server is a program on
a computer which will assist the files to be downloaded to client computer. Its like an
online library. Windows provides a program for FTP called ftp.exe. Type ftp in the run
command from start button. WSFTP is also a program which allows to upload files to a
server.
Protocols for EMail: There are two mail protocols POP(Post Office Protocol) and
SMTP(Simple Mail Transfer Protocol). All the ISPs have POP and SMTP servers for maintaining emails.
WWW consortium is a combination of private industries and universities that work together
to guide technical development of the Web and set the web standards. RFC(Request
For Comments) is one way how you can get information about internet. Each RFC has a
number to address.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 168
HTML(Duration 10 Days)
Hyper Text Markup Language
Domain Names and IP Addressing
Addressing computers on net is done in two ways (a) Domain names and (b) IP Addresses.
Domain Names (for human understanding)
Domain names follow a format called the Domain Name System(DNS). Domain names describe organizational or geographic realities. They indicate which country the domain is
and which organization owns it.
Ex1: .com – commercial, .edu – Education, .gov – government, .mil – military networks.
Ex2: .in – India, .de – Germany, .np – Nepal, .nz – New Zealand.
IP Address (for Machine understanding)
An IP Address is a set of four numbers separated by a dot(32 bits). Ex: “202.54.15.175”. It
contains two parts (a) network address (b) Node address. There are three classes of
networks and also IP Address reserved for special purposes. Ex 1.1.1.1 means “All Networks”, 0.0.0.0 means “This Network” and 127 is reserved for loop back tests.
Class
A
B
C
Decimal range
of network
Address
1-127
128-191
192-223
Significance
Netwk.Node.Node.Node
Netwk.Netwk.Node.Node
Netwk.Netwk.Netwk.Node
DNS Server: Domain Name Service (DNS) servers translates the domain name of another
computer into an IP(Internet Protocol) address and vice versa on request. A format
called Domain Name System is followed by all computers on net.
Server : Server is the computer which provides the information. It has server side scripts for
handling the requests of the client and sending the data required. It has a IP Address
and Domain Name.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 169
Client: Client is the user of the information which is provided by the server. It can ask information and collect the data and display.
Browser : A Browser is a software programme which connects other systems on the world
wide web. It automatically connects other systems, maintains connections, maintains
memory cache, and displays the data in a formatted style that a user can understand.
Ex: Internet Explorer, Netscape Navigator, Mozilla FireFox etc.
Java Plug-In A java plug-in is incorporated in almost all the latest browsers. This is an additional software for the browsers for extending the facilities of programming to User and
Server.
For ex
URL: Uniform Resource Locator is the address of any file.
“HTTP://WWW.Google.com” contains two parts (a) HTTP which is the protocol which
has to be used along with this site. (b) “Google.com” which gives the domain.
Ex: “http//www.w3.org/TR/REC-html40/” means There is a document available via the HTTP
protocol, residing on the machine www.w3.org, accessible via the path “/TR/REChtml40/”.
(a) Fragment Identifiers : This kind of URI which denotes a link within the current page ends with
“#”
followed
by
an
anchor
identified
(fragment
identifier).
Ex
:
“http/mywebsite.com/html/top.html#section_2” indicates that “section_2” is an anchor in
top.html page.
(b) Relative URI’s: Denotes a path which is in relation to the current directory. One level up/down
to the current directory. Relative path is resolved to full URI’s using the base URI. Base URI is
the path of the current directory.
How to create HTML pages.
Start notepad from the start – programs – accessories. Enter the HTML code in the file and
save it with “ .html” file extension. Open the browser(Internet Explorer/Opera) and
open the file from the browser from the place where you have stored. And see the output of your file. Use “Alt +Tab” to toggle between the notepad and browser.
•
•
•
•
•
•
What is HTML?
HTML is a language for describing web pages.
HTML stands for Hyper Text Markup Language
HTML is not a programming language, it is a markup language
A markup language is a set of markup tags
HTML uses markup tags to describe web pages
The browser will remove extra spaces and extra lines when the page is displayed.
HTML is not case sensitive. No difference between “TEXT” and “text”.
HTML Structure :
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 170
<HTML>
<HEAD>
</HEAD>
<BODY>
YOUR CODE HERE
</BODY>
</HTML>
•
•
•
•
HTML Tags
HTML markup tags are usually called HTML tags
HTML tags are keywords surrounded by angle brackets like <html>
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is the end tag
Start and end tags are also called opening tags and closing tags.
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
</html>
Container Tags
Container tags are those having text or tag elements in the middle and start with a tag and
end with another tag. Ex.
Start tag *
Element content
<p>
This is a paragraph
End tag *
</p>
<a href="default.htm"
This is a link
</a>
>
* The start tag is often called the opening tag. The end tag is often called the closing tag.
Nested HTML Elements
<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>
Empty Tags
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 171
HTML elements without content are called empty elements. Empty elements can be closed
in the start tag. <br> is an empty element without a closing tag (it defines a line break).
In XHTML, XML, and future versions of HTML, all elements must be closed so use <br />
instead is more future proof.
Attributes provide additional information about HTML elements. Attributes are always
specified in the start tag Attributes come in name/value pairs like: name="value"
Ex: <a href="http://www.w3schools.com">This is a link</a>
Attribute values should always be enclosed in quotes. Double/Single style quotes allowed.
Below is a list of some attributes that are standard for most HTML elements:
Basic HTML tags
All the files should include at least these tags.
(a) HTML : <HTML> and </HTML> tags defines that complete html file. All the tags are inside these
two tags.
(b) Head : <HEAD> and </HEAD> contains information about your HTML file. Usually the only tag
contained within this tag is “title” tag.
Keywords for Search Engines
Some search engines on the WWW will use the name and content attributes of the meta tag
to index your pages.
This meta element defines a description of your page:
<meta name="description" content=" Complete Overview to HTML & CSS Tags">
This meta element defines keywords for your page:
<meta name="keywords" content="HTML, DHTML, CSS, XML, XHTML, JavaScript, VBScript">
(c)Title : <TITLE> and </TITLE> is within the Head tag. It identifies your page to the rest of the world.
The tag output is displayed on your browser’s title bar but dos not appear as part of the page. If
you don’t mention the title “untitled” or url is displayed.
(d) Body : contains all the elements that a browser actually displays as the body of your HTML document.
HTML Headings
There are six levels of Heading tags viz, <H1>, <H2>, <H3>, <H4>, <H5>, and <H6>. H1 tag
contains the biggest size of characters and H6 contains the lowest size of characters.
Ex: 1.
<HTML>
<HEAD>
<TITLE>
MY FIRST WEB PAGE
</TITLE>
<HEAD>
<BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 172
<H1>This is a top-level heading </H1>
<H2> This is a second level heading </H2>
<H3>This is a third level heading </H3>
<H4> This is a fourth level heading</H4>
<H5> This is a fifth level heading</H5>
<H6> This is a sixth level heading</H6>
</BODY>
</HTML>
HTML Paragraphs
<P> tag specifies the beginning of a paragraph. When you define a new P tag it
automatically implies that it’s the beginning of a new paragraph. So you can use
only the starting P tag.
Line Break Tag:
The BR (Line Break) tag is an empty, or stand-alone tag that simply inserts an line
break.
Ex:
<HTML><BODY>
This line will <br/> be displayed in <br/> three lines</br>
</BODY></HTML>
Comments in HTML
<!-- and --> are the tags used for commenting out in the HTML file.
Ex: <!-- type your comments here -->
Ex : 2 simple HTML file
<HTML>
<HEAD>
<TITLE>
MY FIRST HTML
</TITLE>
<HEAD>
<BODY>
<H1>Hyper Text Markup Language</H1>
<P>
In this unit you are going to learn some basics of HTML, which is used to write HTML documents. Once you create an HTML document it can be viewed in any browser.
<P>
You will be learning how to use List and Hyperlink text effectively in your document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 173
</BODY>
</HTML>
FORMATTING TEXT
Bold : <B> and </B> is used to bold the text between the start and end tags.
Italic : <I> and </I> is used to italicize the text between the start and end tags.
Underline : <U> and </U> is used to underline the text between the start and end
tags.
Justification with 5 spaces Lt and Rt:
<BLOCKQUOTE> </BLOCKQUOTE> tags are used to double-indent on Lt and Rt
margins.
Ex: 3 Formating
<HTML>
<HEAD>
<TITLE>
MY Formatting tags
</TITLE>
<HEAD>
<BODY>
<H1><B>This line is in bold</B></H1>
<BR/><BR/>
<H2><I> This line is in italics</I><H2>
<H3><BLOCKQUOTE> This text is in “blockquote” tags and is displayed with an indent on left
margin of five spaces and right margin with five spaces. The text will be justified in the
middle. Any type of formatting is possible with PRE tag. This tag displays the contents
as you enter in the document. It is known as pre-defined text style. This is useful when
entering columnar data. </BLOCKQUOTE>.
</H3>
</BODY>
</HTML>
Character Entities
“<” symbol defines the start of an HTML tag but if we want the symbol be inserted then character entities in the HTML source are used.
A character entity has three parts: an ampersand (&), an entity name or a # and an entity
number, and finally a semicolon (;). Entity number are more reliable than entity names.
Note that the entities are case sensitive.
To display a less than sign in an HTML document we must write: &lt; or &#60;
The Most Common Character Entities:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 174
Result
Entity Number
&#160;
<
>
&
"
&#60;
&#62;
&#38;
&#34;
‘
Description
Entity Name
non&nbsp;
breaking
space
less than
&lt;
greater than
&gt;
ampersand
&amp;
quotation&quot;
mark
apostraphe
&apos; (does not work in)
&#39;
Some Other Commonly Used Character Entities:
Result
Description
¢
cent
£
pound
¥
yen
§
section
©
copyright
®
registered trademark
×
multiplication
÷
division
Entity Name
&cent;
&pound;
&yen;
&sect;
&copy;
&reg;
&times;
&divide;
Entity Number
&#162;
&#163;
&#165;
&#167;
&#169;
&#174;
&#215;
&#247;
Text highlighting tags
<SUP></SUP> tags makes the text between them as superscript.
<SUB></SUB> tags makes the text between them as subscript.
<STRIKE></STRIKE> tags makes the text between them to appear as strike out.
EX.12 FORMATTING DEMO
<HTML>
<HEAD>
<TITLE> DEMO OF TEXT FORMATTING</TITLE>
<HEAD>
<BODY>
<P><H2>THIS IS DEMONSTRATION OF TEXT FORMATTING.</H2>
<HR NOSHADE>
<P>THE TEXT APPEARS NORMAL BUT
<P>MATHEMETICAL EXPRESSIONS LIKE 245<SUP>21</SUP>
<p>ORDINALS LIKE 21<SUP>st</SUP> AND
<P>CHEMICAL COMPOSITIONS LIKE H2 SO<SUB>4</SUB><BR/>
ARE EXPRESSED COMFORTABLY WITH THIS FORMATTING TAGS.
</BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 175
</HTML>
Text Alignment
The “ALIGN” attribute can be used with headings to align the text within the window. The attribute has values as LEFT/RIGHT/CENTER/JUSTIFY.
<P> tag also can contain “ALIGN” attribute with LEFT/RIGHT/CENTER values.
<CENTER></CENTER> tags can be used with any combination of text, images,
tables etc to center the whole contents.
Ex.13 Text Alignment demo
<HTML>
<HEAD>
<TITLE> DEMO OF TEXT ALIGNMENT</TITLE>
<HEAD>
<BODY>
<P><CENTER>
(create some random text and place it here)
</CENTER>
<CENTER><IMG SRC=FLOWERS.JPG></CENTER>
See image, which is also centered to the window.
</BODY>
</HTML>
Setting Font Sizes
The <FONT></FONT> tags are used along with SIZE attribute to change the size of the
font of a section.
SIZE attribute has values range from 1 to 7.
Default size is 3.
<BASEFONT> tag with SIZE attribute sets the default size. Ex.<BASEFONT SIZE=4>
Ex.14 Font size demo
<HTML>
<HEAD>
<TITLE> Font size DEMO</TITLE>
<HEAD>
<BODY>
<FONT SIZE=1>Font Size 1 </FONT><BR/>
<FONT SIZE=2>Font Size 2 </FONT><BR/>
<FONT SIZE=3>Font Size 3 </FONT><BR/>
<FONT SIZE=4>Font Size 4 </FONT><BR/>
<FONT SIZE=5>Font Size 5 </FONT><BR/>
<FONT SIZE=6>Font Size 6 </FONT><BR/>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 176
<FONT SIZE=7>Font Size 7 </FONT><BR/>
<HR SIZE=9 NOSHADE>
<CENTER>THIS IS THE DEFAULT SIZE OF FONT, THAT IS 3.
<P><BASEFONT SIZE=5>
AFTER USING "BASEFONT SIZE=5", THIS IS THE TEXT IN 5. <BR/> <BR/>
<FONT SIZE=-2>AFTER USING "FONT=-2", THIS IS THE TEXT IN 3.
<BR/><BR/></FONT>
<FONT SIZE =+1>AFTER USING "FONT =+1", THIS IS THE TEXT IN 6</FONT>
<HR SIZE=9 NOSHADE>
<H3 ALIGN=CENTER><u>USING THE BIG AND SMALL TAGS</U></H3>
<BASEFONT SIZE=3>
<SMALL>THIS TEXT IS BETWEEN THE SMALL TAGS DECREASING BASEFONT FROM 3 TO
2, RELATIVELY.</SMALL>
<P><BIG>THIS TEXT IS BETWEEN THE BIG TAGS INCREASING BASEFONT FROM 3 TO 4,
RELATIVELY</BIG>
</CENTER>
</BODY>
</HTML>
Changing font color
The <FONT> tag is used to display the color with “COLOR” attribute. Any of the 16
colors can be used as value to the COLOR attribute. Basic colors are (1)Black,
(2)White, (3)Aqua, (4)Blue, (5)Fuchsia, (6)Gray, (7)Green (8)Lime, (9)Maroon
(10)Navy (11)Olive (12)Purple (13)Red (14)Silver (15)Teal and (16)Yellow.
We can address colors in three ways.
: Hexadecimal Representation
(a) <body bgcolor="#FFFF00">
(b) <body bgcolor="rgb(255,255,0)"> : RGB (Red Green Blue)
(c) <body bgcolor="yellow">
: Basic text representation of color
Ex.
<FONT SIZE=7>
<FONT COLOR=”AQUA”>
You can use any of the 16 color names to specify a font color.
</FONT>
EX.15 DEMO OF COLORS
<HTML>
<HEAD>
<TITLE> DEMO FOR COLORS</TITLE>
<HEAD>
<BODY>
<CENTER>
<FONT SIZE=1 COLOR=BLACK>Font Size 1 </FONT><BR/>
<FONT SIZE=2 COLOR=YELLOW>Font Size 2 </FONT><BR/>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 177
<FONT SIZE=3
<FONT SIZE=4
<FONT SIZE=5
<FONT SIZE=6
<FONT SIZE=7
<FONT SIZE=6
<FONT SIZE=5
<FONT SIZE=4
<FONT SIZE=3
<FONT SIZE=2
<FONT SIZE=1
</CENTER>
</BODY>
</HTML>
COLOR=BLUE>Font Size 3 </FONT><BR/>
COLOR=FUCHSIA>Font Size 4 </FONT><BR/>
COLOR=GRAY>Font Size 5 </FONT><BR/>
COLOR=GREEN>Font Size 6 </FONT><BR/>
COLOR=LIME>Font Size 7 </FONT><BR/>
COLOR=MAROON>Font Size 6 </FONT><BR/>
COLOR=NAVY>Font Size 5 </FONT><BR/>
COLOR=OLIVE>Font Size 4 </FONT><BR/>
COLOR=PURPLE>Font Size 3 </FONT><BR/>
COLOR=RED>Font Size 2 </FONT><BR/>
COLOR=TEAL>Font Size 1 </FONT><BR/>
Changing Font Face
FACE attribute of the <FONT> tag assigns the font style. The fonts should be available in the system before it can be used.
Ex. Font Face
<html><head><title>Font face demo</title>
<body>
<p>
<font face=arial size=14 color=#00ff00> This is Arial font with size 14 and green in color</font>
<p>
<font face=impact size=16 color=#ff0000> This is Impact font with size 16 and red in color</font>
<p>
<font face="arial black" size=12 color=#0000ff> This is Arial Black font with size 12 and
Blue in color</font>
</body>
</html>
Style tag for deprecated tags of font, underline, strike
Style is an attribute inside paragraph and heading tags. It carries different properties to put forth the font, style, size, etc. It carries variable and value pairs separated by a colon(:). The pairs of Variable and values are separated with a semicolon follows(;).
Ex.<P style=”font-family:arial; font-size:14; text-decoration:underline;”>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 178
Preformatted text: The <PRE> and </PRE> tags are used to display a block of
“preformatted” text. The display will be “as is” state of text.
Ex : 4 Preformatting Tag
<HTML>
<HEAD>
<TITLE>
Pre-formatting tags in html
</TITLE>
<HEAD>
<BODY>
<PRE>
SALES FIGURES FOR FIRST QUARTER OF 2008
---------------------------------------------------------------------------------------------------------------------------------JAN
FEB
------------------------------------------------------------------------ANDERSON
10,200
20,015
BAKER
30,500
25,885
PETERSON
15,900
20,115
WILSON
40,100
35,000
-----------------------------------------------------------------------GRAND TOTAL
96,700
101,015
-----------------------------------------------------------------------</PRE>
</BODY>
</HTML>
Creating Lists
Ordered List
<OL> and </OL> tags specify a sequentially numbered list of items. It is used in
conjunction with <LI> tag. LI tag does not have end tag, its implied.
Attributes:
TYPE : specifies the type of format ex.A, a, L i, 1.
START : sepifies the start no eg 2, c, etc.
Ex: 5 Ordered Lists
<HTML>
<HEAD>
<TITLE>My test on Ordered List tag</TITLE>
</HEAD>
<BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 179
<OL>
<LI>COMPUTER CONCEPTS
<LI>MS-ACCESS
<LI>MS-EXCEL
<LI>MS-WORD
<LI>MS-POWERPOINT
</OL>
</BODY>
</HTML>
Unordered List
<UL> and </UL> define a bulleted list of items. The <LI> tag is nested inside the
UL tag and defines each item within the list.
Attributes
TYPE : specifies the style of bullets like “disc”, “circle”, and “square”. These are
supported by Netscape Navigator.
Ex. 6 Unordered List
<HTML>
<HEAD>
<TITLE>My test on Ordered List tag</TITLE>
</HEAD>
<BODY>
<H3>
<UL TYPE = disc>
<LI>COMPUTER SOFTWARE
<br/>
<H5>(THIS IS ORDERED LIST NESTED INSIDE UNORDERED LIST)</H5>
<OL>
<LI>MS-ACCESS
<LI>MS-EXCEL
<LI>MS-WORD
<LI>MS-POWERPOINT
</OL>
<BR/>
<LI>COMPUTER HARDWARE
<UL TYPE = circle>
<LI>CPU
<LI>KEYBOARD
<LI>VISUAL DISPLAY UNIT
<LI>HARD DISK
</UL>
</UL>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 180
<BR/><BR/>
<H2><U>CONTROLLING STARTING ITEM OF A LIST </U></H2>
<OL START=5>
<LI>THIS IS FIFTH ITEM
<LI>THIS IS SIXTH ITEM
<LI>THIS IS SEVENTH ITEM
<LI>THIS IS EIGHTH ITEM
<LI>THIS IS NINTH ITEM
<LI>THIS IS THE LAST ITEM
</OL>
</H3>
</BODY>
</HTML>
Creating Definition Lists
<DL> and </DL> defines a definition list. <DT> tag is used to define the terms of
the list and <DD> tag is used for defining data of the list. This is like having a
heading and some text content under the heading, but in a listing fashion.
Ex. 7 Definition Lists
<HTML>
<HEAD>
<TITLE> DEFINITION LISTS TEST</TITLE>
</HEAD>
<BODY>
<h3>
<DL>
<DT>HARDWARE
<DD>Is defined as physical or tangible equipments associated with computer systems.
Examples of hardware are central processing Unit, input devices, output devices, and
secondary storage devices.<br/><br>
<DT>SOFTWARE
<DD>is a set of programs run on a computer.<br/><br/>
<DT>PERIPHERALS
<DD> Equipment connected around the CPU are known as peripherals.
</h3>
</BODY>
<HTML>
CREATING HYPERTEXT LINKS
With Hyperlinks you can link to other sources like web page, display an image,
download a program, send an e-mail message etc.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 181
Anchor tag(<A> & </A>) is used for hyper linking. The Target is mentioned in the
start tag and the text is written between the anchors.
Ex. <A HREF = “SUB.HTML”>Go to Sub document</A>
HREF (Hyper Reference) attribute specifies the URL. If partial URL or only file name
is mentioned, it means that the file is located on the same server. Otherwise
complete URL is a must. There are three types of links in HTML.
(a) Links to other HTML documents or data objects.
This type of link allows jumps to other web page and as well as anything that has an
address on the net, like FTP archives and images also. This type of link has only
“target file” or object which is given with a “HREF” attribute.
Ex: <p>Click here to jump to <A HREF = “SUB.HTML”> subdocument </A>
(b) Links to other places in the same HTML document.
Allows you to jump from one section to another section of the same page/document.
This links have two parts the source link and the target link.
Ex.
Source Link : <A HREF=”#sec1”>Go to section 1</A>
HREF attribute is referring to another anchor whose name would appear as “sec1”.
“Go to section 1” text will be the highlighted text.
Target Link : <A NAME=”sec1”>This is the contents of the section one which would
appear for the user after the jump</A>
“#” means a link to a section within a document/other page.
Target link should contain the “NAME” attribute for the source to recognize the target anchor. The complete text is embedded in the “<A> & </A>” tags.
(c) Links to places in other HTML documents.
Allows links to jump to some point halfway down another web page.
Contains “link” and “target link”, with only difference of web page being other file,
which is provided with a URL.
Ex. <A HREF=”C:\MYDIR\APTECH.HTML#Sec3”>Goto Sec3 of APTECH</A>
“C:\MYDIR\APTECH.HTML” is the file and “Sec3” is the part of the file which the link is going
to jump.
Target attribute
Define where the linked document will be opened.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 182
? _blank
: - the target URL will
? _self
: - the target URL will
Frame will be
discussed later.
? _parent : - the target URL will
? _top
: - the target URL will
open in a new window
open in the same frame as it was clicked.
open in the parent frameset
open in the full body of the window
EX: 8 Creating simple link list.
Create three HTML files by name Linktype1.html, Linktype2.html, and mainlink.html
in the same directory and third file with the list of links.
Contents of linktype1.HTML:
<HTML>
<HEAD>
<TITLE>LINK FILE ONE </TITLE>
</HEAD>
<BODY>
<H2>Here are the contents of file one</H2>
<P>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
</BODY>
</HTML>
Contents of linktype2.HTML:
<HTML>
<HEAD>
<TITLE>LINK FILE TWO </TITLE>
</HEAD>
<BODY>
<H2>Here are the contents of file Two with sub section</H2>
<P>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
<P><A NAME=sec1><h2>Section 1 of File two</h2>
(contents of last paragraph come here)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 183
</A>
</BODY>
</HTML>
Contents of mainlink.HTML:
<HTML>
<HEAD>
<TITLE>LINK LIST </TITLE>
</HEAD>
<BODY>
<H2>COURSES</H2>
<UL>
<LI><A HREF=linktype1.html>Normal Link to another HTML file</A>
<LI><A HREF=#bottom>Link to another Section in same page</A>
<LI><A HREF="linktype2.html#sec1" TARGET=”_blank”>Section-wise Link to another
HTML File</A>
<BR/>
<BR/>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
<A NAME=bottom><h2>Bottom</h2><P>
(contents of last paragraph come here)
</A>
</UL>
</BODY>
</HTML>
Inserting Inline Images
<IMG> is an empty tag allowing to insert image in a document.
<IMG> Attributes
SRC
BORDER
WIDTH
HEIGHT
TARGET
specifies URL for the image.
specifies the width of the border. Zero means no border.
specifies the width of the image. If width is not realistic it will
be fit to scale.
Specifies height of image. If no is realistic it will be fit to scale.
Specifies the window in which it will be loaded. Takes followPrepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 184
(a)
(b)
(c)
(d)
ing values:“_blank” Loads into a new window.
“_parent” loads into immediate parent of the document.
“_self” loads into the same windows : DEFAULT.
“_top” loads into full body of the current window.
Ex.<IMG SRC = FLOWERS.JPG ALT=a sample image>
Resizing images
HEIGHT and WIDTH attributes leave space for the image and go ahead with rest of
loading.
Values can be in pixels or percentage.
Ex. <IMG SRC=”BLUE HILLS.JPG” WIDTH=75%>
Ex. <IMG SRC=”BLUE HILLS.JPG” WIDTH=250 HEIGHT=200>
Controlling Border around an image link
BORDER attribute allows to define the border weight.
Ex. <IMG SRC=”FLOWERS.JPG” BORDER=14>
Ex. 9 Inline Image Settings
<HTML>
<HEAD>
<TITLE> Setting images </TITLE>
</HEAD>
<BODY>
<H2><U>
This is an image set to sizes 400 x 350 and aligned to the right side of the window
</U></H2>
<IMG SRC="blue hills.jpg" WIDTH=400 HEIGHT=350 ALIGN=RIGHT BORDER=12 ALT="A
simple image">
<h3><p>The image border is set to 12 pixels.
<p>All the images and documents should be placed in the same Directory. Try deleting the
image from the current directory and see the alternate message being displayed without
any changes in the border and dimensions of the image.
</h3>
</BODY>
<HTML>
Creating Image Links
Just place the <IMG> tag in the place where text appears
Ex. <A HREF=”Myfile”>Click here<IMG SRC=”flowers.jpg”></A>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 185
“click here” and also the image will be made as hyperlinks.
Ex.10 Image as a link
<HTML>
<HEAD>
<TITLE> Image as Hyperlink</TITLE>
</HEAD>
<BODY>
<H2><U>
This is an image which can be used as hyperlink to connect to linktype1.html file
<P>You can use both text and also image as a hyperlink.
</U></H2>
<P>
<A HREF=LINKTYPE1.HTML>CLICK HERE <IMG SRC="BLUE HILLS.JPG" WIDTH=400 HEIGHT=350
ALIGN=RIGHT border=12 ALT="A simple image">
</BODY>
<HTML>
Horizontal Rules (Lines)
Inserts horizontal line.
HR Attributes
SIZE
COLOR
WIDTH
ALIGN
NOSHADE
Gives thickness for the line
Mentions color for the line
Gives length of the line as %
Specifies alignment – RIGHT/LEFT/CENTER
Without shade a solid line
Ex. <HR SIZE=10 WIDTH=75% NOSHADE>
Ex. <HR SIZE=10 WIDTH=400>
Ex. 11 Horizontal Rulers
<HTML>
<HEAD>
<TITLE> Horizontal Rulers</TITLE>
</HEAD>
<BODY>
<H2><u>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 186
THIS IS DEMONSTRATION OF HORIZONTAL RULERS.
</H2><P> YOU CAN SEE THE DEFAULT LINE BELOW THIS TEXT
<HR NOSHADE>
<P> RESIZE THE WINDOW TO SEE THE SIZE OF RULERS CHANGE IN CONTEXT WITH THE
WINDOW<P>
</U></H2>
<P>
<HR SIZE=24 NOSHADE WIDTH=43% ALIGN=LEFT>
<P>
<A HREF=linktype1.html><IMG SRC="blue hills.Jpg" width=400 height=350 border=12 alt="A
simple image">
<HR SIZE=24 NOSHADE WIDTH=43% ALIGN=LEFT>
</BODY>
<HTML>
ADDRESS TAG
The address tag contains information on contact details. Horizontal ruler usually seperates an address from the rest of the web page.
Ex. 12 ADDRESS DEMO
<HTML>
<HEAD>
<TITLE> DEMO OF ADDRESS TAG</TITLE>
<HEAD>
<BODY>
<P>THIS IS DEMONSTRATION OF ADDRESS TAG.
<P><P>CLICK ON THE HYPERLINK IN ADDRESS BELOW HORIZONTAL RULER.
<P>DEFAULT EMAIL IS OUTLOOK.
<P>YOU NEED TO HAVE CONFIGURED OUTLOOK ACCORDINGLY
<P>THE “FROM ADDRESS” IN THE MAIL IS ALREADY FILLED WITH DETAILS.
<HR NOSHADE>
<ADDRESS>
APTECH,<br/> Siddhi Bhavan,<br/> Kanthipath,<br/>Kathmandu
<A HREF=MAILTO:[email protected]>E-mail</A><BR>
</ADDRESS>
</BODY>
</HTML>
WORKING WITH BACKGROUNDS
Background of the document can be manipulated with the <BODY> tag of the html
file.
“BGCOLOR” attribute will change the background color of the document.
“TEXT” attribute will change the text color for the whole of the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 187
“LINK” attribut e will change the color of the hyperlinks.
“VLINK” attribute will change color of already visited links.
“ALINK” attribute will change color of Active links.(when mouse is on the link).
Ex. <BODY BGCOLOR=CYAN TEXT=RED LINK=BLUE VLINK=GREY ALINK=GREEN>
Setting Background with a image.
“BACKGROUND” attribute of the <BODY> tag inserts an image as a background for
the document.
Ex. <BODY BACKGROUND=”c:\tests\flowers.jpg”>
Marquee Tag.
<MARQUEE> </MARQUEE> tags are used to display embedded text to move vertically/horizontally. This tag is unique to Internet Explorer only.
Syntax :
<MARQUEE BEHAVIOUR=”motion type” DIRECTION=”scroll direction”
HEIGHT=”pixel” WIDTH=”pixel” BGCOLOR=”color” LOOP=”number” SCROLLDELAY=”milli seconds”> …………………………………….. </MARQUEE>
BEHAVIOUR : “motion type” attribute sets the motion to ALTERNATE/SCROLL/ SLIDE.
It works within the rectangular space provided for the MARQUEE tag.
DIRECTION : “scroll direction” specifies the scrolling direction of the text direction.
Values can be UP/DOWN/LEFT/RIGHT.
HEIGHT & WIDTH: “pixel” renders rectangular space on the page with these
attributes. Default value is determined by the largest font assigned to the content in the
marquee.
BGCOLOR : “color” establishes the color for the rectangular space reserved for the
MARQUEE tag.
LOOP : “number” sets the number of times the text should move. -1 will set it to infinite
loop. Once the set number of times is over the text will come to still position.
SCROLLDELAY : “milli seconds” will assign the dealy for the scroll text. The bigger the
number slower the text is. And smaller number will speed up the scroll text.
Ex. 13 Marquee Demo
<HTML><HEAD><TITLE> BACKGROUND & MARQUEE DEMO</TITLE><HEAD>
<BODY BGCOLOR=BLACK TEXT=FUCHSIA VLINK=GREEN ALINK=PINK>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 188
<MARQUEE HEIGHT=50 WIDTH=1000 BGCOLOR=GRAY>
<FONT SIZE=7 COLOR=LIME><B><===</B>
</FONT><BR/> </MARQUEE>
<MARQUEE DIRECTION=DOWN>
<FONT SIZE=7 COLOR=LIME><PRE><B>
||
||
||
||
****
**
</B></PRE></FONT><BR/>
</MARQUEE>
<MARQUEE DIRECTION=UP>
<FONT SIZE=7 COLOR=LIME><PRE><B>
**
****
||
||
||
||
</B></PRE></FONT><BR/>
</MARQUEE>
<MARQUEE DIRECTION=RIGHT HEIGHT=50 WIDTH=1000 BGCOLOR=GRAY>
<FONT SIZE=7 COLOR=LIME><B>===></B></FONT><BR/>
</MARQUEE>
<FONT COLOR=YELLOW SIZE=4>THIS IS LINK DEMO, CLICK TO CHANGE COLOR
<A HREF="linktype1.html">CLICK ME</A>
</FONT>
</BODY>
</HTML>
Working with Tables in HTML
Creating Tables
<TABLE> and </TABLE> tags are used for creating tables. All tags are embedded
in between. If you need to contain several cells in a row, then use several
<TD></TD> tags embedded inside <TR> and </TR>.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 189
Adding Borders
BORDER attribute inside the <TABLE> tag is used for mentioning border. No border
by default. Zero value gives no border. Ex.<TABLE BORDER=2>
Adding Border Color
BORDERCOLOR attribute specifies the color for border.
EX. <TABLE BORDER=2 BORDERCOLOR=BLUE>
Adding Table Background
BACKGROUND attribute in TABLE tag assigns background as tiled.
Ex. <TABLE BACKGROUND=FLOWERS.JPG>
Adding background color
BGCOLOR attribute in TABLE tag assigns color as background.
Ex. <TABLE BGCOLOR=GREEN>
Adding Column Headings
Use <TH> and </TH> tags to define a cell as heading cell. Create the <TR> tags
and use <TH> instead of <TD> inside them.
“ALIGN” attribute of <TH> sets contents horizontal alignment to
LEFT/RIGHT/CENTER.
Ex. <TR><TH>Roll No.</TH><TH>First Name</TH><TH>Second
Name</TH></TR>
Adding Row Headings
First cell of every row should be defined using <TH> and </TH> tags instead of
<TD> and </TD>.
Ex.
<TR><TH>Roll No.</TH><TH>First Name</TH><TH>Second Name</TH></TR>
<TR><TH>5344</TH><TD>ASHA</TD><TD>HEDGE</TD></TR>
<TR><TH>4456</TH><TD>USHA</TD><TD>MANJREKAR</TD></TR>
Cell Spacing and Padding
“CELLSPACING” attribute adds spacing between cells.
“CELLPADDING” attribute adds space between contents and cell border within the
cell.
Ex. Cell padding
<TABLE BORDER=2 CELLSPACING=6 CELLPADDING=6>
<HTML>
<HEAD>
<TITLE>Working With Table</TITLE>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 190
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing CELLPADDING !</B><BR>
<HR>
<I>Without Cellpadding</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
<HR>
<I>With Cellpadding of 10</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% CELLPADDING=10 ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 191
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Ex : Cell spacing
<HTML>
<HEAD>
<TITLE>Working With Table</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Controlling the space between Adjacent Cells ! </B><BR><BR>
<HR>
<I>Without Cellspacing</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 192
</TABLE>
</CENTER>
<HR>
<I>With Cellspacing of 10</I>
<CENTER>
<TABLE BORDER=1 CELLSPACING = 10 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Adding Caption
<CAPTION> and </CAPTION> tags are used to insert a caption for the table.
ALIGN attribute specifies the alignment as LEFT/RIGHT/BOTTOM/TOP.
Ex. <TABLE BORDER=1 CELLSPACING=6 CELLPADDING=6>
<CAPTION>I. MYTABLE </CAPTION>
Setting Table Width
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 193
WIDTH attributes specifies width of table. You can either use absolute value(in no
of pixels) or relative values (Percentages).
Ex. <TABLE BORDER=1 CELLSPACING=6 CELLPADING=6 WIDTH=80%>
Ex. Border and width of Table
<HTML>
<HEAD>
<TITLE>Table Attributes</TITLE>
</HEAD>
<BODY BGCOLOR = LIGHTGREY>
<B>Specifing the BORDER and WIDTH of the Table!</B>
<BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=5 WIDTH=50%>
<CAPTION ALIGN=bottom>
<B>Personal Information</B>
</CAPTION>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Aligning cell contents of the table
“Align” attribute can be used with <TH> or <TD> tags to align the contents of the
cell with values LEFT/CENTER/RIGHT.
Ex.
<TH ALIGN=RIGHT> ROLL NO.</TH>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 194
<TD ALIGN=CENTER> ROLL NO</TH>
Setting column width
“WIDTH” attribute inside the top cell of the column will set the width of the entire
column. You can enter the value of WIDTH tag either in absolute value(in pixels) or in relative value (percentage).
Ex. <TR>
<TH WIDTH
<TH WIDTH
<TH WIDTH
<TH WIDTH
<TR>
=20%>ROLL NO</TH>
=20%>FIRST NAME</TH>
=20%>LAST NAME</TH>
=20%>FEES PAID</TH>
Centering a table
Embed the entire table inside <CENTER> and </CENTER> tags to center the table
within the window.
Inserting an Image
Use the image source tag <IMG SRC = URL> tag inside the tags of <TD>, <TH>.
Ex.<TH><IMG SRC=”flowers.jpg”></TH>
Ex. images in tables
<HTML>
<HEAD>
<TITLE>Images in tables</TITLE>
<HEAD>
<CENTER>
<TABLE BGCOLOR=lightgrey WIDTH=350 HEIGHT=220 BORDER=14 CELLSPACING=12>
<TR>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
</TR>
<TR>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 195
</TR>
</CENTER>
</BODY>
</HTML>
Spanning Columns
“COLSPAN” attribute lets you span columns. It contains the value as the number of
required columns to merge. It is embedded inside the first tag of <TH>.
Ex. <TH COLSPAN=4> S T U D E N T R E P O R T</TH>
Spanning Rows
“ROWSPAN” attribute lets you span rows. It contains the value as the number of
required columns to merge. It is embedded inside the first tag of <TH>
Ex. <TH ROWSPAN=2>
Ex. Columns and rows spanning
<HTML><HEAD>
<TITLE>Working With Table</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing ROWSPAN and COLSPAN Attributes !</B>
<BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=1 WIDTH=50% ALIGN=CENTER>
<TR>
<TH ROWSPAN=2>NAME
<TH COLSPAN=3>MARKS
</TR>
<TR>
<TH>PowerBuilder
<TH>VisualBasic
<TH>Developer2000
</TR>
<TR ALIGN=CENTER>
<TD> Shilpa
<TD> 21
<TD> 45
<TD> 30
</TR>
<TR ALIGN=CENTER>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 196
<TD> Vaishali
<TD> 26
<TD> 30
<TD> 40
</TR>
<CAPTION ALIGN=bottom><B><BR>Mark Sheet</B></CAPTION>
</TABLE>
</CENTER>
</BODY>
</HTML>
Assigning background colors.
You can assign a background color to an entire table, a row within a table, or a single cell.
Ex.
<TR BGCOLOR=LIME>
Ex. Background colors for tables
<HTML>
<HEAD>
<TITLE>Assigning background colors to Tables</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing Coloured Table Cells !</B><BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=1 WIDTH=50% ALIGN=CENTER>
<TR>
<TH Bgcolor = LIME>NAME</TH>
<TH Bgcolor = LIME>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD Bgcolor = PINK><FONT Color=BLACK>Shilpa</FONT></TD>
<TD Bgcolor = YELLOW><FONT Color=BLACK>21 </FONT></TD>
</TR>
<TR ALIGN=CENTER>
<TD Bgcolor = WHITE><FONT Color=RED>Vaishali</FONT></TD>
<TD Bgcolor = VIOLET><FONT Color=BLACK>22</FONT></TD>
</TR>
<CAPTION ALIGN=bottom><B><BR>
Personal Information</B>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 197
</CAPTION>
</TABLE>
</CENTER>
</BODY>
</HTML>
Frames
<FRAMESET></FRAMESET> tags display frames in a window. Each frame can have
its own HTML file. Frames can be scrolled & resized by the user, unless scrolling
and resizing is turned off.
Absolute dimensions
Ex. <Frameset rows=80,400>
Defines a table with top row 80 pixels and bottom row with 400 pixels.
Percentage dimensions
Use % as dimensions instead of pixel. The % will set in context with the window
size.
Ex.<Frameset rows=”80%,20%”>
Top row with 80% of window and bottom with 20% of window is set.
Relative dimensions
Ex.<FRAMESET ROWS=”*,100”>
Bottom row is set to 100 pixel and top row takes the rest of the space in context
with the window.
<FRAME> tag is nested inside the <FRAMESET> AND </FRAMESET> tag.
Ex.<FRAME NAME=”FRAMENAME” SRC=URL FRAMEBORDER=”1/0” MARGINHEIGHT=
”PIXELS”
MARGINWIDTH=”PIXELS”
NORESIZE
SCROLLING=”YES/NO/AUTO”>
NAME attribute specifies the name of the frame.
SRC attribute specifies the url of the html document.
FRAMEBORDER can be switched on with value “1” and off with value “0”.
MARGINHEIGHT sets the margins in pixels (minimum is 2).
NORESIZE stops the manual resize of the frame.
SCROLLING determines how scrollbars are treated in a frame. NO value turns off the
scrolls. AUTO lets the control of scrolls automatically. Default value is “AUTO”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 198
NOFRAME tag is used to provide contents to browsers which do not support frames
or frames have been turned off. This tag can be placed after the last FRAME
element or after </FRAMESET> tag. No frame capable browser will ignore the
frames and frame capable browsers will ignore the NOFRAME tag.
You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some
text for browsers that do not support frames, you will have to enclose the text in
<body></body> tags! See how it is done in the first example below.
Ex. Demo of frames
Name this file as frames.html
<html>
<head><title>Demo of frames</title>
<frameset rows=20%,*>
<frame src="TOPFRAME.HTML"></frame>
<frameset cols=20%,*>
<frame src="LEFTFRAME.HTML">/frame>
<frame src="MAINFRAME.HTML" name=main></frame>
</frameset>
</frameset>
</HEAD>
<BODY>
</body>
</html>
</body>
</html>
Name this file as topframe.html
<HTML><HEAD><TITLE> TOPFRAME </TITLE></HEAD>
<BODY BGCOLOR="BLACK">
<H1 ALIGN=CENTER><FONT COLOR=LIME> THIS IS IN THE TOP FRAME FOR EXHIBITING THE MENUS </FONT></H1>
</BODY>
</HTML>
Name this file as leftframe.html
<HTML><HEAD><TITLE> Left frame </TITLE></HEAD>
<BODY Bgcolor="BLACK">
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 199
<H2><font color=violet> THIS IS IN THE LEFT FRAME FOR SPECIFYING TOPICS</font></H2>
</BODY>
</HTML>
Name this file as mainframe.html
<HTML>
<HEAD><TITLE> DETAILS FRAME </TITLE></HEAD>
<BODY BACKGROUND="BLACK">
<H1 ALIGN=CENTER> THIS IS IN THE MAIN FRAME FOR GIVING DETAILS ON THE TOPICS SELECTED IN THE LEFT FRAME</H1>
</BODY>
</HTML>
Creating Forms
A form is used to collect data from the users and submit it to the server for further
process.
The information may be
(a) Written to a file which is saved on the server.
(b) Submitted to a database for collecting necessary information requested by the user.
(c) E-mailed to someone in particular.
The data validation may be done at the browser level before submitting the data.
The ACTION attribute in the <FORM> tag specifies a URL that indicates specific CGI
scripts or program that collect the form data that a user entered.
Likewise the METHOD attribute describes the way in which the input data is delivered to a forms-handling program. Values can be POST or GET.
<FORM> </FORM> tags embed all other tags and text inside them. Action for the
web server, and method of dispatch is also mentioned inside these tags itself.
Specifying input (the <INPUT> tag and its many attributes).
Setting up text input areas (the <TEXTAREA></TEXTAREA> tags.
Selecting values from a predefined set of possible inputs (<SELECT></SELECT>).
Managing the forms’ content (using the SUBMIT attribute for INPUT to deliver the content to the server, or the RESET attribute to clear its contents, and start again).
<INPUT> Tag : Takes two basic elements TYPE and NAME attributes. TYPE indicates the shape of element on document. NAME assigns a name to the component so that it can be controlled for assigning and modifying its values.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 200
“TYPE” attributes can carry the following values.
CHECKBOX : produces check-box component on the form for multiple selection.
Ex.<INPUT NAME=”EMPLOYED” TYPE=”CHECKBOX” VALUE=”Y”>YES<BR/>
Ex. <INPUT NAME=”EMPLOYED” TYPE=”CHECKBOX” VALUE=”N”>NO<BR/>
PASSWORD: produces no visible area hence used for password.
IMAGE: Lets you include icons or other graphical symbols.
RADIO: Creates a radio button for a range of selections. User may select only one.
Ex.
Sex <br/>
<INPUT NAME=”sex” TYPE=”Radio” value=”M”>Male<br/>
<INPUT NAME=”sex” TYPE=”Radio” value=”F”>Female<br/>
RESET: this button lets the user to clear the contents.
<INPUT TYPE=”Reset” value=”cancel data”>
SUBMIT: creates “SUBMIT” button. This button tells the browser to bundle the form
data and pass it all to the CGI script indicated by the ACTION attribute.
Ex.<INPUT TYPE =”SUBMIT”VALUE= “REGISTER NOW”>
TEXT: Provides a one-line input entry.
Ex. <INPUT NAME = “name” TYPE=”Text” SIZE=20 MAXLENGTH=”25”>
Other <INPUT> Attributes
VALUE=”Value” supplies the default value for TEXT element.
Ex. VALUE=”Join Now” for a submit or VALUE=”Clear Form” for a reset.
SRC=”URL” Provides pointer to the graphic for an image.
CHECKED: Makes sure that a certain radio button/check box is checked.
SIZE: “number” Sets the number of characters that a TEXT element can display without
scrolling.
MAXLENGTH=”number” Sets the max no of chars that a value in a TEXT element can
contain.
ALIGN=”TOP/MIDDLE/BOTTOM/LEFT/RIGHT” For IMAGE elements, ALIGN determines
how the graphics is aligned on the form accompanying the text.
<SELECT> </SELECT>
This tag works like lists. Its attributes are
(a) NAME=”text” Provides the name of the component.
(b) SIZE=”number” Controls the number of elements. You can define more elements
than mentioned here.
(c) MULTIPLE: indicates that multiple selections are possible in absence of this attribute
the user can make only one selection.
Ex. <SELECT NAME=BANKS SIZE=4>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 201
(a)
(b)
(c)
(d)
<OPTION>HIMALAYAN BANK
<OPTION>STANDARD CHARTERED BANK
<OPTION>NABIL BANK
<OPTION>SBI NEPAL
<OPTION>GLOBAL TRUST BANK
</SELECT>
<TEXTAREA> … </TEXTAREA>
This tag allows you to create a text area without size. Text is embedded between
the tags.
Attributes are : NAME=”text” Provides the name for controlling the component.
ROWS=”number” specified the no of lines on the screen to display.
COLS=”number” specified the no of columns on the screen for display.
WRAP=HARD/SOFT/NONE specifies how text will wrap.
You can include more text than specified in the rows and columns.
Ex. <TEXTAREA NAME=”REMARKS” ROWS=3 COLS 4>
THIS STUDENT IS JOINING Masters in information technology.
</TEXTAREA>
Ex. Demo of Form
<HTML><HEAD><TITLE>FORM</TITLE>
<BODY>
<FORM>
<TABLE align=center border=1>
<TR>
<TH colSpan=2><TD>STUDENT INFORMATION</TD></TR>
<TR>
<TD>NAME</TD>
<TD><INPUT name=TXTNAME> </TD>
<TR>
<TD>ADDRESS</TD>
<TD><INPUT name=TXTADDRESS> </TD>
<TR>
<TD>SEX</TD>
<TD><INPUT type=radio value=M name=RDOSEX>MALE
<INPUT type=radio value=F
name=RDOSEX>FEMALE </TD>
<TR>
<TD>PHONE NO</TD>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 202
<TD><INPUT name=TXTPHONENO> </TD>
</tr>
<TR>
<TD>HOBBIES</TD>
<TD><INPUT type=checkbox value=CHATTING name=CHKCHATTING>CHATTING <INPUT
type=checkbox value=PLAYING name=CHKPLAYING>PLAYING<BR>
<INPUT type=checkbox value=SLEEPING name=CHKSLEEPING>SLEEPING
<INPUT type=checkbox value=HIKING name=CHKHIKING>HIKING </TD>
<TR>
<TD>CLASS</TD>
<TD><SELECT name=CBOCLASS> <OPTION value=XI selected>XI</OPTION> <OPTION
value=XII>XII</OPTION>
<OPTION value=BBA>BBA</OPTION>
</SELECT> </TD>
<TR>
<TD>COMMENTS</TD>
<TD><TEXTAREA name=AREACOMMENTS rows=5></TEXTAREA> </TD>
<TR>
<TD align=middle colSpan=2><INPUT type=button value=SEND name=CMDSEND> <INPUT type=submit value=SUBMIT> <INPUT type=reset value=RESET>
</TD></TR></TABLE></FORM></BODY></HTML>
Ex. Demo of Logon Form
<HTML><HEAD><TITLE>log on form</TITLE>
</HEAD>
<BODY>
<FORM>
<TABLE align=center border=2>
<TR>
<TH align=CETNER colSpan=2>Log On Form</TH></TR>
<TR>
<TD>UserName</TD>
<TD><INPUT name=txt></TD></TR>
<TR>
<TD>Password</TD>
<TD><INPUT type=password name=txt password></TD></TR>
<TR>
<TD>Log On as</TD>
<TD><SELECT name=cbologonas> <OPTION value=administrator
selected>Administrator</OPTION> <OPTION
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 203
value=operator>Operator</OPTION></SELECT> </TD></TR>
<TR>
<TD align=CENTER colSpan=2><INPUT type=button value=ok name=btnok> <INPUT
type=button value=cancel
name=btncancel></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
Multi-column text
<MULTICOL> and </MULTICOL> displays text in multiple columns
COLS : specifies the number of columns to use.
GUTTER: specifies the number of pixels between each column.
WIDTH: specifies the width of the columns as a whole.
This will work with Netscape browser.
Working of Internet
When SUBMIT button is clicked the information passes on to server.
CGI interface ties the user information from the browser through Word Wide Web, to
the program on the server.
CGI Script is invoked and the information is passed through two REQUEST_METHOD,
GET or POST.
REQUEST_METHOD is the environment variable carrying the value GET/POST.
GET
It’s a request method which packs the information from the browser at the end of the URL
string. QUERY_STRING is the environment variable carrying the pair of element and value.
Ex.<a href ”cgi-bin/abc.exe?iname=aptech&fname=kantipath”>
In this example REQUEST_METHOD contains GET as its value, and QUERY_STRING contains
“iname=aptech&fname=kantipath” as its value. Some servers use “?” and some use “/” as
the separator between the program and values. If “/” is used then the environment variable in place of QUERY_STRING is “PATH_INFO”. In unix environment this length is max 100
chars. The query string is displayed in the URL.
POST
Post also passes the information from browser in the same way. But POST uses STDIN. Standard Input stream. CONTENT_LENGTH contains the size of the stream. Post method variable and values are not seen in the URL. There is no restriction on the size of the data sent
to the server.
To evaluate the data the server should examine the “REQUEST_METHOD” value and use the
information accordingly.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 204
Fundamental of Computer: The term "Computer has been derived from Latin word Computare" which means
– calculate. Similarly, in English language Calculate means to do mathematical operation. So, Computer is an electronic device which accepts raw data,
processes it according to the specific instruction and gives the result as new
information. This is also a digital operating device. But, the computers originated with a huge size and extreme processing capabilities.
Symbol
\
/
!
&
#
*
:
;
@
$
Symbol and their meaning
Name Of Symbol
Backward Slash
Forward slash
Exclamation
Ampersand
Hash
asterisk (star)
Colon
Semi colon
At the rate
dollar
Screen (VDU) Monitor is also output device called display
unit. VDU stand for visual display unit.
CPU (Central processing unit) it is a main part of a computer. It is also known
as system box (brain box). There are central unit (C.U) arithmetical and logical unit (ALU) and storage unit (main storage in a CPU.)
Printer printer is an out put device which is use to print a document.
Mouse input device
Characteristics of Computer:
Speed-It can carry out the computation very fast.
Accuracy-The results generated by computer are very accurate.
Versatility-It can process multiple types of data.
Automatic-If instructions are given correctly, it can work automatic.
Storage-It can store a huge amount of data.
Diligent-It is very hard-working in its work.
Software:
Software is a set of program which is used for different purpose. It is
also defined as the program concerned with operation of the hardware in the
data system.
Types of Software:The software available in any computer can be divided into two types:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 205
System Software:-The software required for running user program is known as
system software. System software is the collection of the programs written for computer, which allows the user to develop and run programs.
Mainly system software is divided into two parts:
1. Operating system is a program:-which controls overall operations (activities) of the computer. It is the media point between the computer and operators,
dos, UNIX, windows are the example of operating system.
2. Utility program:- Utility program are those programs, which are used for
managing files or folders, working with files or folders or drives and developing writing and testing the programs.
Application software:-The software written for special purpose (specific) in a specific language is known as application software. These programs perform certain task
with respect to related program MS-Word, MS-Excel, MS- PowerPoint, adobe PageMaker, freehand, Photoshop, and AutoCAD are the examples of application software.
Input:
Through which user can insert data or through which user can give instruction is called input unit. E.g. Keyboard, Mouse, Scanner, Microphone.
Process: Process is the manipulation of data as per given instruction.
Memory: The capability to store the data is known as computer memory. Programs and data are stored in the memory unit of the CPU during processing.
Memory consists of storage locations.
Memory can be classified into 2 types:
1) Primary memory: - It is also called the main memory or the central memory. This memory is resident (attach) on the motherboard. There are two types
of primary memory:a) ROM (Read Only Memory):-It is permanently in built into the computer at the
time of its production. It stores a set of instruction and instructs the computer how to work.
The user cannot change these instructions. ROM is non-volatile, that is, when computer
goes off this instruction is not lost.
b) RAM (Random Access Memory): - It is short-term memory of volatile
memory. That is, when the computer is switched ON, the memory, which
available to use is RAM, but when the computer is switched OFF, all the information disappears. RAM is temporary whereas ROM is permanent memory.
It is read/write, memory i.e. user can either write on to this memory or read
from it.
2) Secondary memory: - The secondary memory is the external memory. Secondary storage allows string large volumes of data. The contents of secondary storage are not lost
when the power is turned OFF.
Secondary storage devices:
a. Hard Disk:
Hard disk is a large capacity, permanent storage area that offers access to the information
stored on it. Hard disk is always fixed in the computer and cannot be removed. Huge number of data can be stored in this type of storage media.
b. Floppy Disk
Floppy disks are magnetically coated disks on which information; both pro-
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 206
grams and data typed from the keyboard, can be stored and retrieved. It is
also called portable disk drive.
c. CD-ROM (Compact disk Read Only Memory):- It is non erasable disk used for storing
computer data.
3. Control Unit:The control unit directs all operations inside the computer. It is known as nerve center of the computer because it controls and co-ordinates all hardware operations.
4. Arithmetic Logic Unit (ALU):- It operates on the data available in the main memory
and amends them back after processing once again to the main memory.
Output: Output is the processed data. It is also called result. E.g. Printer, Monitor/ Screen, Speaker.
Data: - Data is just like raw material which provides some meaningful result after processing.
The desktop
The most important change in windows 95/98, 2000, XP over earlier versions of
windows is new interface called desktop. Desktop is the backdrop on which
windows and icons of disks and applications reside. When you open a program or file, it appears in a window on the desktop.
Icons
Icons are symbols or pictures that represent documents, applications, folders,
devices and others. Initially you will see at least four icons on your windows
95/98, 2000, XP desktop.
My computer icon on the desktop opens a view into the resources of local computer.
Recycle bin is a holding place for all the deleted objects.
Network neighborhood icon is available, if the computer is part of a network or
is equipped so it can be connected to one at some point.
My document icon it is use for default save location and to save document.
Taskbar :- The taskbar is long horizontal bar located at bottom of screen when
you start window for the first time. By default, they are always visible when a
window is running.
Starting with the start menu.
When you click the start button, you see a menu that contains everything you
need to begin using window.
Program
Display a list of programs you can start.
Documents
Display a list of documents that you have opened previously .It
can list 15 documents/program only.
Settings
Display a list of system components for which you can change settings.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 207
Find/ search
Enables you to find a folder file, shared computer or mail message.
Help
Allows using help to find out how to do a task in windows.
Run execute a program, when you type filename or command.
Shutdown/ turn off Shuts down or restart your computer or close computer.
Windows components
A window is a rectangular area on the screen that represents a folder on the
desktop. A running program or a document or dialog box in program.
a. Title bar
The title bar is located at the top of the screen. It displays the name of the application or document.
b. Control Menu box.
It is located, or in the upper left corner of each screen. It opens a control menu
(also called system menu) containing commands to control the location, size
and status of the windows.
c. Menu bar.
A one –line horizontal menu at the top of the screen below the title bar is called a
menu bar. It contains a list of options such as file, edit, window, help etc. this
makes it easier to learn new applications.
d. Scroll bar.
A scroll bar is a bar that appears at the bottom and right edge of a window whose
contents are not entirely visible.
e. Work space.
Work space is the part/ portion of a window that is inside the frame and under
the title bar and menu bar. This is also called client area.
f. Maximize button.
Maximize button displayed at the centre of the three buttons, displayed on the
right corner of the title bar. When you click on the middle, button the window
will become the full screen size of your desktop.
g. Minimize button.
Minimize button collapse a window and makes it disappear from the screen, if
want to open a new window while working in another window, you need not
close the current window.
h. Restore button.
When a window is maximized, its maximize button is replaced by a restore button.
I. Close button.
You can close any window, which is currently open by clicking on the close button.
About mouse:
Point: - : Place the mouse pointer to the specified object.
Click: - press and release left mouse button.
Right click: - Press and release right mouse button.
Double click: - press and release left mouse button twice quick.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 208
Dragging and dropping: - place the mouse pointer on the object and press mouse
left button, hold it down and move to specified location and drop it.
How to open a program?
Click on start button.
Point to program.
Click on specified program which you want to open.
How to close a program?
Click on close button.
Or
Choose file > exit from menu bar
Or
Press Alt +F4 key
Or
Right click on title bar and choose close from menu.
Or
Click on control menu box and choose close
To open a document:
Click on start button.
Click on document.
Click on required document which you want to open.
Creating folder in desktop:Right click on blank area of desktop and choose new.
Click on folder option.
Type new name for the folder and press enter key.
Creating new folder into an existing folder:Double click on a folder.
Choose file > new > folder
Type new name for the folder and press enter key.
Selecting multiple object (folder, shortcut, doc file) Click on the object to select an object.
to select different object, hold down ctrl key and click on different object
To select different object continuously, hold down shift key and drag the mouse
pointer near the specified object.
To select all objects at a time, press ctrl+A.
Deselecting object To deselect all objects, click left mouse button on empty area.
To deselect different object press ctrl + clicking.
To invert the selection, choose edit > invert selection.
Opening object Double click on the object
Or
Right click on the object and choose open.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 209
Or
Select the object (s) and choose file > open.
Or
Select the object and press enter key.
Renaming object Right click on the object and choose rename and type new name for the object and press enter.
Or ,
Select the object and choose file> rename and type new name for the
object and press enter
key.
Or
Click on the name of the object, click again and type new name for the object
and press enter
Key.
Using recycle bin To get deleted objects back again or to delete objects permanently.
Double click on recycle bin icon shows temporarily deleted objects
To undelete objects & restore them to their original locations.
Select the objects then right click & choose restore or, choose File > restore
from menu bar.
To undelete objects & put them wherever you want, select the objects then find
the place where you want them to appear & drag them to appropriate spot.
to delete objects permanently from recycle bin & the disk, select the objects then
right click & choose delete or , click on the delete button in the tool bar or ,
choose file > delete from the menu bar. Choose Yes to delete the object.
To delete all objects permanently at a time, right click on the recycle bin icon on
the desktop & choose empty recycle bin from property menu or, choose Yes
to confirm the dead.
To restore the most recent deleted objects from the recycle bin to their original
locations, choose Edit> undo delete from the menu bar or, click on the undo
delete button in the tool bar.
Copying & Moving objects or files/folders :
1. Select the objects which you want to copy or move.
2. press ctrl + C or, Choose Edit > Copy or, Right click & choose copy ( for copying
the objects)
3. Press ctrl + X or, choose Edit > cut or right click & choose cut (for moving the
objects).
4. Open the destination folder & select the place.
5. Press ctrl + V or, Edit > paste or, Right click & choose paste (to copy or moved
the objects.)
Browsing with my computer
1. Double click on my computer icon.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 210
2. double click on drive letter(A: or C: or D: etc)
3. Double click on folder & sub folder until required folders or files are not found.
Move, copy, delete and rename the objects as required
To display the properties of the objects
To display the properties ( type of object, creation date, location, name, size, modification date, attribute- hidden, read only, system, archive etc.) of the selected object.
Select the object.
Choose file > properties or, choose properties button from tool bar.
Arrange icons in different order
1. choose view > arrange icons> name (name wise alphabetic order)
2. choose view > arrange icons > size( size wise order-smallest first)
3. choose view > arrange icons > date (date wise order – smallest first)
4. choose view > arrange > auto arrange (automatic order)
OR
Right click on blank space > choose arrange icon by> choose the style you like.
Finding files or folder.
Choose start> Search > files or folder.
Click on All file and folders.
Select name and location tab (if not selected).
Click the named box. And then type the name of files or folder (partial or full name)
you want to find.
5. Specify where to search. Click the arrow next to look in box, or browse.
6. Click the find now button to start the search.
7. Click the new search button and ok button to clear the current search.
1.
2.
3.
4.
About Mouse:
To change the mouse settings
Buttons
1.
2.
3.
4.
5.
6.
7.
8.
choose start >settings > control panel
or
Double click on my computer icon & double click on control panel.
Double click on mouse icon.
If buttons tab is not selected, select it.
choose buttons configuration ( right handed or left handed)
change double click speed (slow or fast)
Click ok button.
Display of Desktop
Background: to change the background of desktop.
1. Right click on desktop & choose properties.
2. If background tab is not selected, select it.
3. Choose wallpaper option from drop down list (ed. Clouds forest etc.)
4. choose display option (tile or center or stretch)
5. Choose pattern option from drop down list & then click on edit pattern button.
6. Under pattern editor, change the pattern & click on change or done button.
7. Click on ok button.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 211
Screen saver:
To apply screen saver:
1. Right click on desktop > click on properties.
2. Select screen saver tab.
3. Choose screen saver option from the list (e.g. - flying window, 3D text.)
4. Click on setting button (especially for 3D text. Or scrolling Marquee)
5. Type the text in text box.
6. Move the size speed & resolution slider left or right.
7. Double click format buttons & choose font, font size and color.
8. Click on ok button twice.
9. type minutes in minute box (wait)
10. Click on preview button to show screen saver.
11. Click on ok button.
Appearance:
To change the appearance of windows:
1. Right click on desktop > click on properties.
2. Click on appearance tab.
3. Choose one item from item list (desktop, menu, icon etc.
4. choose one scheme from scheme list (windows standard, rose, pinks)
5. Choose color from color list, font from font list, size from size list & click
on ok or apply button.
Settings:
1. Right click on desktop > click on properties.
2. Click on settings tab.
3. Choose color palette from color palette list.
4. Change the default desktop area with the help of slider.
5. Choose font size from the list.
6. click on advance properties for advance display properties ( adapter, monitor & performance)
7. Click on ok or apply button.
Fundamental of Computer: The term "Computer has been derived from Latin word Computare" which means
– calculate. Similarly, in English language Calculate means to do mathematical operation. So, Computer is an electronic device which accepts raw data,
processes it according to the specific instruction and gives the result as new
information. This is also a digital operating device. But, the computers originated with a huge size and extreme processing capabilities.
Symbol
\
/
!
&
#
Symbol and their
Name Of Symbol
Backward Slash
Forward slash
Exclamation
Ampersand
Hash
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 212
asterisk (star)
Colon
Semi colon
At the rate
dollar
*
:
;
@
$
Screen (VDU) Monitor is also output device called display
unit. VDU stand for visual display unit.
CPU (Central processing unit) it is a main part of a computer. It is also known
as system box (brain box). There are central unit (C.U) arithmetical and logical unit (ALU) and storage unit (main storage in a CPU.)
Printer printer is an out put device which is use to print a document.
Mouse input device
Characteristics of Computer:
Speed-It can carry out the computation very fast.
Accuracy-The results generated by computer are very accurate.
Versatility-It can process multiple types of data.
Automatic-If instructions are given correctly, it can work automatic.
Storage-It can store a huge amount of data.
Diligent-It is very hard-working in its work.
Software:
Software is a set of program which is used for different purpose. It is
also defined as the program concerned with operation of the hardware in the
data system.
Types of Software:The software available in any computer can be divided into two types:
System Software:-The software required for running user program is known as
system software. System software is the collection of the programs written for computer, which allows the user to develop and run programs.
Mainly system software is divided into two parts:
1. Operating system is a program:-which controls overall operations (activities) of the computer. It is the media point between the computer and operators,
dos, UNIX, windows are the example of operating system.
2. Utility program:- Utility program are those programs, which are used for
managing files or folders, working with files or folders or drives and developing writing and testing the programs.
Application software:-The software written for special purpose (specific) in a specific language is known as application software. These programs perform certain task
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 213
with respect to related program MS-Word, MS-Excel, MS- PowerPoint, adobe PageMaker, freehand, Photoshop, and AutoCAD are the examples of application software.
Input:
Through which user can insert data or through which user can give instruction is called input unit. E.g. Keyboard, Mouse, Scanner, Microphone.
Process: Process is the manipulation of data as per given instruction.
Memory: The capability to store the data is known as computer memory. Programs and data are stored in the memory unit of the CPU during processing.
Memory consists of storage locations.
Memory can be classified into 2 types:
1) Primary memory: - It is also called the main memory or the central memory. This memory is resident (attach) on the motherboard. There are two types
of primary memory:a) ROM (Read Only Memory):-It is permanently in built into the computer at the
time of its production. It stores a set of instruction and instructs the computer how to work.
The user cannot change these instructions. ROM is non-volatile, that is, when computer
goes off this instruction is not lost.
b) RAM (Random Access Memory): - It is short-term memory of volatile
memory. That is, when the computer is switched ON, the memory, which
available to use is RAM, but when the computer is switched OFF, all the information disappears. RAM is temporary whereas ROM is permanent memory.
It is read/write, memory i.e. user can either write on to this memory or read
from it.
2) Secondary memory: - The secondary memory is the external memory. Secondary storage allows string large volumes of data. The contents of secondary storage are not lost
when the power is turned OFF.
Secondary storage devices:
a. Hard Disk:
Hard disk is a large capacity, permanent storage area that offers access to the information
stored on it. Hard disk is always fixed in the computer and cannot be removed. Huge number of data can be stored in this type of storage media.
b. Floppy Disk
Floppy disks are magnetically coated disks on which information; both programs and data typed from the keyboard, can be stored and retrieved. It is
also called portable disk drive.
c. CD-ROM (Compact disk Read Only Memory):- It is non erasable disk used for storing
computer data.
3. Control Unit:The control unit directs all operations inside the computer. It is known as nerve center of the computer because it controls and co-ordinates all hardware operations.
4. Arithmetic Logic Unit (ALU):- It operates on the data available in the main memory
and amends them back after processing once again to the main memory.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 214
Output: Output is the processed data. It is also called result. E.g. Printer, Monitor/ Screen, Speaker.
Data: - Data is just like raw material which provides some meaningful result after processing.
The desktop
The most important change in windows 95/98, 2000, XP over earlier versions of
windows is new interface called desktop. Desktop is the backdrop on which
windows and icons of disks and applications reside. When you open a program or file, it appears in a window on the desktop.
Icons
Icons are symbols or pictures that represent documents, applications, folders,
devices and others. Initially you will see at least four icons on your windows
95/98, 2000, XP desktop.
My computer icon on the desktop opens a view into the resources of local computer.
Recycle bin is a holding place for all the deleted objects.
Network neighborhood icon is available, if the computer is part of a network or
is equipped so it can be connected to one at some point.
My document icon it is use for default save location and to save document.
Taskbar :- The taskbar is long horizontal bar located at bottom of screen when
you start window for the first time. By default, they are always visible when a
window is running.
Starting with the start menu.
When you click the start button, you see a menu that contains everything you
need to begin using window.
Program
Display a list of programs you can start.
Documents
Display a list of documents that you have opened previously .It
can list 15 documents/program only.
Settings
Display a list of system components for which you can change settings.
Find/ search
Enables you to find a folder file, shared computer or mail message.
Help
Allows using help to find out how to do a task in windows.
Run execute a program, when you type filename or command.
Shutdown/ turn off Shuts down or restart your computer or close computer.
Windows components
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 215
A window is a rectangular area on the screen that represents a folder on the
desktop. A running program or a document or dialog box in program.
a. Title bar
The title bar is located at the top of the screen. It displays the name of the application or document.
b. Control Menu box.
It is located, or in the upper left corner of each screen. It opens a control menu
(also called system menu) containing commands to control the location, size
and status of the windows.
c. Menu bar.
A one –line horizontal menu at the top of the screen below the title bar is called a
menu bar. It contains a list of options such as file, edit, window, help etc. this
makes it easier to learn new applications.
d. Scroll bar.
A scroll bar is a bar that appears at the bottom and right edge of a window whose
contents are not entirely visible.
e. Work space.
Work space is the part/ portion of a window that is inside the frame and under
the title bar and menu bar. This is also called client area.
f. Maximize button.
Maximize button displayed at the centre of the three buttons, displayed on the
right corner of the title bar. When you click on the middle, button the window
will become the full screen size of your desktop.
g. Minimize button.
Minimize button collapse a window and makes it disappear from the screen, if
want to open a new window while working in another window, you need not
close the current window.
h. Restore button.
When a window is maximized, its maximize button is replaced by a restore button.
I. Close button.
You can close any window, which is currently open by clicking on the close button.
About mouse:
Point: - : Place the mouse pointer to the specified object.
Click: - press and release left mouse button.
Right click: - Press and release right mouse button.
Double click: - press and release left mouse button twice quick.
Dragging and dropping: - place the mouse pointer on the object and press mouse
left button, hold it down and move to specified location and drop it.
How to open a program?
Click on start button.
Point to program.
Click on specified program which you want to open.
How to close a program?
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 216
Click on close button.
Or
Choose file > exit from menu bar
Or
Press Alt +F4 key
Or
Right click on title bar and choose close from menu.
Or
Click on control menu box and choose close
To open a document:
Click on start button.
Click on document.
Click on required document which you want to open.
Creating folder in desktop:Right click on blank area of desktop and choose new.
Click on folder option.
Type new name for the folder and press enter key.
Creating new folder into an existing folder:Double click on a folder.
choose file > new > folder
Type new name for the folder and press enter key.
Selecting Multiple object (folder, shortcut, doc file) Click on the object to select an object.
to select different object, hold down ctrl key and click on different object
To select different object continuously, hold down shift key and drag the mouse
pointer near the specified object.
To select all objects at a time, press ctrl+A.
Deselecting object To deselect all objects, click left mouse button on empty area.
To deselect different object press ctrl + clicking.
To invert the selection, choose edit > invert selection.
Opening object Double click on the object
Or
Right click on the object and choose open.
Or
Select the object (s) and choose file > open.
Or
Select the object and press enter key.
Renaming object Right click on the object and choose rename and type new name for the object and press enter.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 217
Or ,
Select the object and choose file> rename and type new name for the
object and press enter
key.
Or
Click on the name of the object, click again and type new name for the object
and press enter
Key.
Using recycle bin To get deleted objects back again or to delete objects permanently.
Double click on recycle bin icon shows temporarily deleted objects
To undelete objects & restore them to their original locations.
Select the objects then right click & choose restore or, choose File > restore
from menu bar.
To undelete objects & put them wherever you want, select the objects then find
the place where you want them to appear & drag them to appropriate spot.
to delete objects permanently from recycle bin & the disk, select the objects then
right click & choose delete or , click on the delete button in the tool bar or ,
choose file > delete from the menu bar. Choose Yes to delete the object.
To delete all objects permanently at a time, right click on the recycle bin icon on
the desktop & choose empty recycle bin from property menu or, choose Yes
to confirm the dead.
To restore the most recent deleted objects from the recycle bin to their original
locations, choose Edit> undo delete from the menu bar or, click on the undo
delete button in the tool bar.
Copying & Moving objects or files/folders :
6. Select the objects which you want to copy or move.
7. press ctrl + C or, Choose Edit > Copy or, Right click & choose copy ( for copying
the objects)
8. Press ctrl + X or, choose Edit > cut or right click & choose cut (for moving the
objects).
9. Open the destination folder & select the place.
10. Press ctrl + V or, Edit > paste or, Right click & choose paste (to copy or moved
the objects.)
Browsing with my computer
4. Double click on my computer icon.
5. double click on drive letter(A: or C: or D: etc)
6. Double click on folder & sub folder until required folders or files are not found.
Move, copy, delete and rename the objects as required
To display the properties of the objects
To display the properties ( type of object, creation date, location, name, size, modification date, attribute- hidden, read only, system, archive etc.) of the selected object.
Select the object.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 218
Choose file > properties or, choose properties button from tool bar.
Arrange icons in different order
5. choose view > arrange icons> name (name wise alphabetic order)
6. choose view > arrange icons > size( size wise order-smallest first)
7. choose view > arrange icons > date (date wise order – smallest first)
8. choose view > arrange > auto arrange (automatic order)
OR
Right click on blank space > choose arrange icon by> choose the style you like.
Finding files or folder.
8. Choose start> Search > files or folder.
9. Click on All file and folders.
10. Select name and location tab (if not selected).
11. Click the named box. And then type the name of files or folder (partial or full name)
you want to find.
12. Specify where to search. Click the arrow next to look in box, or browse.
13. Click the find now button to start the search.
14. Click the new search button and ok button to clear the current search.
About Mouse:
To change the mouse settings
Buttons
9.
10.
11.
12.
13.
14.
15.
16.
choose start >settings > control panel
or
Double click on my computer icon & double click on control panel.
Double click on mouse icon.
If buttons tab is not selected, select it.
choose buttons configuration ( right handed or left handed)
change double click speed (slow or fast)
Click ok button.
Display of Desktop
Background: to change the background of desktop.
8. Right click on desktop & choose properties.
9. If background tab is not selected, select it.
10. Choose wallpaper option from drop down list (ed. Clouds forest etc.)
11. choose display option (tile or center or stretch)
12. Choose pattern option from drop down list & then click on edit pattern button.
13. Under pattern editor, change the pattern & click on change or done button.
14. Click on ok button.
Screen saver:
To apply screen saver:
12. Right click on desktop > click on properties.
13. Select screen saver tab.
14. Choose screen saver option from the list (e.g. - flying window, 3D text.)
15. Click on setting button (especially for 3D text. Or scrolling Marquee)
16. Type the text in text box.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 219
17. Move the size speed & resolution slider left or right.
18. Double click format buttons & choose font, font size and color.
19. Click on ok button twice.
20. type minutes in minute box (wait)
21. Click on preview button to show screen saver.
22. Click on ok button.
Appearance:
To change the appearance of windows:
6. Right click on desktop > click on properties.
7. Click on appearance tab.
8. Choose one item from item list (desktop, menu, icon etc.
9. choose one scheme from scheme list (windows standard, rose, pinks)
10. Choose color from color list, font from font list, size from size list & click
on ok or apply button.
Settings:
8. Right click on desktop > click on properties.
9. Click on settings tab.
10. Choose color palette from color palette list.
11. Change the default desktop area with the help of slider.
12. Choose font size from the list.
13. click on advance properties for advance display properties ( adapter, monitor & performance)
14. Click on ok or apply button.
FRONT PAGE 2003
Stating Frontpage
Click start – microsoft office – Microsoft Front Page (OR) Click Start – Run – and type
Frontpg.exe
Web
The basic unit information displayed over the net is a web page.
A web site is a collection of web pages.
A collection of related Web pages is known as a web site and is recognized by a URL..
HOME page is the first page and provides labeled links to other web pages.
As a developer you have three roles to play:
Visualizer : To ensure attractive pages are designed.
Architect : To decide the navigation of pages from the main page, the Home page.
Librarian : You have to ensure that the contents are catalogued in such a manner that the
user faces no difficulty in locating information or resources on your web site.
The Phases during the development of a web site.
Design Phase
The goals and objectives and targed audience are identified in this phase
Prepare a story board (description of the layout, contents, sequence, operation) of
your web site.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 220
To organize the information.
In Development Phase
The developer should decide about the design, the layout and content.
To design and provide simple navigation around the web site.
Hyper-tree is a hierarchical information structure.
Front 2003 is a tool used to create and manage web sites.
Front 2003 workplace consists of Front Page explorer, Front Page Editor.
Front 2003 provides the user with many views : - Page View, Folder View, Navigation View,
Hyperlink View, Navigation and Tasks View.
Creating a Web Page
By default 2003 opens the default web page, “new_page_1.htm”. Click “File – new- new
blank page”.
Creating a Web Site
Click “file – new”.
Select “one page web site” for single page web site. Type the website Name. Probably it
would be existing folder. If a new folder name is given a folder will be created on that
name.
Select “more web site templates” for selecting from a list of templates.
As soon as website is created, frontpage creates a number of files and folders automatically.
Display Web page/site
After creating the web page/site click “F12” or “file – preview in browser” and select the
resolution mode.
Save the files before seeing in the browser.
Setting Page title
Click “File – Save As option” and while entering the name of the file/web click the button
“Change Title” for setting the title for the page which is displayed on the title bar of the
page.
Setting Page background
Click “format – background” and browse for the background picture or color. OR right click
on the page and select “page properties – format tab” and select.
Formatting
Aligining/indenting parapraphs : Select the text and use the alignment icons from toolbar
(or) click “format – paragraph”. Select the indentation and other spacing for para.
Setting Font Style & sizes : Select the text and click on the icons from the formatting toolbar
(OR) click “format – font” and select the font sizes and styles.
Setting Font colors, text effects: Select the icon from the formatting toolbar (OR) click “format – font” & select the colors/text effects like strikethrough, blink, superscript, subscript etc.
Character spacing : Select “format – font” on the character & spacing tab select the option.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 221
Adding Bullets & numbering Lists
Plain Bullets : Select the text and click “format – bullets & numbering”, on “plain bullets” tab
select the bullet.
Picture Bullets : select the text and click “format – bullets & numbering”, on the “picture bullets” tab browse the file. NOTE: that the size of the picture needs to be small.
Numbering : Select the text and click “format – bullets & numbering” on the “numbers” tab select the style. For setting start value select from the “start at” option.
Using special characters in web
Place the cursor and click “insert – symbol” and select from the list.
Using themes
Select “format – themes” and select the theme from the right pane.
Inserting picture
Place the cursor and click “insert – picture” and select from the options from scanner/from
file/from clip art/flash format etc and browse for the file.
Formatting picture Click on the picture and select ”format – properties” OR Alt+Enter.
For wrapping, layout, border thickness and size select from the “appearance” tab.
For resolution settings, description of picture, hyperlink and setting target frames select from the
“General” tab.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 222
Exploring various views
(a) Page view
There are four views depending on your specific needs.
• Design view You can design and edit Web pages in the default Page view, Design
view.
• Code view You can view, write, and edit the HTML tags yourself.
• Split view You can review and edit Web page content in a split screen format that offers you simultaneous access to both the Code and Design views.
• Preview view You can approximate how the page will look in the Web browser without having to save your page.
(b) Folders view
Allows to work with the files and folders directly, and to organize the contents of your Web site. You
can also create, delete, copy, and move folders in this view.
(c) Remote Web Site view
Used to publish an entire Web site or individual files. You can ensure that sites with the same
content are up-to-date with recent changes. Status, such as Don't Publish, Changed, Unchanged,
New, and Conflict are shown for assistance.
(d) Reports view
You can calculate the total size of the files in your site, show which files are not linked to other files,
identify slow or outdated pages, group files by task or person they're assigned to, and more.
(e) Navigation view
Provides hierarchical view of Web pages. Enables you to arrange the pages in your site by clicking on a page and moving it to a new location in the site.
(f) Hyperlinks view
Shows the status of the hyperlinks in your Web site in a list including both internal and external
hyperlinks, and uses icons to indicate whether the hyperlinks have been verified or are broken.
(g) Tasks view
Displays all the tasks in your Web site in a column format and provides current information about
each task under various headings.
Resizing the components
Click on the buttons/combobox/textarea/radio buttons etc and hold the mouse and drag to
resize the components.
Assigning properties
Click on the component you want to set the properties, and click “format – properties” and
set the properties. (OR) Right click on the component and select “Form Field Properties”.
(OR) click on the component and enter “Alt + Enter” for editing the properties of the said
component.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 223
Finding Text/code
Click “Edit – Find” (OR) “Ctrl + F” to find any text/code in the code layout of page view.
Select the location from the “find where” column. Select the direction of search in “direction”
column and select “Advanced” column for matching the case, ignore white spaces etc.
Replace text/code
Click “Edit – Find” OR Ctrl +F to find and select the “replace” tab and enter the text/code you
want to replace in the second text box.
Finding & replacing HTML Tags
Click “Edit – Find” or Ctrl + F and select the “HTML Tags” tab. Select the first text box to
find the contents and second text box for replacing the contents.
Going to line/bookmark/function.
Click on “Edit – go to bookmark” select option. OR “Ctrl + G”.
Click on “Edit - go to function” select option.
In code view click “edit – go to line” and specify the line no. OR Ctrl+G
Adding Bookmarks
Click on the text and select “insert – bookmark”, (OR) Ctrl + G and type the name of bookmark.
Inserting Marque
Select the place where you want to insert the marquee and click “insert – web component”.
From the component type select “dynamic effects” and from the choose an effect select
“marquee”. Click OK. You set the properties of the marquee in the window for background, color, size, direction etc.
Setting Hyperlinks
Select the text and click “insert – hyperlink”,
(a) Creating links to other objects: Browse for the file from the file dialog box.
(b) Creating links within page : First create a bookmark, and select “insert – hyperlink” in the file
dialog select “bookmark” button and point to the bookmark you have created and click ok.
(c) Creating links to mails: Select the “email address” button at the lower left of the file dialogue
box and enter email address and subject which will appear automatically when clicked on it.
Picture hyperlinks with hotspots
Create hot spots and create hyperlinks to them. First insert an image. See that the picture
toolbar is available, else go to view – toolbars – picture. Select the rectangular tool/circle
tool etc from the extreme right of the picture toolbar. Click and drag on the image to
create a hot spot. You are prompted with the hyperlink dialog box. Create a hyperlink to
either image/web/bookmark etc. To create uneven diagram select polygon tool.
Tables
Creating Tables
Click “Table – insert – table” & select the no of columns and rows. If you want to adjust the
other properties like layout, borders, background, you can set in this dialog box.
Click “Table – draw table” and you are provided with a table toolbar for drawing table.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 224
Click “Table – Layout tables and cells” for templates on tables, which appear on the right side
of the pane.
Inserting Rows/Columns
Click”Table – rows & columns”, and select the columns/rows and select above/below selection for rows and left/right of selection option for columns.
Merging Rows/columns
Select cells and click “table- merge cells”
Splitting cells
Select cells and click “table – split cells” and select columns/rows and no of splits.
Inserting Caption
Select “table – insert – caption”
Formating text
Select the text and select the related tool from formatting toobar by clicking on icons for text
color, alignment, bold, italic, underline, font type and size etc. (OR) select from the format menu.
Formatting cells
For Cell text alignment, spanning, borders, and background click “table – table properties –
cell”.
Formatting Table
Click one of the cell and click “table – select – table”. Now click “table – table properties –
table”.
You can edit the table for alignment, cell padding, cell spacing, border size, color and background color/picture.
Inserting a Frame
Click New and select “more page templates” from the right side panel. Select the frame style
from the given options. Every frame comes up with two buttons
(a) Set Initial Page : click on this button if you want to set your desired html file for the frame.
(b) New Page : click on this button if you need to insert a new page for the frame.
Inserting inline frame
Inline frames can be placed anywhere inside a plain area they exactly like Text Area boxes.
Place the cursor and Click “insert – inline frame”. Click on the border and resize accordingly.
Editing Frames
For writing code for newly created pages for the frames, click inside the frame and click
“frames- open page in new window.” Start coding for the new page.
Splitting Frames
Place the cursor inside the frame which you want to split and click “frames – split frame” resize and set properties accordingly.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 225
Deleting Frames
Place the cursor inside the frame which has to be deleted and click “frames – delete frame”.
Setting Frame Properties
For setting the frame properties click inside the frame you want to set the properties and
click “frames – frame properties”. OR right click on the frame and select the “frame
properties”.
Setting Page properties
Click inside the frame and click “File – properties” OR right click on the frame and select
“page properties” and adjust the properties.
Using Navigation bars
For using a frame for navigation, use the left frame.
Targeting Frame
Select a text to hyperlink.
Click “target frame button”.
Select the frame.
Inserting audio/video files
Insert an image or text to connect to the video/audio. Create hyperlink by clicking “insert –
Hyperlink” or ctrl +K. Use the “screen tips” button on the top right cornor of the window, and type the message which will appear when the mouse is on the link. Point to
any video/audio file and click Ok.
Forms
Place the cursor and click “insert – form”. After inserting the form you are placed with two
buttons “submit” and “Reset” by default. The dotted line around the buttons specify the
borders for the form.
To insert the components, place the cursor first and click “insert – form” and select from the
available components.
Use tabs/spaces/enter to space and set the layout of the components.
Place the cursor and type the text wherever needed.
Use the format tools to modify the text color, size etc.
Click the component and resize by dragging with mouse.
Rt click on the component and select “form field properties” (OR) Select the component and click
“format – properties” (OR) click “Alt + Enter” to set the properties.
Creating Style Sheet
Click ”File – new” and select “text file” from the right panel.
To view the style toolbar, click “view – toolbars – style”.
Start creating style tags with style toolbar.
To save as css file click “file – save” and type the name of the file in first text box, and select “CSS
Files” option from the drop down menu of second text box. Click “ok”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 226
Creating style sheets from templates
Click “file – new” and select “More page templates” and select a template from the “Stye Sheets” tab
of the window.
Save it.
Styles for HTML tags using style tools
Place the cursor in the CSS file (go to “code view” if you are editing styles from html file) and
click “style” button in the style toolbar.
Select “html tags” in the bottom left under “list” pull down menu.
Click “New” button to create a new style and type the name of the tag in the “selector” text box.
Click “format” and select font/paragraph/border/numbering/position.
Set the dimensions and click “ok”.
Modify existing styles
Click “style” button on the style toolbar.
Click on the selector(tag) which you want to modify from the list of all available options under
“styles” on top left.
Click “modify” button and select options from “format” button at bottom left.
Creating CSS class styles with style tools
Place the cursor in the CSS file and select “style” button from the toolbar.
Select “user-defined styles” from the bottom left under “list” pull down menu.
Click “new” and type the selection(class name) in the text box on the top and select options from
the format at bottom left.
Linking CSS to HTML
In the html file in which you like to include the style sheets, click “format – style sheet links”.
In the window, click “Add” and browse for the style sheet file and click “ok”.
Use “move up” and “move down” buttons to adjust the preference of the files.
Click “edit” to edit the file.
Select the file from the list and click “remove”.
Dynamic HTML
Provides the mechanism that helps in changing the content & appearance of the page dynamically or at run time.
Click View – toolbars – DHTML effects.
For swapping image.
Insert an image click “insert – picture – from file” and browse for picture.
Click on Image, select “choose an event” tab on DHTML toolbar and select “mouse over”.
Select “Choose an effect” tab and select “swap picture”.
Select “choose settings” tab and select “choose image” and browse for another picture.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 227
After clicking ok. In the IE you find that the picture changes when the mouse is over the
image.
Change text
Insert some text. Highlight it.
Select “choose an event” and click “on mouse over”.
Select “choose an effect” and click “formatting”.
Select “choose settings” and select either format or border and set them, which would be
seen when the mouse is over the text.
How to publish
Click “File – Publish site”.
Click http://localhost/test in the remote web site location.
Select all files on the left tab and click on the right arrow in the middle. See that the files
appear on the right panel. click “Publish website” button.
Click on “view on remote website” to see the website.
1.
2.
3.
4.
5.
6.
1.
2.
3.
4.
5.
1.
2.
3.
4.
5.
1.
2.
3.
4.
To Make a New Folder
Select location where you want to make new folder.
Click on File Menu or Right Click
Click on New
Click on Folder
Then a new folder is created and type folder name.
Press Enter or click on free space.
To Delete a Folder
Select the folder which you want to delete.
Click on File Menu or Right Click then Click on Delete or Press Delete Key from keyboard.
Then a dialog box is displayed.
Click on Yes.
Then the folder is deleted.
To Restore Folder
Open Recycle Bin.
Select the folder or folders which you want to restore.
Click on File Menu or Right Click.
Click on Restore.
Then the folder is restored in original location.
To Rename Folder
Select the folder which you want to rename.
Click on File Menu or Right Click then Click on Rename or Press F2
Then type new name for folder.
Press Enter Key or Click on free space.
To Move (Cut) Folder
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 228
1.
2.
3.
4.
5.
1.
2.
3.
4.
5.
1.
2.
3.
4.
Select the folder which you want to move.
Click on Edit Menu or Right Click then Click on Cut or Press Ctrl + X.
Select location where you want to put cut items.
Click on Edit Menu or Right Click then Click on Paste or Press Ctrl + V.
Then the folder is moved.
To Copy Folder
Select the folder which you want to copy.
Click on Edit Menu or Right Click then Click on Copy or Press Ctrl + C.
Select location where you want to put copied items.
Click on Edit Menu or Right Click then Click on Paste or Press Ctrl + V.
Then the folder is moved.
To Change Desktop
Click on Start then Click on Setting then Click on Control Panel and then Click on Display or Right
Click on Desktop.
The Display Properties is displayed.
Click on Display then Select background from Backgrounds.
Then Click on Apply and Click on Ok.
WINDOW AS OPERATING SYSTEM (3 Days)
Fundamental of computer
Computer is an electronic device which processes data swiftly and accurately. It is a digital
device that works on 0/1 O is off and 1 is on. It works under set of instructions which is
also known as programs. Operating system is the intermediate between the machine
and the human interface. Software means the logical part of the system and hardware is
the physical components of the system. Computer is often used for speed, accuracy, and
storage capabilities.
Hardware components of computer
•
•
•
Input Device : keyboard, mouse, scanner, web camera etc
Output Device: Monitor, printer, speaker etc.
Processing Unit: Mother Board, Processor, Memory (RAM/ROM).
Types of Computers
•
•
•
Based on function: Analog Computer, Hybrid Computer, and Digital Computer.
Based on size: Mainframe computer, Mini computer, Micro computer.
Based on Brand : Microsoft, Apple
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 229
Booting
•
•
Booting is the process of loading the Operating System instructions into mainly memory
(RAM).
Cold Boot is the process of starting computer from OFF stage with Start button on CPU.
Warm Boot is the process of starting by pressing ‘restart’ button on the CPU.
Memory Measurement in Nibble, Bit, Byte, Kilo Byte, Mega Byte, Giga Byte, Tera Byte, Peta
Byte
C.P.U.
Input
Unit:
Keyb
Arithmetic
Logic
Control
Unit
Output
Un
it:
Primary Memory: RAM
Secondary Memory:
HDD, FDD, CD
Basic Components Of windows
•
•
•
•
•
•
The screen you see at the start of the computer is known as Desktop screen.
The screen has the “start” icon at the left bottom of the window which is the entry point for all
the window operations.
You have desktop shortcuts and files and folders along with “My computer”, “My Documents”,
“Recycle Bin”, “My Network Places” etc.
Shortcuts can been recognized by a small arrow at the left hand bottom of the icon, while
files/folders does not have these.
Radio buttons, Checkboxes, Drop down Selections, clicking menu with tick mark, text button,
text area, hyperlinks. “+/-” symbol beside a folder means expand and reduce.
A Window is generally set with Title Bar, Menu Bar, Vertical & Horizontal Scrolls, Ruler, Address
bar, Min, Max/cascade, and close buttons are on the right top corner. These icons on the top
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 230
•
•
•
•
•
•
•
•
•
right can be accessed by Alt+Space also. Explorer bar exits on the left side of the window screen
while the right half contains the details.
Can open as many windows as you feel necessary. This is called as multi-tasking.
The taskbar is the bottom of the screen. It has the ‘start’ button at the left side.
When Right Click clicked with the mouse on the taskbar you have options to select the toolbars
in the toolbar option. Which has Address bar, language bar, links, desktop, quick launch?
“Cascade windows” by right click of the mouse on the taskbar.
“The windows horizontally” option on Right Click fixes the windows horizontally to the window.
“The windows vertically” option on Right Click fixed the windows vertically to the window.
“Show desktop” will clear all the windows on the desktop screen by minimizing.
“Task Manager” will let you set the process, programs, id no’s and manage them.
“Properties” will let you set :
Lock the taskbar.
Auto-hide the taskbar.
Keep the taskbar on top of other windows.
Group similar taskbar buttons
Show quick launch
Show the clock in the notification area
Hide inactive icons in the notification area.
On the “Start Menu” tab it allows you to customize start menu.
You can switch between “classic menu” or “normal”
Core Window Tasks
•
Customizing your desktop
Display settings: Start – ctrl panel – display - settings OR Right click mouse – display modes
for resolutions.
Change the look of window elements: Start – ctrl panel – display – appearance – advance
button OR Right click - properties. Select the choice of window, buttons, etc from the pull
down menu and set the font etc.
Change your desktop fonts: On start – ctrl panel – display – “appearance” you have settings
for fonts as normal, large or larger fonts. On start – ctrl panel – display – settings – “advanced” you can set DPI for font.
Turn your monitor off automatically: Start – ctrl panel – power options – “power schemes”
tab you have “turn off monitor” option in which you can set the time for the monitor to
switch off.
Set “shutdown” and “standby”: start – ctrl panel – power options – “advanced” options
contains the settings for shutdown (ask, standby, shutdown) and standby (ask, standby,
shutdown).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 231
Set or change a screen saver: start – ctrl panel – display – screen saver tab OR Right click –
properties – screen saver. You can select a screen saver from the given options, you can
browse for new options, you can set the settings for the saver and have an preview of it.
Change your desktop theme: start – ctrl panel – display – themes OR Right click – properties
– themes. You can set a theme for the desktop. Themes affect the overall look of your
desktop, including the background, screen saver, icons, windows, mouse pointers, and
sounds. If more than one person uses a computer, each with his or her own user account,
each person can choose a different theme.
Rename a desktop icon: Right click on the icon and “rename” and type the name.
Put a shortcut on the desktop: click “my computer”. Select the item (file/folder), then press
the file menu and select “create shortcut”. You can also create by dragging the item to the
desktop region or any other visible place. When a shortcut is deleted the original file remains as it is.
Use a picture as a desktop background: when you are on the picture just Right click and select “set as desktop background” option. Alternately you can Right click on the desktop and
properties. Select desktop and browse the picture and press apply.
•
Customizing your start menu
Change the way all programs opens from the start menu: If you are on the normal start
menu, then Right click on the “start” button and select “properties”. Press “customize” button and check the “open submenus when I pause on them with my mouse” option to see
the “all programs” option on the start menu.
If you are on the classic menu style then on pressing “customize” option you have check
boxes against each option click if you need or clear if you don’t and press “apply”.
Change the start menu style: Right click on the start – properties and press “start menu”
tab and select the start menu/classic menu.
Show your most recently used documents on the start menu: For normal start menu,
Right click on the start – properties, press advanced and check “list my most recently
opened documents” options.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 232
MANAGING THE FILE/FOLDER
•
•
Windows Explorer
Opening Windows Explorer :
Click “start” => “Programs” => “Windows Explorer”.
Can use Win + E.
Windows Explorer consists of “Explorer Bar and “working Area”.
Windows Explorer displays the hierarchical structure of files, folders, and drives on your
computer. It also shows any network drives that have been mapped to drive letters on
your computer. Using Windows Explorer, you can copy, move, rename, and search for
files and folders. My Documents is a convenient place to store documents, graphics, or
other files you want to access quickly. You can also view My Network Places, which lists
other computers that are connected to your local area network (LAN). When you delete
files or folders from your hard disk, Windows places them in the Recycle Bin, where you
can retrieve them, until you empty the Recycle Bin. Files or folders deleted from a floppy disk or a network drive are permanently deleted and are not sent to the Recycle Bin.
Customizing Explorer bar
Explorer bar can contain Search (Ctrl + I), favorites(Ctrl + I), History(Ctrl + H), Folders. To select these options go to “view” menu and select “Explorer bar” and select your option
by clicking on it.
Customizing Working area
Thumbnail, Tiles, Icons, List, Details are the options available on the “view” menu.
Items can be sorting by Right clicking in the work area and selecting by “name, size, type,
modified”.
Mapping a drive/folder/computer: In the “tools” option go to “map network drive”.
Browse the folder/drive/comptr you want to map and press “finish”. Select the “synchronize” option in the “tools” menu for updating your given drive info timely.
Check the box for “reconnect at login” if you want to see the folder/drive every time you
longon.
If you desire to give the path by yourself follow “\\servername\sharename” syntax.
Change a name of file/folder : select the folder/file select “rename” from “file” menu (Alt +
F + M). OR Right click the mouse and press “rename”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 233
Copy a file/folder: Select the file/folder and press “copy” from “edit” menu. After navigating to the folder select “paste” from edit menu. OR Right click the mouse and select
“copy” and then “paste” to paste it.
•
•
•
Select multiple files:
Select the first file in the list and hold the “shift” key and use “← / ↑ / → / ↓” keys.
Select the first file in the list and hold the “shift” key and use press last file, if they are in order.
Select the first file, hold “Ctrl” key and click mouse by selecting each individual file, if they are
spread.
NOTE: When we select copy, the source file remains, but if we select cut, the source file is
moved from the original location.
Delete a file/folder : Select the files/folders you want to delete and press “delete” option in
the “file” menu.
Folder options overview :
Add or remove toolbar buttons in folder windows
Click “view” and select “toolbars”. You have Standard bar, Address bar, Links options in this. You
can also lock the toolbar.
Customize toolbar buttons
Select “view=>toolbars=>customize” to set the toolbar buttons. Window with left pane of available
buttons and right pane with current bar buttons, pops up. Select “add” to add to the right pane
and “Remove” to remove the buttons from the current bar buttons. You can also “Move up” or
“move down” to move the icons left or right to the bar.
Opening folder in its own window :
Click Start => Control Panel => Appearance and Themes => Folder Options. On the General tab, under Browse Folders, click “Open each folder in its own window”.
Goto “tools” => “folder options” and set “open each folder in its own window.
Setting for single/double click
Click “Tools=>folder options=>general tab” and select “sinlge click to open/double to open” option
to set the mouse to open the file in the windows explorer.
Select files types to open with certain program
Click “Tools=>folder options=>file types tab”. In this option you can select a program to open with
the given file extensions. Add new extensions and programs to the given list. Delete a certain
file type and change the existing file type/icon and other settings.
Move files by dragging
Ensure that the window to which you want to drag file/folder is visible and click right button
of mouse and drag to the window/desktop. You have the options of copy, move, create
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 234
shortcut. If you want to copy just hold on the ctrl button and then drag. If you are trying to move a program, a shortcut will be created. To do this you should have administrator logon.
Put a shortcut on the desktop
Ensure you see the desktop and drag by clicking right button of the mouse and selecting the
option “create shortcut”. If you delete the shortcut the original file exists.
Recycle bin overview
•
•
•
•
•
•
•
•
•
When you delete file/folders hard disk it is sent to Recycle Bin.
Recycle Bin icon shows empty/full.
Items deleted from a floppy disk or a network drive are permanently deleted.
Items in Recycle Bin can be recovered/deleted permanently.
When the bin fills up it keeps the latest files and deletes older ones as needed.
Remember to clean recycle bin when low in hard disk.
You can also restrict the size of the Recycle Bin to limit the amount of hard disk space it takes
up. To do this right click on the recycle bin and move the slider to change the limit.
Windows allocates one Recycle Bin for each partition/hard disk.
Larger file than Recycle Bin will not be saved but deleted.
CONTROL PANEL
•
Click “start=>control panel”. It has “classic view” and “category view”.
In Category view all the tasks are arranged according to the category.
In Classic view all icons are individually placed in the window.
Setup Internet connection
Click “Network and Inter connections => Setup or change internet connection”. You are
prompted with a Add and new buttons on the winodow. Just follow the wizard to setup
VPN, Dial, wireless connections and configure accordingly.
Change Windows Firewall Settings
You should be a computer administrator to set the firewall. You can set it on/off. You can
also have exceptions means allow some programs to run without firewall settings. You
can allow a computer on network to access your computer without firewall settings with
“advanced” options in this tab. You can also set error logins on your system for troble
shooting. You can also share the error logging with other systems on the network by
seting “Internet Control Message Protocol(ICMP).
Adding/Removing programs
Click “Add or Remove programs”. Select the program and press “Change/remove” button.
You can also add window components with the icons on the left side of the panel.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 235
Sound Schemes and Volume Controls
Click “Sounds, speech and Audio devices”. You can set the volume controls, Schemes for
windows, device drivers, etc.
•
•
•
Basic information about the computer
Click “performance and maintenance => See basic information about your computer”. Information about computer processor, OS, RAM etc.
Click “performance and maintenance => See basic information about your computer=> computer name” to change the computer name and join another domain.
Click “performance and maintenance => See basic information about your computer=> hardware => device manager” to change the drivers/hardware/ status/profiles.
Free space on the hard disk
Click “performance and maintenance => free up space on your hard disk” and follow the wizard to clear the unnecessary files on the hard disk. OR Click
“start=>programs=>accessories=>system tools=>disk clean up”.
Arrange files to run system faster
Click “performance and maintenance =>rearrange items on your hard disk to run programs
faster”. OR Click “start =>programs=>accessories=>system tools=>disk defragmenter”.
Manage Computer
Click “performance and maintenance => administrative tools” for managing the computer.
You have event viewer, .NET configuration, Services, Computer management, Data
sources, IIS server, performance, Security Policy etc.
Manage Printer/fax/keyboard/mouse
Click “printers and other hardware”. You can install by clicking “add a printer”. You can
view printers or fax printers already installed. Select “mouse” option for setting button
properties, click speed, Wheel options, Hardware adapters, and also set schemes for the
mouse actions.
Click “keyboard” for adjusting keyboard properties of “cursor blink rate”, character repeat
rate and delay. Also set the adaptor for hardware.
Manage user accounts
Click “user accounts” and select “create a new account” for creating new account. Click
“user accounts” and set passwords hard disk space etc.
Adjust date, time language and regional options
Click on “adjust date, time language and regional options” for setting date, time, language
and regional options.
Security Center
Adjust the internet settings, and automatic updates.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 236
PAINT BRUSH
Starting paintbrush
Click “start=>programs=>accessories=>paint” OR “Start=>run” and type mspaint.
Click “view” and select for Toolbox/color box/status bar, if they are not visible.
Exit Paintbrush
Click “File=>Exit” OR Ctrl + F4
Opening a File
Click “File=>Open” OR Ctrl + O.
Saving a File
Click “File=>Save” OR Ctrl + S.
Preview a File
Click “File=>Print Preview”. It shows how the file will look after the print on the page.
Print a File
Click “File=>Print” OR Ctrl + P
Page setup
Click “File =>page setup”. You can set margins, size of paper, source, etc.
Acquire an image from a scanner or a digital camera.
Select “File=> from scanner or camera => Get Pictures => Get picture”.
Draw a straight line
Click on the “line” tool and select the foreground color from the color box.
Click the lt key and keep it pressed and drag in any direction to draw a line. Line will be
drawn until you leave the key.
While dragging to draw the line hold on the “shift key” on keyboard to get a straight vertical,
horizontal or 45 deg angle.
If you desire to have background color of line use right click.
You can select the width of the line underneath the toolbox.
Fill an area with color
Create a closed circle or square etc. select the “painting brush” tool. Select the foreground
by lt click on the color you want and Right click for background color on the tool box.
To fill with the foreground color click lt key. And fill with background color click Right key.
If gaps exist select “view=>zoom” and complete the line.
Set a Paint picture as your desktop background
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 237
Click “file => set as background (tiled/centered)” When you select the tiled option the image is repeated along x axis and if you select centered the image is adjusted to the desktop.
Send an image using e-mail
Select “file => send” to send an email. You must have a email account and system configured to mail service.
Draw a curved line
Select the “curve line” tool and draw a line first and then at ¼ hold the line and move to one
side. Next hold at 1/3 part and drag to other side to draw a curve line. Only two curves
are possible. Lt click for foreground & Right click for background. You can select the
width of the tool underneath.
Draw a freeform line
Select the “pencil” tool and draw a line. You can move in any direction. When drag the
pointer foreground color is used if used with Right key of the mouse you will have the
background.
Draw a polygon(any no of sides)
First select the width of the line by selecting line tool and selecting width.
Draw the line (one side) and click the corners you want to draw continuity. Double click at
the end point.
If you are using lt key foreground color appears and Right key background color appears.
If you desire to draw only 45/90/180 deg angles use shift key.
Draw a rectangle or square
Select the width of the border line by selecting line/curve tool.
Drag the mouse to form the rectangle, diagonally.
You can select curved angles or sharp angles object in the tool box.
You can press “shift” to make a square.
You can click the color fill tool.
Foreground color appears as “fill in color” and border as background color, if you drag using
right key of mouse.
Foreground color appears as border color and background color as “fill in color” if you draw
using lt key of mouse.
Draw an ellipse or circle
Select the width of the border line by selecting line/curve tool.
Drag the mouse to form the circle/ellipse.
You can press “shift” to make a circle.
You can click the color fill tool.
Foreground color appears as “fill in color” and border as background color, if you drag using
right key of mouse.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 238
Foreground color appears as border color and background color as “fill in color” if you draw
using lt key of mouse.
Edit changes
Select “Edit=>undo” OR Ctrl + Z for undoing the changes. Three times it can be undone.
Select “Edit=>repeat” OR Ctrl + Y for redoing the changes. Three times it can be repeated.
Select “Edit=>cut” OR Ctrl+X for cutting the image.
Select “Edit=>Copy” OR Ctrl+C for copying the image.
Select “Edit=>paste” OR Ctrl+V for pasting.
Select the “select tool” from the tool box and drag on the area and press “Del” to delete.
Select “Edit =>select all” OR Ctrl + A for selecting the complete image and deleting.
Copy image from any program
Copying can be done from any programs viz word, excel, powerpoint, etc.
Paste from another location
Select “Edit => paste from” option for importing a image from another location.
Adjusting Canvas
Click on the canvas and hold down the “Blue points” at the corners and stretch the canvas if
needed.
Flip/ Rotate image
Select “Image=> Flip/Rotate” OR Ctrl + R.
Stretch/Skew the image
Click “Image=>Stretch/Skew” OR Ctrl + W
Invert Colors of image
Click “Image=>Invert Colors” OR Ctrl + I
Each color is replaced by its color complement. For example, red becomes cyan, and blue
becomes yellow.
Check the attributes of image
Click “Image=>Attributes” OR Ctrl + E
Clear image
Click “Image =>clear image” OR Ctrl + shift + N
Editing Colors
Click “Colors=>edit colors” for editing colors.
Zooming the image
Click “view=>zoom=> normal size/large size”. For normal you can use Ctrl + Pg up and large
size Ctrl + Pg Down.
You can also set to Custom size by using “custom size”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 239
Using Airbrush
Click on the airbrush tool press the key for painting with spray paint.
Lt key for foreground color and Right key for background color.
Writing Text
Select “A” text tool and select the area first to be written. Select the font, bold, Italic etc
from the text bar. If you don’t see the text bar Right click the mouse and click “Text
bar”.
Using Select Tool
Click on the Select tool “” from the tools bar and select the area by dragging on the canvas.
Using Eraser
Click the eraser on the tool box and erase by holding the lt mouse key and dragging. Set the
size of the eraser below.
RUNNING PROGRAMS/ APPLICATION FOLDER THROUGH SHORTCUT
Click “Start=>Run” and enter the command in the text area.
Ex : cmd for DOS prompt, mspaint for Paint, excel for MS Excel, msaccess for MS Access,
powerpnt for MS Power Point.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 240
MS WORD (10 Day)
Microsoft Word is a word processing software which is used in office, home, press etc.
Documents are saved with *.docx/doc.
How to load Word 2007
Go to “Start=>Programs=>Microsoft Office => Microsoft Word 2007.” OR “Start =>Run”
type winword and press ok.
Keyboard Navigation
There is “Quick Access toolbar” which is beside the Office button. You can customize your
frequently used buttons into this by Right clicking on the Icon and selecting “Add to
Quick Access Toolbar”.
Press F6 repeatedly to get the “Char” displayed on the icons. Which ever char you press,
you get that icon for use. Then press enter. Alternately you can also use “Tab” repeatedly to navigate to the necessary option in the ribbon.
If you desire to deactivate the Ribbon use Right click on any part of the ribbon and select
“Minimize ribbon”.
Create new blank document
Click “Office Button =>New=>create “
Save document file
Click “Office Button=>Save” OR Ctrl + S. Type the name in the text box and click OK.
You can save it in different formats like 2003 compliant with .doc, web page, XML page, txt
file etc.
You can also use “Save As” option for copying the same file. OR “F12”.
Using File Dialog Box
To go to the preview folder use Alt +1.
To go up by one level use Alt + 2.
To create a new folder in the current directory use Alt + $.
Give Security password for the docs.
Click “Office Button=>Save/Save As=>Tools=>General Options”
Type the file name in the text box. Type the password when the general options prompt
with window.
Print a doc
Click “Office button=>print/print preview”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 241
To Close your document
Click “Office button=>close” OR Alt + F4.
To copy your document
Click “Home=>copy Icon” OR Ctrl+C.
To cut your document
Click “Home tab=>cut Icon” OR Ctrl + X.
To paste your document
Click “Home tab=>paste Icon” OR Ctrl +V.
Create Cover Page
Click Insert tab and from the Pages tab select “Cover Page” icon and select a style. Write
the details in the place where its written “Text” by clicking in the place.
Inserting Blank Page
Click Insert tab and from Pages menu select “Blank Page”.
Inserting Page Break
Click Insert tab and from Pages menu select “Page Break” icon OR use “Ctrl+Enter”.
Page Setting and editing
Undo and redo the changes
Use “Ctrl + Z” to undo the changes done. Use “Ctrl + Y” to redo the changes done.
Formatting Text and Alignment
Change font Style
Click “Home Tab=>font”, select from the drop down list the font you desire ex : Arial, Calibri etc.
You can click on the home tab and select any of the Bold (Ctrl +B), Italic (Ctrl +I), Underline (Ctrl+U), Subscript(Ctrl+ “+”), Superscript (Ctrl + Shift + “ + “).
Press “Ctrl + D” OR Press the small arrow mark at the rt lower end of the tab to see the complete list of
formatting like shadow, emboss, etc. A small display area is also provided to see the affects you
cause to the characters.
Change font/background Color
Click “Home tab=>Font Icon”A” and set the color. For background or highlight use the “ab” labeled icon beside
it.
Change font Size
Click “Home Tab=>font”, select the desired size from the drop down list. You can also use the “small A”
to reduse or “Big A” to increase. Alternately you can also use “Ctrl +[“ to reduce the font size and
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 242
“Ctrl +]” to increase the font size. You can also use “Ctrl + Shift + <” for reducing the font and “Ctrl +
Shift + >” for increasing the font size.
Change spacing of the Font
Click “Home tab=>arrow on the rt lower corner=>select character spacing” set the desired space manually in the button provided or select one of the option from the drop down menu.
Alignment of the text
Select the desired text or place the cursor on the para which has to be aligned.
Press “Home tab =>Paragraph” and select from the icon representation.
You can use Ctrl+L for left align, Ctrl + R for right align, Ctrl + E for Centre alignment, Ctrl + J for justified.
Line Spacing
Click “home tab=>paragraph=>select the icon with opposite up and down arrow” Select from the available options of the list. You can even use Ctrl+1 for one line, Ctrl+2 for double line, and Ctrl +5 for
1.5 line spacing.
You can even add space before/after every paragraph you selected.
Bullet and Numbering, Border and Shading
Bullets
Click “Home tab=>paragraph=>select bullets icon”. You can select an option from the available bullets.
You can also press “Define Own Bullet” for defining own bullets as Picture, Symbol or font.
You can also rt click the mouse and select “bullets” and select the style of bullets.
Numbering
Click “Home tab=>paragraph=>select numbering icon”. You can select an option from the available
number formats. You can also press “Define Own Bullet” for defining own number format,
alignment.
You can also rt click the mouse and select “Numbering” and select the style of numbers format.
Lists
Click “Home tab=>paragraph=>select the list style icon”. You can select an option from the available
list style.
Change Case, Auto Text, Auto Correct, Column Text
Change Text Case
Click “Home Tab =>Font => Aa Button”. For changing the selected text to uppercase, lowercase, toggle
case etc.
Use “Alt+O+E" for changing the case to upper case chars, to Title Case, to Lower case, to Capitalize each
word, Toggle case.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 243
Auto Correct
Used to correct typos and misspelled words.
To insert symbols and other pieces of text.
You can modify the list that AutoCorrect uses by default.
Text included in hyperlinks is not automatically corrected.
Using AutoCorrect List Entries
Click “Office Button=>Word Options(at bottom)=>Proofing=>Auto Correct Options=>Auto Correct
Tab”.
Add Entry : Enter the text in “Replace” and new text in “With” text box. Click OK.
Replace Entry : Enter few chars in “Replace” and select the entry and click “Replace” button.
Delete Entry : Enter few chars in “Replace” and select the entry and click “Delete” button.
Using Math AutoCorrect
Click “Office Button=>Word Options(at bottom)=>Proofing=>Auto Correct Options=>Math Auto Correct Tab”.
Add Entry : Enter the text in “Replace” and new text in “With” text box. Click OK.
Replace Entry : Enter few chars in “Replace” and select the entry and click “Replace” button.
Delete Entry : Enter few chars in “Replace” and select the entry and click “Delete” button.
Auto Text
Click “Office Button=>Word Options(at bottom)=>Proofing=>Auto Correct Options=>Auto Format As you
Type”.
Check the concerned check box to apply and press OK.
Replace as you type
Replace Straight quotes with smart quotes (“”), fractions with symbols(1/2), ordinals (1st), Hyphens(--), Hyperlinks.
Apply as you type
Automatically apply bulleted lists, number lists, tables, borders etc as you type.
Automatically as you type
Apply styles of the previous sections automatically as you type.
Auto Correct
Auto correct is allows you to check the spellings and grammar mistakes in the text you type. All the
words you add/delete get effected in the main dictionary. The main dictionary remains the same for
all the office programs.
To start Autocorrect/Spelling & Grammar click “Review=>Proofing” and select the “Spelling & Grammar”
icon. You can also use F7 on keyboard.
Checking Spelling & Grammar/Auto Correct
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 244
The upper text area highlights the word which is not available in the dictionary.
The lower text area gives the suggestions for the given word.
Click “Ignore” to leave the word unchanged and click “Ignore All” for ignoring all the appearances of the
word in the entire file.
Click “Add to Dictionary” to include the given word as a new word to the dictionary.
Click “Change” to change the word for this time only.
Click “Change All” to change the word for all the occurrences in the entire file.
Click “Auto Correct” to correct with the suggested correction.
Configuring Spelling Checker
Enable AutoCorrect to use the main dictionary that the spelling checker uses :
To enable the autocorrect feature to use the main dictionary use this.
Click “Office Button=>word options=>Proofing=>AutoCorrect” and check the box “Automatically use
suggestions from the spelling checker”
Specify an AutoCorrect exception manually
To enable the autocorrect to overlook certain words like Company Name, Location name etc which is
not available in the dictionary, set the exceptions manually so that the dictionary overlooks these
words.
Click “Office Button=>word options=>Proofing=>AutoCorrect=>Exception=>Other Corrections” and type
the miss spelt word in the “Don’t Correct” box and click “Add” and OK.
Specify an exception automatically when you undo an AutoCorrect change
If AutoCorrect makes an unwanted correction when you are editing a document, you can undo it by
pressing CTRL+Z. You can also set up your program so that it automatically adds the word to the Exceptions list when you undo an AutoCorrect change. After you do this, AutoCorrect stops changing
that word.
Click “Office Button=>word options=>Proofing=>AutoCorrect=>Exception=>Other Corrections” and select “Automatically add words to list” check box.
Indentation, Header and Footer, Table
Increase/Decrease Indent
Click “home tab=>paragraph=> select either lt or rt indent icon.” Use Shift+Ctrl+M for left indent and
Use Ctrl+M for right indent.
Creating Headers/Footers
Click “Insert tab=>Header” for creating Header and select a style from the options. You can also remove
Header from the same options.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 245
You can also go to Edit Mode by pressing “edit Header” in the options. OR use Alt+V+H to toggle on/off.
Click “Insert tab=>Footer” for creating Footer and select a style from the options. You can also remove
Footer from the same options.
You can also go to Edit Mode by pressing “edit Footer” in the options. OR use Alt+V+H to toggle on/off.
Creating Tables
Click “Insert=>Table”.
(a) You can select the no of columns and rows from the boxes by dragging on them.
(b) You can select “Insert Table” options and type the no of columns and rows in the text fields.
(c) You can select “Draw Table” to literally draw the table with the mouse buttons.
Once you have selected to draw a table, draw a part of it and place the cursor/select the cells
and Click “Design” tab and under the “Draw borders” menu you have all the editing options
like changing the Pen color, Line weight, Draw table, and Eraser icons to work with.
You can also select “Quick Table” option to insert from the given templates.
You can also insert an excel sheet by selecting “Excel Spreadsheet”.
Editing Tables
All the tasks for table can be also accomplished with the Rt Click of the mouse after placing the cursor on
the cells.
Select or place the cursor on the table and Select “Design tab”.
Selecting Table/Cells/Columns/Rows
You can use normal blocking with shift and arrow keys OR After placing the cursor in the table Click
“Layout” button and press “Select” pull down menu to select the Cell/Row/Column/Table.
Headings
Check appropriate check box for Create Header Row, First Column, Total Row, Last Column, Banded
Rows, Banded Columns etc
Styles
Select the appropriate style from the “Table Styles” pull down menu.
Borders
Select “Borders” pull down menu for selecting the concerned border for lt, rt, centre, top, bottom,
diagonal etc.
Select “Borders” and select “borders and shading” for selecting the border line weight and line color.
Shading
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 246
Select “shading” pull down for selecting the shading for the columns selected with “theme colors,
standard colors, select new color by pressing “More Colors” and deselect by pressing “No Color”.
Text Alignment with Table
Select the cells/place cursor and click “Layout” Tab and from Table pane select “properties”. On the
“Table” pane you have the options to :Align Table: Align table with specific left indent/Align Centre/Align/Left/Align Right.
Wrap Text: Around the table or select “none” if you don’t want any wrapping.
Delete Columns/Rows/Cells/Table
Select the desired cells/rows/columns/table and Click “Layout=>Rows & Columns” and select Delete
option.
OR you can select cells and press “Alt+A+D+E”
Insert Columns/Rows/Cells/Table
Select the desired cells/rows/columns/table and Click “Layout=>Rows & Columns” and select desired icon for inserting cells/rows/columns/table.
Split/Merge Cells
Select the desired cells/rows/columns/table and Click “Layout=>Merge”.
For Merging Cells use “Merge Cells” OR “Alt+A+M”
For Splitting Cells use “Split Cells” OR “Alt + A + P”
For Splitting Table use “Split Table”.
Setting Size for Cells
Select the desired cells/rows/columns/table and click “Layout=>Cell Size”.
Select “Distribute rows” icon for distributing equally among the selected cells.
Select “Distribute columns” icon for distributing equally among the selected cells.
Select “Autofit” icon for fixing the contents to window/cell/contents.
Increase/Decrease the size of the cell independently by clicking points for cell height and width.
Text Alignment within Cells
Select the cells and Press “Layout=>Alignment menu”.
You can select the needed icon to align the contents of the cell Left Center/Top/Bottom, Right Center/Top/Bottm, Middle Center/Top/Bottom.
You can click the Text Direction button repeatedly to change the direction of the text within the cell.
Cell margins, spacing can set by clicking the “margins” icon on the Alignment menu.
Sorting Alphabetically/Numerically in Cells
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 247
Select the cells and Press “Layout=>Data menu” and select the sorting Icon after selecting the cells
of the table.
Converting Table to Text/Text to Table
Select the text you want to convert to Table and Click “Insert=>Convert text to table”.
Select the table to convert to text and click “Layout=>data” and select “convert to text” option.
Specify the separators for paragraph, page etc.
Picture, Word Art, Drawing Toolbar, Auto Shape
INSERTING PICTURE
To Insert picture from a file
Place the cursor where you want to place the picture
Click “Insert – Illustrations “ and select “Picture” icon. Browse from the file dialog box and click ok.
To Insert picture from a Web Page
Ensure that the picture you want to insert from web Is not a link, and drag the picture from the web
and place it in the word document.
If the picture in the web, which you want to copy is a link, place the cursor on the picture and rt click
and select copy. Place the cursor in the word and click paste with rt click again.
Formatting a picture in word
Insert Caption: Rt click on the picture and select “Insert Caption”.
Brightness : select the picture, Go to format tab, Adjust menu and select Brightness icon.
Select option.
Contrast: Select the picture, Go to format tab, Adjust menu and select Contrast icon. Select Option.
Recolor: Select the picture, Go to format tab, Adjust menu and select Recolor icon. Select
Option.
Change picture : Select the picture, Go to format tab, Adjust menu and select change Picture icon. Browse for the new
Reset Picture: At any point of time if you decide to go to the original settings of the picture,
go to format tab, Adjust menu and select “Reset Picture” icon.
Change Picture Style: Go to Format tab and select “Picture styles” menu and pull down the
menu for options of styles of pictures.
Set Borders for Picture: Go to Format tab, Picture Styles menu and select “Picture Border”
and choose one of the options for the border colors, styles, and weight of the border line.
Set Picture Effects: Go to Format tab, Picture Styles menu and select “Picture Effects”. You
have Presets, Shadow, Reflection, Glow, Soft Edges, Bevel and 3D Rotation.
Set Position of Picture within Text Select Format tab, Arrange menu and click on the “Position” icon for placing the picture as given in the options.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 248
Rotate Picture Select Format tab, Arrange menu and click on the two triangles icon. Select
the angle for rotation.
Text Wrapping Select Format tab, Arrange menu and click on the “Text Wrapping” icon to
wrap the text.
Setting Size of Picture Select Format tab, Size menu and select “Crop” icon and drag the
borders to set.
INSERTING CLIP ART
Select Insert tab and from “Illustrations menu” select “Clip Art” icon. Select from the given options the
one you need to insert.
INSERTING SHAPES
Select Inset menu and from “Illustrations menu select “Shapes”.
All the shapes are categorized into Lines, Basic Shapes, Block Arrow, Flow charts, Callouts, Stars and
Banners.
Recently used shapes are aligned on the top of all the choices.
Select the shape you desire and drag and place in the document.
Change Shape:
If you desire to change the shape at any point and to select another shape, select the one you
need from the Format tab and “Insert shapes” menu.
Shape Style:
Select Format tab and select “Shape Styles”. Pull down the menu for options and select one.
Shape Shadow effects(Shadow Style & Color):
Select Format tab, Shadow Effects menu and select Shadow Effects icon. You can select one of
the styles available. For shadow color select “shadow color” from the options.
Shape 3-D effects:
Select Format tab, 3-D Effects menu and select “3D Effects” icon and select one of the options
of 3-D effects.
For Setting color select the Color option in the drop down list. (Color palette)
For Setting Depth select the Depth option in the drop down list. (In points)
For Direction select the Direction option in the drop down list. (direction of shadow)
For lighting select the Lighting option in the drop down list. (direction of light)
For Surface select the Surface option in the drop down list. (matte, plastic, metal, wire frame)
Shape Rotation:
To rotate the shape select it, click “Format – 3-D Effects” and select the icon in which direction
you need to rotate and click repeatedly.
Shape Position:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 249
To position the shape in the document Select Format and from the Arrange menu select the
icon “Position” and click on one of the options available.
Wrapping Text:
To wrap text along the shape click Format – Arrange menu – Text Wrapping icon and select one
of the options.
Bring shape into front/back:
To take the shape in front/back of the text Select “Bring to Front” or “Send to Back” icons from
the Arrange menu in the Format tab.
Rotate Shape:
Click Format – Arrange Menu – select the icon with two triangles, and click on it for selecting the
angle.
INSERT SMART ART
Place the cursor on the document and Click “Insert” menu and select SmartArt icon from the Illustrations menu.
Select the shape you need from the list of options of List, Hierarchy, Cycle, Relationships, Process,
Matrix and Paramid.
Icons are placed in one pane and the other contains the text pane.
If you don’t see the text pane click the “left/right” button on the left centre edge of the graphic.
Heading and labels can be typed in the text pane where “text” is written.
If you increase the headings and labels the graphics also will be modified accordingly.
While selecting you can choose a single graphic item or multiple items for changing/editing. Use
shift key and mouse.
Adding more Shapes:
From the Design tab select “Add Shape” from the “create Graphic” menu. Add after or before the present graphic icon.
Demote/Promote Shapes :
Select the label to make it heading and click Design – Create Graphic – Promote.
Select the label to make it heading and click Design – Create Graphic – Demote.
Move Graphic icon Left/Right :
Select the label to move, Click Design – Create Graphic - “Right to Left”/Left to Right.
View Text Pane :
Select Design – Create Graphic – Text Pane. You can see the connected text pane of the
graphic object.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 250
Select a Layout :
At any point of time you can select another layout by clicking “Design – Layouts” and select
the one you need from the pull down menu options. The text and Heading fields will adjust accordingly.
Change Colors of the Graphic shape:
Select “Design and from the Smart Art Styles select the “Change Colors” icon. Select the
color you need from the option.
Change Style of the select Graphic:
Select Design – Smart Art Styles” select the 3D design you need from the drop down menu
options.
Reset to Original Settings :
Select Design – Reset, and press the icon “Reset Graphic”. All the settings are done to original object.
Resize Single/More Graphic :
Select Format – Shapes and press on “Larger” icon to make the selected single/more Graphic items bigger.
Select Format – Shapes and press on “Smaller” icon to make the selected single/more
Graphic items smaller.
Graphic Styles/Fill/Outline/3D :
Select “Format – Shape Styles – Pull down the menu for styles and select one.
Select “Format – Shape Styles – Shape Fill” for filling the select Graphic Object. You have pictures, textures etc.
Select “Format – shape styles – Shape Effects” for 3D graphic objects. You have Presets,
Shadow, Reflection, Glow, Soft Edges, 3D rotation.
Select “Format – shape styles – Shape Outline” for border outlines. You have colors of lines,
weight and styles.
WordArt/Text styles for Graphic items :
Select Format – WordArt Styles – and pull down the menu for different word styles and select one.
Select Format – Word Art Styles – Text Fill” for filling the words with colors, picture, gradient, texture.
Select Format – Word Art Styles – Text Outline” for Text outline color, weight, and styles of
dashes.
Select Format – Word Art Styles – Text Effects” for Text shadow, reflection, 3D effects, Glow,
and different shapes of text to appear on the graphic object.
Positioning with text/wrapping with text and rotating the text :
Select the object and click Format tab and in Arrange menu select “Bring to Front” option to
bring the object into front of the text.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 251
Select the object and click format tab and in Arrange menu select “Sent to Back” option to
send the object behind the text.
Select the object and click format tab and in Arrange menu select “position” to position the
object within the provided space.
Select Format tab, in the Arrange menu select “Text Wrapping” option to wrap the text
up/down/top/below etc.
Select Format tab, in the Arrange menu select “Rotate” option to rotate the object and select an angle for rotation.
INSERT CHART
Place the cursor in the document and click Insert tab and under illustrations menu click on
the “Chart” icon. Select from the given option for the type of chart to be placed.
You will be promted with the sample data from MS Excel sheet. You can fill the real data into cells as required. If you wish to increase columns or rows just hold the right lower
corner of the data sheet border and drag.
As you fill the data into the cells and press enter. The chart graph will be automatically incorporated with data.
For Designing, changing layout and format you have three menus. Click on the chart item
and you can see the following Menus.
(a) DESIGN.
For doing the following select the graphic image first.
Changing Chart: click on the “Change Chart Type” icon in the Type menu. From the listed out
options click the one you need.
Save Chart as Template: Click on the “Save As Template” Icon in the Type menu. You will be
prompted with a file dialog box to save the template. Give a name and save it.
Switching Rows/Columns: Click on the “Switch Row/Column” icon to change rows into columns
or vise versa. If the option is not available in the graphic format the option is deactivated.
Selecting Data from Excel: Click on the Select Data icon in the Data menu. You can select the
data rows, edit them or add additional rows or colomns and edit the data as required.
Editing Data of Excel: click on the Edit Data icon in the Data menu. You are prompted with the
cells in the data sheet for editing. The graph is updated as you edit the cells. Select the Refresh
Data icon from Data menu if you cut and paste some data from other sources.
Selecting Layout: Click on the Chart layouts menu pull down menu and select the one you need.
Selecting Styles : Click on the Chart Styles pull down menu for the options of styles and select
one from it.
(b) LAYOUT
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 252
Formatting Individual Graphic Item: Select the item first and select an object from the pull
down menu which is under the menu “Current Selection”, like floor, chart area, plot area etc.
Then click on the Format Selection icon from the “current Selection” menu. Do the modifications as needed.
Revert back to original settings: Select the “Reset to Match Style” button in the Current Selection menu. All formats are set to the original settings of windows.
Inserting Picture, shape, Text box into Chart: To insert a picture select Picture icon from the Insert tab, you will be prompted with a file dialog box. Browse from folders and select the one
you need. To insert a shape click on the Shapes icon in the Insert tab and select a item from the
options and drag on the place you want to put it. For Drawing a text box select the Draw Text
Box icon from the Insert tab and click on the area you want to place the text by dragging. And
write in the box.
Inserting Title: Click on the Chart Title pull down icon in the Labels menu. Select the option for
positioning the title on the graph item. Select and change the title text.
Inserting Axis titles: Click on the Axis Titles pull down icon in the Labels menu. Select the Horizontal axis, Vertical Axis or Depth Axis title. X, Y or Depth of graphic item.
Inserting Legends: Click on the Legend icon from the labels. Select the legend position from the
given options and set the legends. Rep of data.
Inserting Labels in the Graph: Click on the Data labels icon from the Labels menu. And edit in
the box provided.
Inserting Data Tables: If you wish to provide the data on the chart, click on the Data Table pull
down menu from the Labels menu and select the option available. If you desire to edit data you
have to go to Data menu in Design tab only.
Trend lines and analysis: For showing the trends and change points select the icon needed
from the analysis menu and select the options.
(c) FORMAT
Select Individual Shape Styles: Select Shape Styles pull down menu and select one of the styles
of the graphic item. To fill the selected shape use the Fill icon in the shape styles menu. And select from the colors, texture etc. To change the border color of the shape select the border icon
from the shape styles menu. Select the color, its weight, and style. If you desire to give 3D effects to the shape select the 3D icon and select the styles, shapes, lights, etc.
Changing the Text for the shapes: Select “WordArt Styles” menu and select the icon for “Text
colors”. You can fill the text with colors, gradients, texture and picture. For changing the border line select the “Line Color” icon from the WordArt Styles” . You can change the color of the
border color, weight, and style of the line. Select the icon for predefined styles in the same
menu. You can select 3D effects for the text.
Text Positioning, Wrapping, rotating: Select the “Position” icon from the “Arrange” menu and
click on one of the options available to place the text. Select the “Text Wrapping” icon for
wrapping the text around the graphic object. Select the Rotate Icon for rotating the object.
Find and Replace Sentence, Spelling and Grammar, Thesaurus
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 253
Find a word :
Click on the Home tab and select Find from the “Editing” menu. Click on the Find menu (OR Ctrl+F).
Type a word in the text box provided to find the word. To see the search options click on the “More” button.
You have options of (a) Match case (b) Find whole words only (c) Use wildcards (d) Sounds like (English),
(e)Find all word forms(English), (f) Match prefix, (g) Math suffix (h) Ignore punctuation chars (i) Ignore white space chars.
Finding styles, frames, etc
Click on the Home tab – Editing – Find – Find- More – Format. You can find font styles, paragraph styles,
language, menus, frames etc just by selecting the one you need.
Finding Special Chars
Click on the Home tab – Editing – Find – Find – More – Special. You can find menus, spaces, section
break, page break etc. Just select the one you need from the available options.
Finding and Replacing
Click on the Home tab – Editing – Replace. You can find the same options for finding text in one text box
while another text box is provided to enter the text/special char to be replaced with.
Place the cursor in “Find What” text box.
Select the text style from the available options by check marking the box.
Select formatting from the “Format” button and special chars from “Special” Button.
Now place the cursor in the “Replace with” box and select the text options with check
box/Format/Special.
Select Replace for the occurrence of the word/char.
If you like to replace the entire document with all such selections then select “Replace All” button.
If you like to select one by one occurrence and replace them manually, select “Find Next” button.
Press Cancel button at any point if you decide to quit.
Navigating to the Page/Section.
Select “Home tab – Editing – find – Goto. Select the page no/section no etc from the list and click ok.
(Ctrl+G).
Working with Table of Contents (Style of text of different levels in a table)
Insert Table of Contents:
Click References tab – Table of Contents Menu – click on the icon Table of Contents. Select a style from
the predefined styles. The text is placed in a table and a style is defined by the predefined styles.
You can replace the given text with the one you need inside the table.
Inserting text in Table of Contents:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 254
To insert Text at different levels (level 1, level 2, level 3), place the cursor in the table, Click on the “Add
Text” icon in the Table of Contents tab and select the level of text you need and type the text in the
table.
If you directly type the text in the table click on the “update table” icon to update the styles.
Removing Table of Contents
You can remove by selecting the table and clicking on the “Table of Contents” pull down menu and selecting “Remove table of contents” option.
Saving Table of Contents into Gallery
Select the table and click on the pull down menu of Table of Contents menu. And select “Save selection
to table of contents Gallery” option.
Working with Footnotes (Expressed in between words with superscript and explained in detail at bottom)
Inserting a Footnote
Place the cursor at the word which you like to explain in detail. Click on the “References” menu and select “Insert Footnote” from “Footnotes” menu. A number with superscript is specified after the
word selected and at the bottom of the page, the corresponding number is placed and cursor waits
for your explanation of the word. Enter text.
Navigating Footnotes
When you need to go to next footnote, click “Next Footnote” icon in the “footnotes” menu.
By clicking on the “Show Notes” you will be able to toggle between the notes and the word.
Inserting Endnote
End notes are placed at the end of the document. The procedure for placing End Notes is same as Footnotes.
Inserting a Cover Page in Doc
Cover page is the first page of the document which gives details of the project written in MS word.
Click “Insert – Pages menu – Cover Page icon”. Select a style from the options and enter text in the columns provided.
To remove cover page, click “Insert – Pages Menu – Cover page – Remove current cover page”.
Inserting Hyperlink
Hyperlink, when pressed on it will take you to the linked document/web site etc.
Click “Insert tab – Links Menu – Hyperlink Icon” and from the folder dialogue box enter the file/site you
want to go to. A link will appear at the cursor in red color. To navigate to the link hold Ctrl key and
click on it. To remove the link select it and press del.
You can also select a word and then link it. For removing this link rt click on the link and select “remove
link” option.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 255
Working with Bookmarks and cross References.
Bookmark is a place in the document which you want to mark to read later or connect/link to another
bookmark.
You can view all the marks in one window so that you can select the one you want to go to.
When two Book marks are linked then it is “Cross Reference”. Book marks and cross reference are
placed in square brackets.
To see the bookmarks “Click Office Button – Word Options – Advanced – under Show Document Content pane check mark the box for “show bookmarks”.
Create Book Mark : Place the cursor on the word or place and click “Insert tab - Link Menu – Bookmark
Icon”. You can give a name to it like First, Sec1 etc. and click “Add”.
To go to bookmark “Click Insert tab – Links Menu – Bookmark Icon” and click on the bookmark you want
to go in the text area and click “Go to”.
Remove Book Mark: “Click Insert tab – Links Menu – Bookmark Icon”. Select the bookmark you want to
remove and click on “Delete”.
Create Cross Reference
Creating link between two bookmarks/footnote/endnote etc.
First place the cursor on the bookmark you want to link with and click “Insert tab – Links Menu – Cross
Reference Icon”. Select the type of link in the Reference column (bookmar/footnote/endnote) and
select from the existing bookmark etc, and click insert.
To go to the links click on the Bookmark icon from the Links Menu of Insert tab.
Inserting Text Box
Text box is a box type object to write text in it.
Place the cursor in Document. Click “Insert Menu – Text Menu – Text Box Icon”. Select from the predefined types and click. If you desire to have a simple Text box of your own size/choice, select “Draw
Text Box” icon from the Text Box icon of Text Menu.
Formatting Text Box: Select the text box first. Click on the Format tab,
In Text Menu
(a) “Draw a text box” icon for drawing a new text box.
(b) “Text Direction” icon for changing the text direction in the box.
(c) “Create Link” icon for creating link to another object.
Text Box Styles Menu
(a) Styles pull down menu for selecting from the predefined styles.
(b) “Shape Fill” icon for filling the shape of the text box.
(c) “Shape Outline” for creating a border of the text box.
(d) “Change shape” for changing the given box.
Shadow Effects Menu
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 256
(a) “Shadow Effects” icon for shadow styles and colors.
(b) Direction icons(← / ↑ / → / ↓) for moving the shadow of the box in four direcgons.
3D Effects
(a) 3D Effects icon for setting predefined styles, color, depth, direction, lighting and surface
(b) Styles pull down menu for rotating the text box.
Arrange
(a) Position icon for positioning the text box in the document.
(b) Text wrapping icon for wrapping text around the text box.
(c) Rotate icon for rotating the box.
(d) Align icon for aligning the box.
Size
For setting the sizes of the text box visibility.
Dropping a Big Capital char before para.
Click “Insert tab – Text Menu – Drop Cap Icon”, after placing the cursor on the paragraph.
Inserting Quick parts
Click “Insert tab – Text Menu - Quick parts”, for inserting document properties like author,
comments, company , field, etc.
Inserting Date &Time
Place the cursor on the doc and Click “Insert tab – Text menu – Date & Time” and select the
option by clicking on it.
Inserting Signature line
Place the cursor on the doc and click “Insert tab – Text Menu – Signature Line” and press
OK. Enter the text in the pop up window with Name, Designation, etc and press OK.
Inserting Object
Place the cursor on the doc and click “Insert tab – Text Menu – Object icon” and select “object” or “text from file” options and click on them for placing them.
Inserting Equation
This is a set of predefined equations for helping inserting mathematical equations with ease
into word document.
Special Menu appears for formatting the mathematical equations.
WORD ART
word art is a style of text which can be formatted as you desire.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 257
Place the cursor in the doc and Click on the “Insert tab – Text Menu – Word Art Icon”. A
window with text area pops up. Enter the text in the text area box and click ok.
You can drag the text to make it big or small by holding the corners.
Formatting WordArt
Click on the “format tab” options are as follows: Text Menu
(a) Edit Text Icon for editing the already entered text.
(b) Spacing for setting the spacing between the letters.
(c) Alignment icon for aligning the text left/right/centre etc.
(d) Abc (direction) icon for making the text vertical/horizontal.
(e) Aa (height) icon for setting the letters height equally.
Word Art Styles
(a) Pull down menu for setting the various styles of the wordart text.
(b) Fill icon for filling the text with color, texture, picture, radiance etc.
(c) Border Line icon for setting the border line with weight, color, style etc.
(d) Curves and styles of text icon for setting the curvature of the text style.
Shadow Effects
(a) Shadow Effect icon for different shadow styles and colors of shadows.
(b) Direction icons for setting the shadow of the word art text.
3-D Effect
(a) 3-D Effects icon is a pull down menu for 3D Colors, Depth, direction, lighting, surface, and
secondly for setting the rotation of the text in four directions.
Arrange
(a) Position for setting the text position within the page, it is predefined layouts
(b) Text Wrapping icon for wrapping text around the Word Art.
(c) Align icon for aligning the text.
(d) Group icon for grouping all the objects so that the setting is not disturbed.
(e) Rotate icon for rotating the text in angle.
Size menu is for setting the size of the Word Art text.
Setting Page layout, background and paragraph
Setting Margins for Page
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 258
Click “Page layout tab – Page Setup Menu – Margins Icon”. Select a margin set up from the
predefined layouts or press “Custom Settings” for setting the Top/Bottom/Left/Right
margins.
Setting Orientation
Click “Page layout tab – Page Setup Menu – Orientation Icon”, for changing the orientation
to Landscape or Portrait.
Setting Columns for text
Click “page layout tab – Page Setup Menu – columns”, for setting multiple columns for the
text to appear. You can set as many as you need.
Applying page, para, section breaks
Click “Page layout tab – Page Setup Menu – Breaks icon” for pull down menu of page, column, text wrapping, sections breaks and even page and odd page settings. Click on the
type of break you need.
Applying Line Numbers
Click “Page layout tab – Page Setup Menu – Line Numbers Icon” for pull down menu of options with line numbers for continuous, start each page, start each section. Select “suppress for current page” option for suppression of numbers for the select page( place the
cursor in the page you want to suppress).
Click “Line Number options” for setting the line number formats.
Applying Hyphenation
Click “Page Layout – Page Setup menu – Hyphenation icon” for pull down menu for options
with manual and automatic hyphenation. For setting the hyphenation options click on
the Hyphenation Options.
Water marking page
Water mark is a light text/picture which is at the background of the page.
Click “page layout tab – page background menu – watermark icon” for pull down menu of
predefined styles. You can also select “custom Watermark” for water marking as you
desire with text/picture.
You can save to gallery by clicking “Save selection to watermark gallery”.
You can remove by selecting “remove water mark” option in the pull down menu.
Setting page colors
Click “Page layout tab – Page Background menu – Page Color icon” for pull down menu of
page predefined colors, standard colors and fill effects for the background.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 259
Setting page Borders
Click “Page layout tab – Page Background menu – Page Borders icon” for pull down menu of
page border options window. Select the style, width, and color of the border needed.
Working with Bibiography
While writing a document, especially for research you need to refer to different books, cites
and sources.
To place all the references at one place, we use Bibliography, which is a list of references at
the end of the document. Use citation for placing references at end of sentences. You
can manage your sources. You can also search for bibliography of system.
Inserting Citation
Place the cursor at the end of the sentence and Click References – under Citations & Bibliography menu click on the Insert Citation and enter the details. If you wish to add placeholder(name ) and then add the sources later press “Add new placeholder”. Later you
can click on the placeholder and add source.
Inserting Bibliography
Place the cursor at the end of the document and click “References – under Citations & Bibliography menu click on “Bibliography” and add a style.
Listing all citations of the system.
Click on References – under Citations & Bibliography menu click on “manage sources”. You
can just add the ref into current document.
Working with Table of Figures
Table of contents is a list of all the figures in the document, generally its listed at the end of
the document.
Click on the figure/picture and click “References – Captions menu – Insert Caption.
Place the cursor at the document and click “References – Captions menu – Insert table of
figures.
Click on the table of figures ref while holding the ctrl key, to go to the picture.
You can also make a cross reference by clicking on the picture and selecting “Cross – reference”. You have enter the link as a figure and click ok.
Working with index
Index is a alphabetical ordering of words generally placed at the beginning of the document.
Highlight the word and click “References – under Index menu press Mark Entry.
In this way mark few entries.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 260
Place the cursor at the place, generally at the beginning or ending of the document, click
References – Index – click Insert Index. Then click update Index if needed. You can see
the words/headings placed in an alphabetical order.
MAIL MERGE
Mail merge is used to send same letter to many people with different addresses and related
fields.
A data base of list of names and addresses etc is used to connect to the letter/envelope/labels.
You are allowed to sort, filter, and set queries from the database and even select individual
names/addresses to send the mails/letters etc.
One way is to follow the “Step by Step wizard” offered by the office 2007. For doing this
click “Mailings – and under Start Mail Merge menu click on “Start Mail Merge” icon and
select “step by step mail merge wizard. Before starting enter data by clicking on “Type
new List” from Select Recipients pull down menu.
Creating Envelopes Individually
Click “Mailings tab – Create Menu – Envelopes Icon”.
Step 1:
Type address for delivery in “Delivery Address” text area. Type “from Address” in the “Return Address” text area.
Step 2 :
Select the size of the envelope, Delivery address font and Return Address font by clicking
”Options Button – on “Envelop Options” menu.
Step 3 :
Select the Feeding sources, Face up/down by clicking “Options Button” on “Printing Options” menu.
Click on “Add to Document” to view the envelope in the document style.
Creating Labels Individually
Click “Mailings tab – Create Menu – Labels Icon”.
Step 1, 2, 3 remain the same.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 261
Adding Comments
First select the word/phrase to be commented out. Click on Review tab – under Comments
Menu select “New Comment”. Repeat whenever you need to comment out the
word/phrase.
To go to the previous comment click on “Previous” on Comments menu.
To go to the Next comment click on “Next” on Comments menu.
Track changes
Tracking changes is a concept of knowing the latest corrections made in the given document. When a document is drafted by an author it goes for editing to other senior/author etc. For enabling changes made to the document to be visible we use this
track changes.
Before starting editing a document first start the tracker. To do this Click “Review tab –
Tracking Menu – Track changes Icon”.
Start making the changes one by one. You can change tracking options like colors etc by
clicking on Track changes Icon of Tracking Menu and select “Change Tracking options”
option. Select your desired options from the list. You can also change the user name by
clicking “Track Changes” and selecting “change user name”. then enter the author
name.
You can have vertical/horizontal Revisions pane which appear on left side. Changes and author are given side by side.
Now go to the first change. You can Click “Accept” on Changes Menu to accept the given
change.
You can click “Reject” to reject the given change. For navigation use “Previous” and “Next”
buttons.
Comparing Documents
This feature is generally meant for knowing the changes made to any original documents.
First create a document type some matter in the document and save it as a file.
Secondly open the same document and make some changes and “Save As” (ie copy) the file.
Click “Review tab – Compare Menu – Compare Icon. Enter the first document as the original
file and second document as the one which you copied and modified. Press ok.
A new window will be opened showing in balloons the changes you made to the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 262
Protecting a Document
You can restrict Access or stop others from formatting and editing the document with this
option.
Click “Review tab – Protect menu – Protect Document Icon”.
Click on “Restrict formatting and editing” option for restriction of formatting/editing.
Click on “Restricted Access” for restricting access to the document.
For performing all these tasks Information Restriction Management (IRM) should be installed in the MS Office.
Document Viewing Layouts
Same document can be viewed in different view styles. Click View tab and under Document
views
Click “Print layout” icon for print layout.
Click “Full Screen Reading” icon for full screen layout.
Click “Web Layout” icon for web style viewing .
Click “Outline” icon for Outline view. Click “close Outline view” icon to close it.
Click “Draft” icon for draft style viewing.
Click View tab – Show/Hide Menu and select “Ruler” for viewing ruler.
Select Gridlines for seeing the gridlines.
Select Document Map for displaying details of the document on the lt pane.
Select Tumbnails for seeing pages as icon on the left pane.
Zooming Page view
You can zoom the given document at desired size, fit to page, two pages at a time etc.
Click on View tab – Zoom Menu – and select the desired icon.
Arranging windows
Creating different windows of the same document to view different sections.
Click “view tab – Window Menu “.
Select “New Window” for opening a new window of the same document.
Select “Arrange All” to tile all the programs of windows side by side.
Select “Split” to split the current window into two windows and cascading.
To navigate to different open windows Click View tab – Windows Menu – Switch Windows”
and select the window you want to go to.
Macros
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 263
Macros are used to do a certain job, which we may require to do repeatedly like creating a
text box, tables, styles etc.
Click on the “View tab – Macro Menu “ and select “record macro”. Click on Keyboard and
set shortcut key and assign. Click on Stop Recording for stopping the macro.
Use the key combination for repeating the task.
Click on the “View tab – Macro Menu “ and select “record macro”. Click on mouse under
“Customize Quick Access toolbar” select the document to be in effect. Choose commands from dialog box and click add and OK. Then stop recording by clicking “stop recording”.
Click on the macro button on quick access to check the macro.
MS EXCEL (10 Days)
By default, Microsoft Office Excel provides three worksheets (worksheet: The primary document that you use in Excel to store and work with data. Also called a spreadsheet. A
worksheet consists of cells that are organized into columns and rows; a worksheet is always stored in a workbook.) in a workbook, but you can insert additional worksheets.
Managing The Work-Sheet
Inserting A Worksheet
At the bottom where you see sheet1/sheet2/sheet3, you have folder like button, just click the button to insert a new sheet at the end of the current sheets.
For inserting before a given sheet click “Home tab – Cells Menu – Insert Icon” and select Insert Sheet
from the pull down menu.
For inserting more than one sheets, hold the shift key and select the number of sheets from the
sheets menu below and click ““Home tab – Cells Menu – Insert Icon” and select Insert Sheet from
the pull down menu.
For Inserting Chart, Macro etc right click on the sheet icon at the bottom and select “Insert” and select the desired sheet/chart/macro etc.
Renaming a Worksheet
Click on the sheet you desire to rename and rt click on it and select “Rename” option and
enter the new name.
Deleting a Worksheet
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 264
Click on the sheet you desire to delete and rt click on it and select “Delete” option.
Alternately you can also click “Home tab – Cells Menu – Delete icon” and select “delete
sheet” from the pull down menu.
Changing Font & Size
Click on “Home tab – Font Menu” and select Font style and size from the options.
Bold/Underline/Italic buttons are also provided to change the font style.
Small and Big A/A are provided for increasing and decreasing the size of the font size.
Creating Borders for cells
Select the cells from the sheet and click “Home tab – Font Menu” and from the Grids Icon
select the Lt/Rt/Top/Bottom or middle grids to be displayed. You can also set the
weight/style/Color of the line by select the “more borders” option from the pull down
menu of Grids icon.
Creating background colors for Selection
First select the cells you want to paint with background color and click “Home tab – Font
Menu” and click on the background color Icon and select the color you need.
Text color
First select the cells you want to paint with background color and click “Home tab – Font
Menu” and click on the Text color Icon and select the color you need.
Hiding and Un-hiding Columns
First block the columns/cells with the help of the holding the shift key and using arrow keys
(← / ↑ / → / ↓).
Then Click “Home tab – Cells Menu – Format Icon” from the pull down menu under “Visibility” select “Hide & Unhide” option. Now select “Hide Columns/Hide Rows” as desired.
For Un-hiding columns block the columns/rows adjacent to the hidden ones, and click
“Home Menu – Cells Menu – Foramat icon” from the pull down menu select “Hide &
Unhide” option and select “unhide Coloumns/Rows” as needed.
Hiding and un-Hiding Sheets
Select the Sheet(s) from the bottom sheet list and click “Home tab – Cells Menu – Format
Icon”, from the pulldown menu select “Hide & Unhide” option and click “Hide sheet”.
OR Rt click on the sheet and select “hide” option.
For Un-hiding sheets click “Home tab – Cells Menu – Format Icon”, from the pulldown menu
select “Hide & Unhide” option and click “Un-hide sheet”. OR Rt click on any sheet and
at the bottom and select “unhide”.
Changing Default Font or size for new worksheets
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 265
1.
2.
Click the Microsoft Office Button
, and then click Excel Options.
In the Personalize category, under When creating new workbooks, click a font in the Use this
font box, and then specify a font size in the Font Size box.
Freeze or lock rows and columns
Freezing : Making a Column/Row static so that they don’t move.
If you want to see the heading of the column while scrolling down to rows far below then
freeze the Top row containing heading.
If you want to see the Left column containing information while scrolling towards far right
freeze Left column.
First place the cursor at the cell from which left and above columns are to be freezed and
click “View tab Windows Menu – Freeze Panes”, and select Freeze Top Row for freezing
rows and select Freeze Left Column for freezing column. If you desire to freeze both
columns and rows select “Freeze Panes”.
To unfreeze click “View tab – Window Menu – Freeze Panes Icon”, and select the option to
unfreeze.
Split panes to lock rows/columns
1.
To split panes, point to the split box at the top of the vertical scroll bar or at the right end of
the horizontal scroll bar.
2.
When the pointer changes to a split pointer or , drag the split box down or to the left to
the position that you want.
To remove the split, double-click any part of the split bar that divides the panes.
3.
Inserting formulas
While inserting formulas you have to use “ = ” sign before entering the formula. There are
several in-build formulas in Excel, like Sum (adds the cell range), Average(gives average
of the cell range), min(gives the min value out of the range), max(gives max value of the
range) , acos(gives arc cosine of the given cell/value). Range is specified by giving a “ : “
symbol between first and last. Cells should be in line or in diagonal position.
Copying and Pasting Cells
Select the cells you want to copy first by blocking them with shift key.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 266
For pasting click “Home tab – Clipboard Menu”, and from the Paste Icon pull down the
menu and select the option you need to paste.
Paste : This is equal to using Ctrl + C and Ctrl + V, but the result does not appear immediately. You have click on the folder icon for options (a) Keep Source Formatting, (b) Use Destination theme (c) match destination formatting (d) Values only (e) Values and No formatting (f) Values and source formatting. (g) Keep source column widths (h) formatting
only (i) links.
Formulas : only formulas are copied to the destination.
Paste Values : Only values are copied to the destination.
No Borders : Values are copied without borders in it.
Transpose : Columns are changed into respective rows.
Paste Link : Refer to the Source. ie., if source number/text changes even the destination
changes.
Paste Special : You have all the options available in the form of check boxes for copying.
As Picture : The source is copied as an image. You cannot edit the cells.
Cut : removes the source and places as destination cells.
Format Painter : Select the cells from which you want to select its format and Click Home
tab – Clipboard Menu and select the format painter icon (brush) and click in the
cell/cells you want to copy the formats.
Using if condition and producing text labels
S
Education
Code
N
o
.
5001
5002
5003
5004
5005
Anup
Krishna
Tamang
Manisha
Purush
3
2
1
4
5
Using this table produce Text labels. Codes are as follows: Educational Code
1
2
3
4
Remark
PhD.
Masters
Graduate
Under Graduate
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 267
5
SLC
Educational Code : ED.
HINT: =if(ED =1, “PhD”, if(ED=2, “Masters”, if(ED=3, “Graduate”, if(ED=4, “Under Graduate”,
if(ED=5, “SLC”) ) ) ) )
Replace all ED with the cell no of Code
Text Alignment/Wrapping
(a)
(b)
(c)
(d)
(e)
(f)
Select the cell/cells you want to align text/nos. Click on Home tab and select “Alignment”
menu : and
Select the Top/Middle/Bottom icons for aligning the text on to top/middle/bottom of the cells.
Select Lt/Centre/Rt icons for aligning the text left/middle/right.
Select the Text direction icon for changing the direction of the text. You can toggle repeatedly
to change the text direction.
Indent Text 5 spaces left or right by clicking on Lt indent/Rt indent.
Click on Text wrapping icon to wrap text so that it is displayed in cells across or below as
needed.
For Merging /Un-merging cells select the merging icon and click the option you need.
Formatting Numbers
Select the cells you want to format first and click “Home tab – Number Menu” and
(a) Select Text area displayed with “General” and click on the format you need like General, number, currency, accounting, date, time, percentage, Fraction, scientific, text, special, custom.
(b) Three recently used icons are present on the Number menu. Two icons to increase/decrease
the decimal places of number are also provided.
Conditional Formatting
Conditional formatting is formatting the shades/colors of the cells based on certain rules.
There are different types of rules. Always the minimum values and maximum values are
taken into consideration, and an average point is also taken. The patterns/colors are
applied based on these values as follows.
Highlight Cell Rules
Select the rows and Click “Home tab – Styles Menu - “Conditional Formatting” - “Highlight
Cell Rules” and select one of the following.
“Greaten than” allows you to highlight the numbers from the selection which are greaten
than the given number.
“ Less than” allows you to highlight the values lesser than the given value.
“Between” allows you to highlight the values between the given two values.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 268
“Equal to” allows you to highlight the values which are equal to the given value.
“Text that contains”, allows you to highlight the text from selection which matches the given text.
“a date occurring” allows you to highlight the date from the selection.
“duplicate values” allows you to highlight the duplicate values, if any, in the given selection.
Top/Bottom Rules
Select the rows and Click “Home tab – Styles Menu - “Conditional Formatting” “Top/Bottom Rules” and select one of the following.
Top 10 Items Allows you to highlight top ten items in value from the given selection.
Top 10% Allows you to highlight cells whose values are within top 10% of the given selection.
Bottom 10 Items Allows you to highlight bottom ten items values from the given selection.
Bottom 10 % Allows you to highlight cells whose values are within bottom 10% of the given
selection.
Above Average Allows you to highlight all values whose values are above average.
Below Average Allows you to highlight all values whose values are below average.
Data Bars
This selection has different colors representing the bar diagrams on the values according to
their selection. Ie, the minimum values and maximum values are taken and bar diagrams are formed according to the values.
Select the cells and Click “Home tab – Styles Menu - “Conditional Formatting” - “Data Bars”
and select one of the pre-defined pattern colors.
Color scales
This selection has different colors representing warning and peace messages. Ie, the minimum values are marked with green showing that they are OK. and maximum values are
shown with red color to have attention of the user
Select the cells and Click “Home tab – Styles Menu - “Conditional Formatting” - “Color
Scales” and select one of the pre-defined pattern colors.
Icon Sets
The values of the selection are represented like a traffic lights, racing flags, angled arrows
etc. to indicate how much a value is different from the minimum and maximum values.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 269
Select the cells and Click “Home tab – Styles Menu - “Conditional Formatting” - “Icon Sets”
and select one of the pre-defined pattern colors.
Formatting cells with table style.
The selected cells are painted with different colors schemes with different intensity to show
the differences between the values it contains.
Select the cells and Click “Home tab – Styles Menu - “Format as Table” and select one of the
pre-defined pattern colors.
Formatting with Cell Styles.
The selected cells can be painted individually with different color/comments/calculation/explanation etc.
Select the cells and click “Home tab – Styles Menu – Cell Styles and select one of the predefined patterns.
Inserting Cells/Sheet Rows/Columns
Click “Home tab – Cells Menu – Insert Icon” and select “Insert cells” to insert the cells at the
place of the cursor. The remaining cells/entire row or column can be moved in either
left/up or entire row/column..
Select “Insert sheet Rows” for inserting rows above the current cell.
Select “Insert Sheet Columns” for inserting columns before the current cell.
Deleting Cells/Sheet Rows/Columns
Click “Home tab – Cells Menu – Insert Icon” and select “Insert cells” to insert the cells at the
place of the cursor. The remaining cells/entire row or column can be moved in either
left/up or entire row/column.
Select “Delete sheet Rows” for deleting rows below the current cell.
Select “Delete Sheet Columns” for deleting columns below the current cell.
Setting Cells Height/Width
Click Home tab – Cells Menu – Format Icon and select one of the following.
Row Height will allow you to Set the height with the desired size in numbers.
Autofit Row Height : Select the cells first and then click on this option to set the Height of
the cells according to their contents.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 270
Column Width will allow you to set the width to the desired size in numbers.
Autofit Column Width Select the cells first and then click on this option to set the Width of
the cells according to their contents.
Default Width Select this option to set the width to default value which is 8.43.
Changing the Menu Color of the sheet.
Select Home tab – Cells Menu – Format Icon, and from the pull down menu, under organize
sheets select “menu colors” and click on the color you need to use for the current sheet
which will appear in the menu below.
Protecting Cells
Cells/sheets can be protected from unauthorized editing of the contents. We can provide
protection at different levels like Cells formatting, inserting/deleting cells, inserting
hyperlinks etc. Once the cells are protected they can be assigned a password so that
you are prompted with password before you can again set it to editing mode.
Click “Home tab – Cells Menu – Protect Sheet”, and select the desired level of protection by
clicking the checkbox and enter a password in the text area. You will be prompted with
a dialogue box to reconfirm the password.
For setting the cells for editing mode click on the Format Icon and select “unprotect sheet”.
Auto summing the values
Select the Cells you want to sum the values and click “Home tab – Editing Tab “, and pull
down the menu under the icon “ ∑ ” and select “Sum”. A product sum of the selected
cells appears under the selection.
Creating Average of Values
Select the Cells you want to sum the values and click “Home tab – Editing Tab “, and pull
down the menu under the icon “ ∑ ” and select “Average”. An average of the selected
cells appears under the selection.
Counting Number of values
Select the Cells you want to sum the values and click “Home tab – Editing Tab “, and pull
down the menu under the icon “ ∑ ” and select “Count Number”. A no indicating the
number of values appears under the selection.
Finding Max/Min of values
Select the Cells you want to sum the values and click “Home tab – Editing Tab “, and pull
down the menu under the icon “ ∑ ” and select Max or Min. A number is placed under
the selection indicating that it is the Max/Min.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 271
You can also find more functions under “More Function” option under this Icon.
Filling cells with a given value
We can fill the cells right/left/up/down with a certain value/text instead of typing repeatedly.
First enter a value/text for the cell and block the cells towards right/left/up or down along
with the cell containing the value/text and click “Home tab – Editing Tab – and select
“Fill Icon under “ ∑ ” icon. Select down/right/up/left options as you desire to fill.
You can also drag the cell selection to the empty place adjacent to it with the dragging corner of the cell. Then you are prompted with
button. You can select the auto fill
options as following (a) Fill Format Only (b) Fill Without Formatting (c) copy cells (d) Fill
Series.
Filling Cells with Series.
To fill with a series. Select atleast two items of the series and select “Home tab – Editing
Tab – fill Icon ”, From the pop up window select the series with a step value and if
needed, a stop value in the columns provided and click ok.
“Linear” will allow you to increase the value by a step by adding and “Growth” will allow you
to multiply the value with the step value.
Pay Roll Development with Excel Sheet :
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 272
Conditions are
DA = 45% of Basic
HRA = 15 % of Basic
Total Income = Basic + DA + HRA.
Insurance = 500
Medical = 150
Total Deductions = Insurance + Medical
Net Salary = Total Income – Total Deductions.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 273
Link cells to give changes in the rate of DA and HRA.
Hint : Make a cell apart from the table and refer this value to DA/HRA. Ex: = B1 * (A10 *
.45). Where A10 would be the cell for entering DA/HRA.
Calculate Net Salary.
Clearing Formats/contents/Comments
You can clear the cells with different elements like clearing formatting only, contents, and
comments. Select the cells you want to clear and Click Home tab - Editing Tab” and select the icon with “eraser like tool”. Select “Clear All” for clearing all the formats contents etc. Select “clear Format” for clearing only formats while keeping the values. Select “clear Contents” for clearing the values/contents and keeping the formats. Select
“comments” for clearing only comments.
Sorting Cells
Select the cells for sorting and click “Home tab – Editing Tab – Sort & Filter Icon”, and from
the pull down menu Select “Largest to Smallest” option to sort from largest to smallest
value.
Select “Smallest to Largest” option to sort from smallest to largest value.
Select “Custom Sort” option if you need to mention a special sorting order base on single/double condition level. In this option you can add/remove different levels of sorting
on same column/row and also have options like case sensitive, top to bottom, left to
right etc.
Filtering Cells
You can filter the cells without disturbing the figures entered into the cells for analysis. Select the cells you need to filter and click ““Home tab – Editing Tab – Sort & Filter Icon”,
and from the pull down menu select “Filter” option. An icon appears on the top click
that and see the display while filtering with the available options of “ascending and descending” options. You can also have filters based on colors and numbers. To remove
them click the “clear” option available under the “filter” option.
Find/Replace Cells
You can find and replace values, formulas, comments etc.
Click Home tab – Editing Tab – Find & Select Icon”, and select the type from the options
available under the line. Select “Goto” for going to a specified location. Select Find to
find format/value/text etc. Select Replace to replace the contents with the given options. Constants gives values, formulas gives formulas, and likewise. All the found values will be colored with ask color.
Show current Date and Time
Click on the cell you want to enter the date and type “=now()”
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 274
EX: Prepare Electric Billing Sheet.
Upto 20 units
21 to 250 units
Above 250 units
Con
N
Only Rs 78.00
Rs.7 per unit
Rs.10 per unit
Cu
Pr
s
u
m
e
r
e
v
i
o
u
s
N
o
R
e
a
d
i
n
g
(
B
3
)
501
Su
45
44
Unit
c
o
n
s
u
m
e
d
Bil
=
9
6
D
4
–
E
4
502
A
56
54
=
5
0
D
5
–
E
5
503
D
23
22
=
0
0
D
6
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 275
–
E
6
504
V
56
54
=
0
2
D
7
–
E
7
505
Ar
34
31
=
2
0
D
8
–
E
8
Units Consumed : UC
UC = Current Reading – Previous Reading
Bill Amount formula = if(UC<=20, 78, if(UC<=250,(UC-20)*7+78, if(UC>250, (UC250)*10+(250-20)*7+78)))
Hint: replace UC with your cell containing the Units Consumed details.
Using Pivot Tables in Excel
PivotTable is a table form of data which will allow you to analyze and form reports based on
certain conditions.
Ex:
Se
Da
Item
Rat
Q
A
e
10
3-
P4
800
1
Pr
0
oc
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 276
es
so
r
43
5-
Mother
Bo
ar
d
220
43
3-
SMPS
240
54
4-
Flat
120
Sc
re
en
64
4-
UPS
2
0
4
7
0
0
230
2
0
Enter this data into a sheet. Enter Amt as “=Qty *Rate.
Select Ser No to Amt by blocking and click on “Insert tab – Tables Tab and click on the icon
Pivot Table. Select Pivot Table. Automatically the selection appears in the cells given.
Select “Existing table” and click on empty cell and select the fields from the right panel.
Select Date first, then Item, and then Qty. You will have a detailed analysis in the pivot
table. You can even filter the table if needed by pressing on the pull down button.
What if Analysis using a Table.
This type of analysis is useful for getting results based on a single/double factors.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 277
For analyzing monthly payment for a given mortgage loan with different values of “Terms
and Rates” enter the following table. We use PMT inbuild function which calculates the
payment for a loan based on constant payments and a constant interest rate.
Mortgage loan analysis
down
pay
men
t
None
interest
rate
7.50%
term
(mo
nths
)
360
Loan
Amo
unt
80,000
180
360
9.75%
9.80%
10.15%
Type the formula in the empty column provided beside NONE as “= PMT(Interest Rate/12,
Term, - Loan Amt)”, select and block the cells from “empty cell” downwards till cell containing “360” column. Now click “Data menu – Data Tools Tab – What-If-Analysis”, and
select Data Table. You are prompted with a window containing two text boxes. In the
“Row input Cell” enter cell no containing “360”, in the “column input cell” enter cell no
containing “7.50%” and click ok. You are given the results in the empty cells.
Inserting Picture, Clip Art, shapes, Smart Art
To insert picture, clip art, shapes and smart art click “Insert tab – Illustrations Tab” and select the icon you want and insert.
Inserting Charts
To insert Charts click “Insert tab – Charts Tab” and select Column/Line/Pie/Bar/Area/Scatter/Other Chart, as needed. A sample data is entered by
default, you can enter the data by right clicking on the chart diagram and selecting edit
data.
Inserting Hyperlink
Place the cursor on the cell you want to hyper link and click Insert tab – Links Tab – and select “Hyperlink” icon. From the File dialogue box browse the file you want to connect
and click ok.
Inserting Text Box, Header & Footer, WordArt, Signature Line, Object, Symbol
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 278
Click “Insert tab – Text Tab” and from the given options select the one you need and place
them on the sheet.
Inserting themes, Colors, Fonts, Effects
Themes are predefined styles of text. Click “Page layout tab – Themes Tab” and select the
icons you want to use.
Adjusting Margins, Orientation, Size, Print Area, Breaks, Background, Print Titles
While printing excel provides you with a variety of options like print area select, complete
page etc. Especially it allows the data to be reduced and increased based on percentage. Lot of adjustments can be done and viewed in the print preview. Click “Page
layout tab – Page Setup Tab” and select the icons you want.
Grouping graphic images, wrapping text
Images are grouped into single so that the adjustment is not disturbed by any one. If four
images are grouped together, all of them move when you try to move one image. For
grouping select the images, and click “Page layout tab – Arrange Tab and select the
group icon. Wrapping and aligning is also done from “Arrange” pane itself.
Types of functions
There is a rich library of different functions offered by the Excel
(a) Add-in and automation functions : Help in connecting database, and other programming aspects.
(b) Cube Functions : Analysis of members of a types of data and their properties, like monitoring a
organisaztions performance etc.
(c) Database functions: Performs calculations on Database entries.
(d) Date & Time functions: performs calculations on date and time.
(e) Engineering functions: calculations on numbers like binary, decimal, measurements, logarithm
etc.
(f) Financial functions : performs calculations on money like interest, depreciation, loan amount
etc.
(g) Information functions: gives information on the given cells like format, location, type of value in
cell.
(h) Logical functions: gives results based on logical decision like true, false, if, not, or.
(i) Lookup & ref functions: gives results based on some query for tables, cells, refs
(j) Math & Trigonometry functions : performs calculations on mathematical functions like LCM,
ACOS.
(k) Statistical functions: helps in statistical analysis of the data in the cell like average, count, max,
min.
(l) Text functions : helps in manipulating text like trim, upper, search, len etc.
For using these functions click “Formulas Menu – function library Tab – and select the function you want to insert. Some basic functions are provided in the “AutoSum” icon and
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 279
recently used functions are automatically placed in “Recently used” icon for ease of
working.
Using names instead of cell range
When we are performing tasks on a specific cell range repeatedly, we can name the range
and use the name in place of cell ranges. Ex: we can name a cell range B1:B2 etc with
“myrange” and use myrange as a variable in places where we use ranges, like “=
SUM(myrange)”.
Cell names have scope for usage. You can manage all the names with “Name Manager”.
Name Manager carries the list of all the names, its values, references, scope & comment, if any. You can add new names and also filter the existing name cell ranges.
Enter few numbers in cells, and click “Formulas Menu – Defined Names Tab – Define Name
Icon”, and click on Define Name option. In the window enter the name, scope of availability, comments, and cell range in “refers to” text box and click OK.
Place the cursor in new cell and sum the range by using “=SUM (name)”. You will get the result of the sum.
Creating names & using in formulas
Enter the “aptech” in a cell and enter “this is in
kantipath” in the cell besides it. Now
place the cursor in other cell and click on “create from selection” and select these two
cells with aptech and “this is in kantipath” click on left column in the window and click
ok. Enter “=trim(“ in a cell and click on “aptech” from the list and enter “)”. And click
enter. You find that the second cell is trimmed and shown in the new cell.
Watching Formulas
Watch Windows is a concept for watching the formulas in another section/sheet/workbook. There is no need to scroll all over to the place where the formulas lies. A window with all the formulas you enter is available as a toolbar, which can be
placed anywhere. You can add and remove entries in the watch window.
Enter few formulas in the sheet and click “Home tab – Editing Tab – Find & Select- Go to
Special”, and click the check box with “formulas” in the window. Now Click “Formulas
Menu – Formula Auditing Tab – Watch Window”. You are provided with a window with
all the formulas in the sheet. You can enter/delete from the list.
Trace Precedents
This option shows the values or cells which effect this particular cell which as been selected.
Enter a value in a cell(B2) and click on another cell(F10) and enter ref of the first cell (type
“=B2”). Now click “Formulas Menu – Formula Auditing Tab – Trace Precedents Icon. An
arrow appears from the first cell to the one you are located, indicating that this cell is
dependent on it.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 280
Trace Dependents
This facility allows you to see the cells which are depending on the result of the current cell.
Enter text in a cell (B2) as “My value” and refer this cell in a second cell (enter “=B2” in F10
and F14). Now click on the first cell (B2) and click “Formulas Menu – Formula Auditing
Tab – Trace Dependents”, you will see two arrows coming from the first cell (B2) to the
two cells (F10 & F14), showing that F10 and F14 are dependent on B2 cell. Now change
the value of B2 to “Values” and see that both the values of (F10 & F14) changing.
To remove the arrows Click on “Remove Arrows” icon in the same tab.
Showing Formulas
Click “Formulas Menu – Formula Auditing Tab – Show Formulas” and you can see all the
formulas in the present sheet. You can use it as a toggle for on/off seeing formulas.
Trace Errors
Excel provides with a system for checking the errors in the entire sheet at once. For this
click “formulas Menu – Formula Auditing Tab – Error Checking Icon”. It will automatically check for all the errors in the sheet.
Evaluating Formula
Excel provides you to check the formulas in a step by step procedure. Place the cursor in the
cell you are having the formula and which you want to see step by step and click “Formulas Menu – Formula Auditing Tab – Evaluate Formula icon”. A window with step by
step procedure is provided to see how the formula is calculating the formula.
Auto Configuring Calculations
Calculations can be done automatically as and when you update a formula or data. You can
also manually perform the calculations if necessary. Generally the Table data takes more
time when included in the calculations. So you can exclude table data while performing
calculations.
Click Formulas menu – Calculation Tab – Calculation Options and check the “Automatic” or
“Automatic except for table data”. If you want to stop automatic calculations and perform them manually, click “Manual” in the above options.
For performing calculations manually click Formulas Menu – Calculation Tab” and click the
bottom last icon. OR (Shift + F9). For performing calculations for the entire Work Book
use “top right” button (OR) F9.
Accessing External Database
Other databases can be incorporated into MS Excel. Click “Data Menu – Get External Data
Tab” and select
(a) “From Access” for importing data from MS Access.
(b) “From Web” for importing data from Website.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 281
(c) “From Text:” for importing data from a text file.
(d) ”From Other Sources” for importing data from SQL Server, XML file, or any other sources with
the data connection wizard or MS query.
Most of the data imported may not be up to your expected levels of formats. You might need some
formatting. Manage the existing connections with the help of “Existing Connections” icon which is
located in the Get External Data tab of Data Menu. And configure the connections through “connections tab”.
Converting text into columns
You can convert text into multiple columns based on the delimiters. For example enter the
following data in the cells. Every Name should be entered in single cell.
Rana Pratap
singh
Avinash
Datta
Ch
Ranga Babu
Chakra
Mani Kanta
thapa
Viren Pratap
Singh
You can split the names into three columns containing first name, second name, and last
name.
Click on the cells and click “Data Menu – Data Tools Tab – Text to Columns Icon” and select
the “Delimited” option from the window and click “next” button and select “Space”
check box and click next button and in the next option select “Text” and click finish button. You can see the names divided into three cells.
Filtering Duplicates
Enter data in a column and select the range. Click Data Menu – Data Tools Tab – Remove
Duplicates Icon” and select “Continue with the current selection” option from the window and click OK.
Data Validation
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 282
This is a process to ensure that the user enters only valid data. Some times invalid data may
pose problems for calculations. You can either stop or process with a warning.
Select cell(s) for validating the data and Click “Data Menu – Data Tools Tab – Data Validation
Icon” and select “Data Validation”.
(a) Settings Tab will let you to set the limits for the data entered, like whole numbers, text length
etc. You can enter the condition for the data like values between, values lesser than etc in the
second text box. Set the minimum and maximum values in respective columns.
(b) Input Message Tab will allow you to enter the message to be displayed when the cell is highlighted.
(c) Error Alert Tab will allow you to “Stop” Entering Data, Give “Warning” and give “Information”
while entering data which is out of the range. A message also may be given to display when error.
After the above settings click OK. And try entering data out of the specified range.
You can circle the invalid data by clicking “Data Menu – Data Tools Tab – Data Validation”
and select “Circle Invalid data”. If you don’t want to see the circles you can enter “clear
validation circles”.
Consolidating Data sheets
Data can be brought from different sheets/workbooks and imported into one sheet. While
importing, the data can also be filtered and kept connected with the data source. When
the source data changes the consolidated data can also be projected accordingly.
Make two books viz book1 and book2. Enter the following data in book1.
Rat
Mond
ay
Tuesd
ay
Wednesday
0
0
23
43
25
0
0
33
54
34
0
43
33
44
0
0
44
2
55
0
0
12
45
39
e
60
Processor
90
Monitor
47
SMPS
17
UPS
Mother
Bo
ard
21
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 283
Enter the following data in book2.
Rat
Mond
ay
Tuesd
ay
Wednesday
0
0
34
22
13
0
0
43
45
23
0
33
32
32
0
0
54
43
43
0
0
2
55
42
e
60
Processor
90
Monitor
47
SMPS
17
UPS
Mother
Bo
ard
21
Keep both the book1 and book2 open. We are going to merge the table of book 1 with the
data of sheet 1 in the Sheet 2 of Book2.
Now goto Sheet 2 in Book 2 and click “Data Menu – Data Tools Tab – Consolidate Icon”, and
click on “Browse” and select Book1 and click OK. While the dialog box is active click on
the Book 1 which is open and select the range of data and click on “Add” button of the
open dialog box.
Now click “Browse” button and select book2 and click OK. Click on sheet 1 of book 2 and select the range and click “Add” in the open dialogue box.
Now click check boxes “Top Row” and “Left Column” and also select “Create links to source
data”. Goto Book 2 sheet 2 and click on B3 cell. Now ensure the reference text box is
clear in the open dialogue box and click OK.
You have the values summed and placed in sheet 2. Change the data in sheet1 or book1
and see the difference effecting the values of the book2, sheet 2.
Grouping Cells
Group cells together so that you can collapse or pull down when you need.
Select the cells you want to group and click “Data Menu – Outline Tab” and select
Rows/Columns together and click OK. You can click on the plus sign beside the group for
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 284
pulling down or “-“ sign for collapsing the group. You can ungroup by pressing “Ungroup” icon.
Goal Seek
Goal seek is a process which will help you give the required figure, if you know the target
value which have to arrive at. Enter the value you want to seek and give the cell address
of which should be the deterrent for the target value.
Lets use X2 + Y2 = R2 the formula for finding coordinates on a circle. If you know X and want
to adjust Y so that it should equal a known value of R. Enter some values for X, Y, Z.
36
64
+Enter “=SQRT(POWER(C3,2)+POWER(D3,2))” in E3 while the values of x and y are in C3 and
D3. Now click “Data Menu – Data Tools Tab – What-If-Analysis Icon” and select “Goal
Seek” option. You are prompted with (A) Set cell (B) to Value (c) By changing Cell. In
the “Set Cell” type “E3”, in the “To Value” set the desired number (645), and in “By
Changing Cell” type D3. You can see that the Goal seek will change the value in D3 so
that to reach the set value of R in E3 and a result is displayed.
Scenario Manager
In the above you have seen that the values are changing inside the sheet itself. At times
when you need to know the result but do not want to disturb the present sheet values,
you can use Scenario Manager.
This scenario summary will show what total profit would you get by selling certain qty of
items. In three scenes we have different total profits which would be the result of
changing the qty of the items. Enter the following table in the cells keeping B3 as top
left corner.
(
s
t
Selli
n
g
P
r
i
c
e
P
r
i
c
e
Co
Q
Pr
Total
=
14
C
0
0
0
185
0
1
0
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
E4 *
F
4
MRR 285
=
S
45
1
0
640
E5 *
F
5
=
U
12
0
0
147
0
1
E6 *
F
6
=SU
M
(
G
4
:
G
6
)
Changing cellsClick on the “Data Menu - Data Tools
Tab – What-if-analysis Icon”, and select “Scenario Manager”. Click “Add” button and
type “one” in Scenario name text box. Enter “F4:F6” and click OK.
In the 1st text box enter “8”, in 2nd text box enter 7 and in the 3rd text box enter 12.
Click “Add” button and type “one” in Scenario name text box. Enter “F4:F6” and click OK.
In the 1st text box enter “16”, in 2nd text box enter 26 and in the 3rd text box enter 24.
Click “Add” button and type “one” in Scenario name text box. Enter “F4:F6” and click OK.
In the 1st text box enter “20”, in 2nd text box enter 24 and in the 3rd text box enter 22.
Three values which you are entering are the quantity of items, by selling which we would
get the different profits.
Click “Summary” and select scenario summary. Type G7 in Result cells text box.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 286
Working with comments
Adding Comment : Place the cursor in the cell and click “Review tab – Comments Tab –
New Comment Icon” and add the comment in the text box.
Navigating Comments: click “Review tab – Comments Tab – Next / Previous” and see the
comments.
To see all comments press click “Review tab – Comments Tab – show all comments”.
Protecting Cells, sheets and sharing
Protecting Formulas
To hide any formulas that you don't want to be visible, do the following:
In the worksheet, select the cells that contain the formulas that you want to hide. On the
Home tab, in the Cells group, click Format, and then click Format Cells. On the Protection tab, select the Hidden check box, and then click OK. And then protect the sheet.
Once the protection is done the formulas will not be visible.
Protect sheet : click “Review tab – Changes Tab – Protect Sheet Icon. Select what you want
to lock and how other users access this sheet by clicking in the check boxes. Type the
password in the text area and click OK.
Protect Workbook : click “review tab – Changes Tab – Protect Workbook Icon”. And select
“protect structure and windows” option. You have two options (a)Structure & (
b)windows.
(a) Structure option will protect the workbook elements from editing, deleting etc.
(b) Windows option will let you protect you window so that whenever you freeze or resize your
window according to your specific needs and wanting to see them the same way when you open
the window next time.
You can type the password, you cannot open it without password, so remember it.
Working with views
Click “view tab – Workbook views”
(a) “Page Layout” will allow you to see the sheets as different pages.
(b) “Page Break Preview” will show you page breaks a blue lines, which can be dragged with mouse
to set the size of the page.
(c) “full screen” view will allow you to see in full screen. Press Esc for getting back to normal.
Zooming
To zoom to a particular selection select the cells and click “View – zoom – zoom to selection”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 287
Opening new window with same document
Click “View – Window – New window”.
Arranging Open windows
Click “view – window – Arrange All”
Splitting window views
Click “view – window – split”, will give you multiple views of different parts of the same
sheet.
Hiding Window
Click “view – window – Hide”, will hide the window to unhide the current window select
“Unhide”.
Using Macros
Click “View – Macros – Record Macro”, type the name in the text box and a description, if
needed, then perform some operations and after finishing click “macros – stop recording”.
Click macros – view macros “ and select the macro you want and click “run”.
To delete a macro click “Macros – View macros – View macros” and click on “Delete”.
MS POWERPOINT (2 Days)
Managing Slide, Design Template, Background
Power Point is a program meant for preparing slides for presentation of information with
the help of Graphics, Shapes, Pictures, Text, Audio, Video, Animations etc. Insert Text
Boxes, Pictures, Tables, Styles, Shapes, Word Art etc and present the information in an
effective manner so that it catches the viewers eye. Generally presentations are done in
16mm or big screens using projectors in Meetings.
Opening PowerPoint
Click Start – Programs – Microsoft Office – Power Point.
Power point presentations are saved with .pptx
Starting a presentation
Click “Office Button – New” for opening a new blank Presentation. (Ctrl + N)
Click “Office Button – Open” for existing presentation. (Ctrl + O)
Click “ Office Button – Save as” for making a copy. For password click “Options – general”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 288
For saving as 2003 compliant select the option in the second text box.
Running a Presentation
Click “slide Show – Start Slide Show – From Beginning OR F5.
Click “slide Show – Start Slide Show – From Current Slide OR Shift + F5.
Different view of Slides
Slide Sorter : allows you to arrange slides easily.
Slide Master: allows you to edit predefined styles.
Handout Master: Helps you design handouts of the slides.
Creating New Slides
From outlines written in text in word processors you can create slides.
Click “Home – Slides – New Slide and select from the predefined layouts.
Click “Home – Slides – New Slide – Slides from Outline” and browse for a text file/word file.
Click “Home – slides – New Slide – Reuse Slides”, and browse for the slides which are already existing as presentations etc.
Click “Home – slides – New Slide – Duplicate Selected Slides”, for duplicating the present
slide.
Formatting Slides
All the formatting tools like Bold, Italic, Underline, Shadow, Line Space, Font Color, Font Face
and size are available in “Font Tab of Home tab”.
Formatting Paragraph Styles
All the formatting tools like Bullets, Numbering, Indenting, Line Space, Justification and
text direction are available in Paragraph Tab of Home tab.
Graphics items
The Graphic Items like Clip Art, Picture, Shapes, Smart Art and chart are available in Illustrations Tab of Insert tab.
You can insert from photo albums available in the system from the “Photo Album” Icon in Illustrations Tab of Insert tab. This enables you to edit the photos as you import them.
Creating Hyperlinks
Click “Insert – Links – Hyperlink”. You can hyperlink any object like slides from the current
presentation, word, excel, web page, file, audio, movie etc.
Text Manipulations
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 289
Click “Insert – Text Tab”, you can find tools like Text Box which is generally used for inserting
the text in the presentations. You can insert Header/Footer, Word Art, Date & time,
symbols etc from this tab.
Inserting Movie, Sound Files etc
Click “Insert – Media Clips – Movie” for inserting a movie and browse from the dialog box
for the movie file etc.
Click “Insert – Media Clips – Sound” for inserting a sound file while presenting the slides.
Inserting Themes, Templates
Templates and themes are different window pre-defined layouts/styles etc.
Click “Design – Themes” and from the pull down menu select one of the styles/layouts.
You can use the current available themes or create a new one of your own for Design templates, Effects, fonts, colors etc.
Use Colors icon for using/creating themes for colors.
Use fonts icon for using/Creating themes for fonts.
Use Effects icon for using/Creating themes for effects.
Setting Slide Background
Control the background for 3D effects, Color effects, Gradient, Textures, Pictures, etc by
clicking on “Design – Background – Background Styles” Icon.
Incorporating Animations
Individual items can be animated using the custom animation. Click the object you want to
animate and click “Animations Menu – Animations Tab – Custom Animation” icon. You
can select from the custom animations Pane and see the effect by clicking “Play” icon.
You can even see the complete slide show by clicking “Slide Show”.
Transition : Transition is the phase/change which takes place between ending the present
slide and opening the next slide. Click “Animations – Transition to This Slide tab” and
from the pull down menu select the transition by clicking on it.
Control Transition Speed : The transition speed can be controlled by clicking “Animations –
Transition to this slide” and select the pull down menu option above the “Apply to all”
icon.
Incorporate Sounds for Transition:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 290
Click “Animations Menu – Transition to this Slide Tab” and select a Sound from the pull
down menu. This sound is produced during the transition of a slide.
Setting Timer for Transitions
Select the slide and click “Animations Menu – Transition to this slide Tab and select from the
Advance Slide topic. Select “On mouse Click” for transition to next slide on clicking a
mouse. Use “Automatically After” and set the timer beside it.
Setting up Slide Show
Click “Slide Show – Set Up – Set Up Slide Show”,
Show Type Settings: click the radio button for “Presented by a speaker” this will set the
slide show for full screen and continuous play. Click on “Browsed by an individual”, to
set the slide show to be run by an individual.
Show Slides Settings: Click “All” for running all the slides as set. Click “From” and select the
slides to be run from Start slide to end Slide by slide Number.
Show Options :Select “loop continuously until Esc”, will allow you to play repeatedly unless
you press a Esc button. “Show Without Narration” will show the slide without the narration. “Show Without Animation” will allow you to show the slides without any animation effect.
Advance Slides: Select “manually” if you need for manual transitions between slides. Select
“Using timings, if present” will run as set by the transition timings.
Record Narration
You can narrate and record your speech and run the slides automatically without any human intervention. For recording click “Record narration” under Set Up Tab. For rehearsing both narration and slide show timings click “Rehearse Timings”. Once you set
the narration and timings click “Use Rehearsed Timings” for running the show.
Set Resolution
Click “Slide Show – monitors tab” and set the resolution as desired.
Spellchecking
click “Review – Proofing Tab – Spelling” icon for checking the spelling in the slides. You
can set translation, language, research under this “Proofing” tab.
Adding Comments
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 291
Comments are for users of the slides. These comments never appear on the slide show.
Click “New Comment” for entering a new comment on the present slide.
Click “Edit Comment” for editing the existing comments.
Click “Delete” for deleting all/current slide comments.
Navigate by using Previous/Next icons between comments.
To show up the comments use “Show Markup”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 292
E-Mail And Internet (1 Day)
Introduction Internet, E-mail, Protocol
Internet: The internet is a “network of networks”. It is a global collection of high powered
computers that are connected to each other with network cables telephone lines, microwave dishes, satellites etc.
Server: Computer storing documents, sound files, video clips, program files, electronic
shopping centres, animations, pictures, interactive contents and other information and
presenting them electronically to others on net are known as servers.
Gateway: A Gateway is a communication device or program that pases data between networks having similar funtions but dissimilar implemetations.
Ineternet Service Providers(ISP): ISP is a interenet service provider on periodical charges
and/or installation charges. Serial Line Input Protocol(SLIP) or Point to Point Protocol
(PPP) is used for connecting internet. This allows the users to surf without any intervention of the ISP servers. TCP/IP connection internet must have PPP and SLIP protocols.
Modem: (Modular/Demodular) Modem is a device to translate the digital signals to analog
and vice versa. (Integrated Services Digital Network) ISDN is a digital telephone network
which provides fastest internet for the users.
How Internet Works : Once you send the mail. The user and the Recipient may be on different networks, its like calling a local telephone number and asking for the area code.
The exact IP Address may be away from the User. There may be many networks which
the user mail has to cross to reach the recipient. The email is broken into many pieces
and sent in many packets, routers will redirect the packets to the destination. The mails
while passing through networks are stored in different places with a table of contents &
addresses, and sent at their leisure.
WWW: Berner Lee is known as father of Word Wide Web. It’s a consortium.
Search Engines: Search engines provide the information based on certain keyword/keyword
combination. Ex : Google.com, infoseek.com, altavista.digital.com, cyber411.com.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 293
Helper Application: Helper applications are small programs which take little space in the
memory of your computer to play certain files, audio, video, etc on your system. They
will be downloaded by the browser automatically and play the file on your system. Ex:
Quick Time, Real Player etc.
Types of Emails :
(e) Web Based Free E-Mail These mails are free on the net, but you have to bear with the advertisements they pose. Ex. Google, yahoo, hotmail etc.
(f) Internet – Based Forwarding Services NetForward.com is an example, which will allow you give
all your emails of different free-email services and get one email and address from them so that
you can attend to all the emails with one ID and Password.
(g) E-mail Service Providers They are superior in quality of service and solutions. ESPs use X.25 or
X400 protocol for email. Return confirmation, prioritization of mails are few advantages of this
system. Charges are made as per the volumes of mails.
(h) Email through Internet Service Provider: This is known as Gateway Internet Service, generally
based on Unix and text based mails.
Protocol : A protocol is a set of rules to be followed while communicating with other computers. The protocol mentions the style of bits on net for lower levels(the bit sequence
for reading information) and exchange for high level application programs (the way two
programs send a file on net).
TCP/IP(Transmission Control Protocol/Internet Protocol) is a collection of protocols. It uses
five layers of the ISO/OSI model (International Standard Organization’s Open System Interconnect). ISO/OSI model defines (1) Application (2)Presentation (3)Session (4) Transport (5) Network (6) Data Link (7) Physical layers.
HTTP (Hyper Text Transmission Protocol) is web Native Protocol.
SLIP(Serial Line Internet Protocol) and PPP(Point to Point Protocol) are used by ISPs to connect their users on their servers.
POP (Post Office Protocol) & SMTP(Simple Mail Transport Protocol) are two protocols used
for mail services.
FTP (File Transfer Protocol) is a protocol used for transferring files on net. To transfer files
using FTP, one needs a client program and a server program. FTP server is a program on
a computer which will assist the files to be downloaded to client computer. Its like an
online library. Windows provides a program for FTP called ftp.exe. Type ftp in the run
command from start button. WSFTP is also a program which allows to upload files to a
server.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 294
Protocols for EMail: There are two mail protocols POP(Post Office Protocol) and
SMTP(Simple Mail Transfer Protocol). All the ISPs have POP and SMTP servers for maintaining emails.
WWW consortium is a combination of private industries and universities that work together
to guide technical development of the Web and set the web standards. RFC(Request
For Comments) is one way how you can get information about internet. Each RFC has a
number to address.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 295
HTML(Duration 10 Days)
Hyper Text Markup Language
Domain Names and IP Addressing
Addressing computers on net is done in two ways (a) Domain names and (b) IP Addresses.
Domain Names (for human understanding)
Domain names follow a format called the Domain Name System(DNS). Domain names describe organizational or geographic realities. They indicate which country the domain is
and which organization owns it.
Ex1: .com – commercial, .edu – Education, .gov – government, .mil – military networks.
Ex2: .in – India, .de – Germany, .np – Nepal, .nz – New Zealand.
IP Address (for Machine understanding)
An IP Address is a set of four numbers separated by a dot(32 bits). Ex: “202.54.15.175”. It
contains two parts (a) network address (b) Node address. There are three classes of
networks and also IP Address reserved for special purposes. Ex 1.1.1.1 means “All Networks”, 0.0.0.0 means “This Network” and 127 is reserved for loop back tests.
Class
A
B
C
Decimal range
of network
Address
1-127
128-191
192-223
Significance
Netwk.Node.Node.Node
Netwk.Netwk.Node.Node
Netwk.Netwk.Netwk.Node
DNS Server: Domain Name Service (DNS) servers translates the domain name of another
computer into an IP(Internet Protocol) address and vice versa on request. A format
called Domain Name System is followed by all computers on net.
Server : Server is the computer which provides the information. It has server side scripts for
handling the requests of the client and sending the data required. It has a IP Address
and Domain Name.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 296
Client: Client is the user of the information which is provided by the server. It can ask information and collect the data and display.
Browser : A Browser is a software programme which connects other systems on the world
wide web. It automatically connects other systems, maintains connections, maintains
memory cache, and displays the data in a formatted style that a user can understand.
Ex: Internet Explorer, Netscape Navigator, Mozilla FireFox etc.
Java Plug-In A java plug-in is incorporated in almost all the latest browsers. This is an additional software for the browsers for extending the facilities of programming to User and
Server.
For ex
URL: Uniform Resource Locator is the address of any file.
“HTTP://WWW.Google.com” contains two parts (a) HTTP which is the protocol which
has to be used along with this site. (b) “Google.com” which gives the domain.
Ex: “http//www.w3.org/TR/REC-html40/” means There is a document available via the HTTP
protocol, residing on the machine www.w3.org, accessible via the path “/TR/REChtml40/”.
(c) Fragment Identifiers : This kind of URI which denotes a link within the current page ends with
“#”
followed
by
an
anchor
identified
(fragment
identifier).
Ex
:
“http/mywebsite.com/html/top.html#section_2” indicates that “section_2” is an anchor in
top.html page.
(d) Relative URI’s: Denotes a path which is in relation to the current directory. One level up/down
to the current directory. Relative path is resolved to full URI’s using the base URI. Base URI is
the path of the current directory.
How to create HTML pages.
Start notepad from the start – programs – accessories. Enter the HTML code in the file and
save it with “ .html” file extension. Open the browser(Internet Explorer/Opera) and
open the file from the browser from the place where you have stored. And see the output of your file. Use “Alt +Tab” to toggle between the notepad and browser.
•
•
•
•
•
•
What is HTML?
HTML is a language for describing web pages.
HTML stands for Hyper Text Markup Language
HTML is not a programming language, it is a markup language
A markup language is a set of markup tags
HTML uses markup tags to describe web pages
The browser will remove extra spaces and extra lines when the page is displayed.
HTML is not case sensitive. No difference between “TEXT” and “text”.
HTML Structure :
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 297
<HTML>
<HEAD>
</HEAD>
<BODY>
YOUR CODE HERE
</BODY>
</HTML>
•
•
•
•
HTML Tags
HTML markup tags are usually called HTML tags
HTML tags are keywords surrounded by angle brackets like <html>
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is the end tag
Start and end tags are also called opening tags and closing tags.
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
</html>
Container Tags
Container tags are those having text or tag elements in the middle and start with a tag and
end with another tag. Ex.
Start tag *
Element content
<p>
This is a paragraph
End tag *
</p>
<a href="default.htm"
This is a link
</a>
>
* The start tag is often called the opening tag. The end tag is often called the closing tag.
Nested HTML Elements
<html>
<body>
<p>This is my first paragraph</p>
</body>
</html>
Empty Tags
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 298
HTML elements without content are called empty elements. Empty elements can be closed
in the start tag. <br> is an empty element without a closing tag (it defines a line break).
In XHTML, XML, and future versions of HTML, all elements must be closed so use <br />
instead is more future proof.
Attributes provide additional information about HTML elements. Attributes are always
specified in the start tag Attributes come in name/value pairs like: name="value"
Ex: <a href="http://www.w3schools.com">This is a link</a>
Attribute values should always be enclosed in quotes. Double/Single style quotes allowed.
Below is a list of some attributes that are standard for most HTML elements:
Basic HTML tags
All the files should include at least these tags.
(a) HTML : <HTML> and </HTML> tags defines that complete html file. All the tags are inside these
two tags.
(b) Head : <HEAD> and </HEAD> contains information about your HTML file. Usually the only tag
contained within this tag is “title” tag.
Keywords for Search Engines
Some search engines on the WWW will use the name and content attributes of the meta tag
to index your pages.
This meta element defines a description of your page:
<meta name="description" content=" Complete Overview to HTML & CSS Tags">
This meta element defines keywords for your page:
<meta name="keywords" content="HTML, DHTML, CSS, XML, XHTML, JavaScript, VBScript">
(c)Title : <TITLE> and </TITLE> is within the Head tag. It identifies your page to the rest of the world.
The tag output is displayed on your browser’s title bar but dos not appear as part of the page. If
you don’t mention the title “untitled” or url is displayed.
(d) Body : contains all the elements that a browser actually displays as the body of your HTML document.
HTML Headings
There are six levels of Heading tags viz, <H1>, <H2>, <H3>, <H4>, <H5>, and <H6>. H1 tag
contains the biggest size of characters and H6 contains the lowest size of characters.
Ex: 1.
<HTML>
<HEAD>
<TITLE>
MY FIRST WEB PAGE
</TITLE>
<HEAD>
<BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 299
<H1>This is a top-level heading </H1>
<H2> This is a second level heading </H2>
<H3>This is a third level heading </H3>
<H4> This is a fourth level heading</H4>
<H5> This is a fifth level heading</H5>
<H6> This is a sixth level heading</H6>
</BODY>
</HTML>
HTML Paragraphs
<P> tag specifies the beginning of a paragraph. When you define a new P tag it
automatically implies that it’s the beginning of a new paragraph. So you can use
only the starting P tag.
Line Break Tag:
The BR (Line Break) tag is an empty, or stand-alone tag that simply inserts an line
break.
Ex:
<HTML><BODY>
This line will <br/> be displayed in <br/> three lines</br>
</BODY></HTML>
Comments in HTML
<!-- and --> are the tags used for commenting out in the HTML file.
Ex: <!-- type your comments here -->
Ex : 2 simple HTML file
<HTML>
<HEAD>
<TITLE>
MY FIRST HTML
</TITLE>
<HEAD>
<BODY>
<H1>Hyper Text Markup Language</H1>
<P>
In this unit you are going to learn some basics of HTML, which is used to write HTML documents. Once you create an HTML document it can be viewed in any browser.
<P>
You will be learning how to use List and Hyperlink text effectively in your document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 300
</BODY>
</HTML>
FORMATTING TEXT
Bold : <B> and </B> is used to bold the text between the start and end tags.
Italic : <I> and </I> is used to italicize the text between the start and end tags.
Underline : <U> and </U> is used to underline the text between the start and end
tags.
Justification with 5 spaces Lt and Rt:
<BLOCKQUOTE> </BLOCKQUOTE> tags are used to double-indent on Lt and Rt
margins.
Ex: 3 Formating
<HTML>
<HEAD>
<TITLE>
MY Formatting tags
</TITLE>
<HEAD>
<BODY>
<H1><B>This line is in bold</B></H1>
<BR/><BR/>
<H2><I> This line is in italics</I><H2>
<H3><BLOCKQUOTE> This text is in “blockquote” tags and is displayed with an indent on left
margin of five spaces and right margin with five spaces. The text will be justified in the
middle. Any type of formatting is possible with PRE tag. This tag displays the contents
as you enter in the document. It is known as pre-defined text style. This is useful when
entering columnar data. </BLOCKQUOTE>.
</H3>
</BODY>
</HTML>
Character Entities
“<” symbol defines the start of an HTML tag but if we want the symbol be inserted then character entities in the HTML source are used.
A character entity has three parts: an ampersand (&), an entity name or a # and an entity
number, and finally a semicolon (;). Entity number are more reliable than entity names.
Note that the entities are case sensitive.
To display a less than sign in an HTML document we must write: &lt; or &#60;
The Most Common Character Entities:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 301
Result
Entity Number
&#160;
<
>
&
"
&#60;
&#62;
&#38;
&#34;
‘
Description
Entity Name
non&nbsp;
breaking
space
less than
&lt;
greater than
&gt;
ampersand
&amp;
quotation&quot;
mark
apostraphe
&apos; (does not work in)
&#39;
Some Other Commonly Used Character Entities:
Result
Description
¢
cent
£
pound
¥
yen
§
section
©
copyright
®
registered trademark
×
multiplication
÷
vision
Entity Name
&cent;
&pound;
&yen;
&sect;
&copy;
&reg;
&times;
&divide;
Entity Number
&#162;
&#163;
&#165;
&#167;
&#169;
&#174;
&#215;
&#247;
Text highlighting tags
<SUP></SUP> tags makes the text between them as superscript.
<SUB></SUB> tags makes the text between them as subscript.
<STRIKE></STRIKE> tags makes the text between them to appear as strike out.
EX.12 FORMATTING DEMO
<HTML>
<HEAD>
<TITLE> DEMO OF TEXT FORMATTING</TITLE>
<HEAD>
<BODY>
<P><H2>THIS IS DEMONSTRATION OF TEXT FORMATTING.</H2>
<HR NOSHADE>
<P>THE TEXT APPEARS NORMAL BUT
<P>MATHEMETICAL EXPRESSIONS LIKE 245<SUP>21</SUP>
<p>ORDINALS LIKE 21<SUP>st</SUP> AND
<P>CHEMICAL COMPOSITIONS LIKE H2 SO<SUB>4</SUB><BR/>
ARE EXPRESSED COMFORTABLY WITH THIS FORMATTING TAGS.
</BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 302
</HTML>
Text Alignment
The “ALIGN” attribute can be used with headings to align the text within the window. The attribute has values as LEFT/RIGHT/CENTER/JUSTIFY.
<P> tag also can contain “ALIGN” attribute with LEFT/RIGHT/CENTER values.
<CENTER></CENTER> tags can be used with any combination of text, images,
tables etc to center the whole contents.
Ex.13 Text Alignment demo
<HTML>
<HEAD>
<TITLE> DEMO OF TEXT ALIGNMENT</TITLE>
<HEAD>
<BODY>
<P><CENTER>
(create some random text and place it here)
</CENTER>
<CENTER><IMG SRC=FLOWERS.JPG></CENTER>
See image, which is also centered to the window.
</BODY>
</HTML>
Setting Font Sizes
The <FONT></FONT> tags are used along with SIZE attribute to change the size of the
font of a section.
SIZE attribute has values range from 1 to 7.
Default size is 3.
<BASEFONT> tag with SIZE attribute sets the default size. Ex.<BASEFONT SIZE=4>
Ex.14 Font size demo
<HTML>
<HEAD>
<TITLE> Font size DEMO</TITLE>
<HEAD>
<BODY>
<FONT SIZE=1>Font Size 1 </FONT><BR/>
<FONT SIZE=2>Font Size 2 </FONT><BR/>
<FONT SIZE=3>Font Size 3 </FONT><BR/>
<FONT SIZE=4>Font Size 4 </FONT><BR/>
<FONT SIZE=5>Font Size 5 </FONT><BR/>
<FONT SIZE=6>Font Size 6 </FONT><BR/>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 303
<FONT SIZE=7>Font Size 7 </FONT><BR/>
<HR SIZE=9 NOSHADE>
<CENTER>THIS IS THE DEFAULT SIZE OF FONT, THAT IS 3.
<P><BASEFONT SIZE=5>
AFTER USING "BASEFONT SIZE=5", THIS IS THE TEXT IN 5. <BR/> <BR/>
<FONT SIZE=-2>AFTER USING "FONT=-2", THIS IS THE TEXT IN 3.
<BR/><BR/></FONT>
<FONT SIZE =+1>AFTER USING "FONT =+1", THIS IS THE TEXT IN 6</FONT>
<HR SIZE=9 NOSHADE>
<H3 ALIGN=CENTER><u>USING THE BIG AND SMALL TAGS</U></H3>
<BASEFONT SIZE=3>
<SMALL>THIS TEXT IS BETWEEN THE SMALL TAGS DECREASING BASEFONT FROM 3 TO
2, RELATIVELY.</SMALL>
<P><BIG>THIS TEXT IS BETWEEN THE BIG TAGS INCREASING BASEFONT FROM 3 TO 4,
RELATIVELY</BIG>
</CENTER>
</BODY>
</HTML>
Changing font color
The <FONT> tag is used to display the color with “COLOR” attribute. Any of the 16
colors can be used as value to the COLOR attribute. Basic colors are (1)Black,
(2)White, (3)Aqua, (4)Blue, (5)Fuchsia, (6)Gray, (7)Green (8)Lime, (9)Maroon
(10)Navy (11)Olive (12)Purple (13)Red (14)Silver (15)Teal and (16)Yellow.
We can address colors in three ways.
: Hexadecimal Representation
(d) <body bgcolor="#FFFF00">
(e) <body bgcolor="rgb(255,255,0)"> : RGB (Red Green Blue)
(f) <body bgcolor="yellow">
: Basic text representation of color
Ex.
<FONT SIZE=7>
<FONT COLOR=”AQUA”>
You can use any of the 16 color names to specify a font color.
</FONT>
EX.15 DEMO OF COLORS
<HTML>
<HEAD>
<TITLE> DEMO FOR COLORS</TITLE>
<HEAD>
<BODY>
<CENTER>
<FONT SIZE=1 COLOR=BLACK>Font Size 1 </FONT><BR/>
<FONT SIZE=2 COLOR=YELLOW>Font Size 2 </FONT><BR/>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 304
<FONT SIZE=3
<FONT SIZE=4
<FONT SIZE=5
<FONT SIZE=6
<FONT SIZE=7
<FONT SIZE=6
<FONT SIZE=5
<FONT SIZE=4
<FONT SIZE=3
<FONT SIZE=2
<FONT SIZE=1
</CENTER>
</BODY>
</HTML>
COLOR=BLUE>Font Size 3 </FONT><BR/>
COLOR=FUCHSIA>Font Size 4 </FONT><BR/>
COLOR=GRAY>Font Size 5 </FONT><BR/>
COLOR=GREEN>Font Size 6 </FONT><BR/>
COLOR=LIME>Font Size 7 </FONT><BR/>
COLOR=MAROON>Font Size 6 </FONT><BR/>
COLOR=NAVY>Font Size 5 </FONT><BR/>
COLOR=OLIVE>Font Size 4 </FONT><BR/>
COLOR=PURPLE>Font Size 3 </FONT><BR/>
COLOR=RED>Font Size 2 </FONT><BR/>
COLOR=TEAL>Font Size 1 </FONT><BR/>
Changing Font Face
FACE attribute of the <FONT> tag assigns the font style. The fonts should be available in the system before it can be used.
Ex. Font Face
<html><head><title>Font face demo</title>
<body>
<p>
<font face=arial size=14 color=#00ff00> This is Arial font with size 14 and green in color</font>
<p>
<font face=impact size=16 color=#ff0000> This is Impact font with size 16 and red in color</font>
<p>
<font face="arial black" size=12 color=#0000ff> This is Arial Black font with size 12 and
Blue in color</font>
</body>
</html>
Style tag for deprecated tags of font, underline, strike
Style is an attribute inside paragraph and heading tags. It carries different properties to put forth the font, style, size, etc. It carries variable and value pairs separated by a colon(:). The pairs of Variable and values are separated with a semicolon follows(;).
Ex.<P style=”font-family:arial; font-size:14; text-decoration:underline;”>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 305
Preformatted text: The <PRE> and </PRE> tags are used to display a block of
“preformatted” text. The display will be “as is” state of text.
Ex : 4 Preformatting Tag
<HTML>
<HEAD>
<TITLE>
Pre-formatting tags in html
</TITLE>
<HEAD>
<BODY>
<PRE>
SALES FIGURES FOR FIRST QUARTER OF 2008
---------------------------------------------------------------------------------------------------------------------------------JAN
FEB
------------------------------------------------------------------------ANDERSON
10,200
20,015
BAKER
30,500
25,885
PETERSON
15,900
20,115
WILSON
40,100
35,000
-----------------------------------------------------------------------GRAND TOTAL
96,700
101,015
-----------------------------------------------------------------------</PRE>
</BODY>
</HTML>
Creating Lists
Ordered List
<OL> and </OL> tags specify a sequentially numbered list of items. It is used in
conjunction with <LI> tag. LI tag does not have end tag, its implied.
Attributes:
TYPE : specifies the type of format ex.A, a, i, 1.
START : sepifies the start no eg 2, c, etc.
Ex: 5 Ordered Lists
<HTML>
<HEAD>
<TITLE>My test on Ordered List tag</TITLE>
</HEAD>
<BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 306
<OL>
<LI>COMPUTER CONCEPTS
<LI>MS-ACCESS
<LI>MS-EXCEL
<LI>MS-WORD
<LI>MS-POWERPOINT
</OL>
</BODY>
</HTML>
Unordered List
<UL> and </UL> define a bulleted list of items. The <LI> tag is nested inside the
UL tag and defines each item within the list.
Attributes
TYPE : specifies the style of bullets like “disc”, “circle”, and “square”. These are
supported by Netscape Navigator.
Ex. 6 Unordered List
<HTML>
<HEAD>
<TITLE>My test on Ordered List tag</TITLE>
</HEAD>
<BODY>
<H3>
<UL TYPE = disc>
<LI>COMPUTER SOFTWARE
<br/>
<H5>(THIS IS ORDERED LIST NESTED INSIDE UNORDERED LIST)</H5>
<OL>
<LI>MS-ACCESS
<LI>MS-EXCEL
<LI>MS-WORD
<LI>MS-POWERPOINT
</OL>
<BR/>
<LI>COMPUTER HARDWARE
<UL TYPE = circle>
<LI>CPU
<LI>KEYBOARD
<LI>VISUAL DISPLAY UNIT
<LI>HARD DISK
</UL>
</UL>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 307
<BR/><BR/>
<H2><U>CONTROLLING STARTING ITEM OF A LIST </U></H2>
<OL START=5>
<LI>THIS IS FIFTH ITEM
<LI>THIS IS SIXTH ITEM
<LI>THIS IS SEVENTH ITEM
<LI>THIS IS EIGHTH ITEM
<LI>THIS IS NINTH ITEM
<LI>THIS IS THE LAST ITEM
</OL>
</H3>
</BODY>
</HTML>
Creating Definition Lists
<DL> and </DL> defines a definition list. <DT> tag is used to define the terms of
the list and <DD> tag is used for defining data of the list. This is like having a
heading and some text content under the heading, but in a listing fashion.
Ex. 7 Definition Lists
<HTML>
<HEAD>
<TITLE> DEFINITION LISTS TEST</TITLE>
</HEAD>
<BODY>
<h3>
<DL>
<DT>HARDWARE
<DD>Is defined as physical or tangible equipments associated with computer systems.
Examples of hardware are central processing Unit, input devices, output devices, and
secondary storage devices.<br/><br>
<DT>SOFTWARE
<DD>is a set of programs run on a computer.<br/><br/>
<DT>PERIPHERALS
<DD> Equipment connected around the CPU are known as peripherals.
</h3>
</BODY>
<HTML>
CREATING HYPERTEXT LINKS
With Hyperlinks you can link to other sources like web page, display an image,
download a program, send an e-mail message etc.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 308
Anchor tag(<A> & </A>) is used for hyper linking. The Target is mentioned in the
start tag and the text is written between the anchors.
Ex. <A HREF = “SUB.HTML”>Go to Sub document</A>
HREF (Hyper Reference) attribute specifies the URL. If partial URL or only file name
is mentioned, it means that the file is located on the same server. Otherwise
complete URL is a must. There are three types of links in HTML.
(d) Links to other HTML documents or data objects.
This type of link allows jumps to other web page and as well as anything that has an
address on the net, like FTP archives and images also. This type of link has only
“target file” or object which is given with a “HREF” attribute.
Ex: <p>Click here to jump to <A HREF = “SUB.HTML”> subdocument </A>
(e) Links to other places in the same HTML document.
Allows you to jump from one section to another section of the same page/document.
This links have two parts the source link and the target link.
Ex.
Source Link : <A HREF=”#sec1”>Go to section 1</A>
HREF attribute is referring to another anchor whose name would appear as “sec1”.
“Go to section 1” text will be the highlighted text.
Target Link : <A NAME=”sec1”>This is the contents of the section one which would
appear for the user after the jump</A>
“#” means a link to a section within a document/other page.
Target link should contain the “NAME” attribute for the source to recognize the target anchor. The complete text is embedded in the “<A> & </A>” tags.
(f) Links to places in other HTML documents.
Allows links to jump to some point halfway down another web page.
Contains “link” and “target link”, with only difference of web page being other file,
which is provided with a URL.
Ex. <A HREF=”C:\MYDIR\APTECH.HTML#Sec3”>Goto Sec3 of APTECH</A>
“C:\MYDIR\APTECH.HTML” is the file and “Sec3” is the part of the file which the link is going
to jump.
Target attribute
Define where the linked document will be opened.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 309
? _blank
: - the target URL will
? _self
: - the target URL will
Frame will be
discussed later.
? _parent : - the target URL will
? _top
: - the target URL will
open in a new window
open in the same frame as it was clicked.
open in the parent frameset
open in the full body of the window
EX: 8 Creating simple link list.
Create three HTML files by name Linktype1.html, Linktype2.html, and mainlink.html
in the same directory and third file with the list of links.
Contents of linktype1.HTML:
<HTML>
<HEAD>
<TITLE>LINK FILE ONE </TITLE>
</HEAD>
<BODY>
<H2>Here are the contents of file one</H2>
<P>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
</BODY>
</HTML>
Contents of linktype2.HTML:
<HTML>
<HEAD>
<TITLE>LINK FILE TWO </TITLE>
</HEAD>
<BODY>
<H2>Here are the contents of file Two with sub section</H2>
<P>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
<P><A NAME=sec1><h2>Section 1 of File two</h2>
(contents of last paragraph come here)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 310
</A>
</BODY>
</HTML>
Contents of mainlink.HTML:
<HTML>
<HEAD>
<TITLE>LINK LIST </TITLE>
</HEAD>
<BODY>
<H2>COURSES</H2>
<UL>
<LI><A HREF=linktype1.html>Normal Link to another HTML file</A>
<LI><A HREF=#bottom>Link to another Section in same page</A>
<LI><A HREF="linktype2.html#sec1" TARGET=”_blank”>Section-wise Link to another
HTML File</A>
<BR/>
<BR/>
(enter random text with =rand(9) in word and copy here and put<P> before paragraphs)
<A NAME=bottom><h2>Bottom</h2><P>
(contents of last paragraph come here)
</A>
</UL>
</BODY>
</HTML>
Inserting Inline Images
<IMG> is an empty tag allowing to insert image in a document.
<IMG> Attributes
SRC
BORDER
WIDTH
HEIGHT
TARGET
specifies URL for the image.
specifies the width of the border. Zero means no border.
specifies the width of the image. If width is not realistic it will
be fit to scale.
Specifies height of image. If no is realistic it will be fit to scale.
Specifies the window in which it will be loaded. Takes followPrepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 311
(e)
(f)
(g)
(h)
ing values:“_blank” Loads into a new window.
“_parent” loads into immediate parent of the document.
“_self” loads into the same windows : DEFAULT.
“_top” loads into full body of the current window.
Ex.<IMG SRC = FLOWERS.JPG ALT=a sample image>
Resizing images
HEIGHT and WIDTH attributes leave space for the image and go ahead with rest of
loading.
Values can be in pixels or percentage.
Ex. <IMG SRC=”BLUE HILLS.JPG” WIDTH=75%>
Ex. <IMG SRC=”BLUE HILLS.JPG” WIDTH=250 HEIGHT=200>
Controlling Border around an image link
BORDER attribute allows to define the border weight.
Ex. <IMG SRC=”FLOWERS.JPG” BORDER=14>
Ex. 9 Inline Image Settings
<HTML>
<HEAD>
<TITLE> Setting images </TITLE>
</HEAD>
<BODY>
<H2><U>
This is an image set to sizes 400 x 350 and aligned to the right side of the window
</U></H2>
<IMG SRC="blue hills.jpg" WIDTH=400 HEIGHT=350 ALIGN=RIGHT BORDER=12 ALT="A
simple image">
<h3><p>The image border is set to 12 pixels.
<p>All the images and documents should be placed in the same Directory. Try deleting the
image from the current directory and see the alternate message being displayed without
any changes in the border and dimensions of the image.
</h3>
</BODY>
<HTML>
Creating Image Links
Just place the <IMG> tag in the place where text appears
Ex. <A HREF=”Myfile”>Click here<IMG SRC=”flowers.jpg”></A>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 312
“click here” and also the image will be made as hyperlinks.
Ex.10 Image as a link
<HTML>
<HEAD>
<TITLE> Image as Hyperlink</TITLE>
</HEAD>
<BODY>
<H2><U>
This is an image which can be used as hyperlink to connect to linktype1.html file
<P>You can use both text and also image as a hyperlink.
</U></H2>
<P>
<A HREF=LINKTYPE1.HTML>CLICK HERE <IMG SRC="BLUE HILLS.JPG" WIDTH=400 HEIGHT=350
ALIGN=RIGHT border=12 ALT="A simple image">
</BODY>
<HTML>
Horizontal Rules (Lines)
Inserts horizontal line.
HR Attributes
SIZE
COLOR
WIDTH
ALIGN
NOSHADE
Gives thickness for the line
Mentions color for the line
Gives length of the line as %
Specifies alignment – RIGHT/LEFT/CENTER
Without shade a solid line
Ex. <HR SIZE=10 WIDTH=75% NOSHADE>
Ex. <HR SIZE=10 WIDTH=400>
Ex. 11 Horizontal Rulers
<HTML>
<HEAD>
<TITLE> Horizontal Rulers</TITLE>
</HEAD>
<BODY>
<H2><u>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 313
THIS IS DEMONSTRATION OF HORIZONTAL RULERS.
</H2><P> YOU CAN SEE THE DEFAULT LINE BELOW THIS TEXT
<HR NOSHADE>
<P> RESIZE THE WINDOW TO SEE THE SIZE OF RULERS CHANGE IN CONTEXT WITH THE
WINDOW<P>
</U></H2>
<P>
<HR SIZE=24 NOSHADE WIDTH=43% ALIGN=LEFT>
<P>
<A HREF=linktype1.html><IMG SRC="blue hills.Jpg" width=400 height=350 border=12 alt="A
simple image">
<HR SIZE=24 NOSHADE WIDTH=43% ALIGN=LEFT>
</BODY>
<HTML>
ADDRESS TAG
The address tag contains information on contact details. Horizontal ruler usually seperates an address from the rest of the web page.
Ex. 12 ADDRESS DEMO
<HTML>
<HEAD>
<TITLE> DEMO OF ADDRESS TAG</TITLE>
<HEAD>
<BODY>
<P>THIS IS DEMONSTRATION OF ADDRESS TAG.
<P><P>CLICK ON THE HYPERLINK IN ADDRESS BELOW HORIZONTAL RULER.
<P>DEFAULT EMAIL IS OUTLOOK.
<P>YOU NEED TO HAVE CONFIGURED OUTLOOK ACCORDINGLY
<P>THE “FROM ADDRESS” IN THE MAIL IS ALREADY FILLED WITH DETAILS.
<HR NOSHADE>
<ADDRESS>
APTECH,<br/> Siddhi Bhavan,<br/> Kanthipath,<br/>Kathmandu
<A HREF=MAILTO:[email protected]>E-mail</A><BR>
</ADDRESS>
</BODY>
</HTML>
WORKING WITH BACKGROUNDS
Background of the document can be manipulated with the <BODY> tag of the html
file.
“BGCOLOR” attribute will change the background color of the document.
“TEXT” attribute will change the text color for the whole of the document.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 314
“LINK” attribut e will change the color of the hyperlinks.
“VLINK” attribute will change color of already visited links.
“ALINK” attribute will change color of Active links.(when mouse is on the link).
Ex. <BODY BGCOLOR=CYAN TEXT=RED LINK=BLUE VLINK=GREY ALINK=GREEN>
Setting Background with a image.
“BACKGROUND” attribute of the <BODY> tag inserts an image as a background for
the document.
Ex. <BODY BACKGROUND=”c:\tests\flowers.jpg”>
Marquee Tag.
<MARQUEE> </MARQUEE> tags are used to display embedded text to move vertically/horizontally. This tag is unique to Internet Explorer only.
Syntax :
<MARQUEE BEHAVIOUR=”motion type” DIRECTION=”scroll direction”
HEIGHT=”pixel” WIDTH=”pixel” BGCOLOR=”color” LOOP=”number” SCROLLDELAY=”milli seconds”> …………………………………….. </MARQUEE>
BEHAVIOUR : “motion type” attribute sets the motion to ALTERNATE/SCROLL/ SLIDE.
It works within the rectangular space provided for the MARQUEE tag.
DIRECTION : “scroll direction” specifies the scrolling direction of the text direction.
Values can be UP/DOWN/LEFT/RIGHT.
HEIGHT & WIDTH: “pixel” renders rectangular space on the page with these
attributes. Default value is determined by the largest font assigned to the content in the
marquee.
BGCOLOR : “color” establishes the color for the rectangular space reserved for the
MARQUEE tag.
LOOP : “number” sets the number of times the text should move. -1 will set it to infinite
loop. Once the set number of times is over the text will come to still position.
SCROLLDELAY : “milli seconds” will assign the dealy for the scroll text. The bigger the
number slower the text is. And smaller number will speed up the scroll text.
Ex. 13 Marquee Demo
<HTML><HEAD><TITLE> BACKGROUND & MARQUEE DEMO</TITLE><HEAD>
<BODY BGCOLOR=BLACK TEXT=FUCHSIA VLINK=GREEN ALINK=PINK>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 315
<MARQUEE HEIGHT=50 WIDTH=1000 BGCOLOR=GRAY>
<FONT SIZE=7 COLOR=LIME><B><===</B>
</FONT><BR/> </MARQUEE>
<MARQUEE DIRECTION=DOWN>
<FONT SIZE=7 COLOR=LIME><PRE><B>
||
||
||
||
****
**
</B></PRE></FONT><BR/>
</MARQUEE>
<MARQUEE DIRECTION=UP>
<FONT SIZE=7 COLOR=LIME><PRE><B>
**
****
||
||
||
||
</B></PRE></FONT><BR/>
</MARQUEE>
<MARQUEE DIRECTION=RIGHT HEIGHT=50 WIDTH=1000 BGCOLOR=GRAY>
<FONT SIZE=7 COLOR=LIME><B>===></B></FONT><BR/>
</MARQUEE>
<FONT COLOR=YELLOW SIZE=4>THIS IS LINK DEMO, CLICK TO CHANGE COLOR
<A HREF="linktype1.html">CLICK ME</A>
</FONT>
</BODY>
</HTML>
Working with Tables in HTML
Creating Tables
<TABLE> and </TABLE> tags are used for creating tables. All tags are embedded
in between. If you need to contain several cells in a row, then use several
<TD></TD> tags embedded inside <TR> and </TR>.
Adding Borders
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 316
BORDER attribute inside the <TABLE> tag is used for mentioning border. No border
by default. Zero value gives no border. Ex.<TABLE BORDER=2>
Adding Border Color
BORDERCOLOR attribute specifies the color for border.
EX. <TABLE BORDER=2 BORDERCOLOR=BLUE>
Adding Table Background
BACKGROUND attribute in TABLE tag assigns background as tiled.
Ex. <TABLE BACKGROUND=FLOWERS.JPG>
Adding background color
BGCOLOR attribute in TABLE tag assigns color as background.
Ex. <TABLE BGCOLOR=GREEN>
Adding Column Headings
Use <TH> and </TH> tags to define a cell as heading cell. Create the <TR> tags
and use <TH> instead of <TD> inside them.
“ALIGN” attribute of <TH> sets contents horizontal alignment to
LEFT/RIGHT/CENTER.
Ex. <TR><TH>Roll No.</TH><TH>First Name</TH><TH>Second
Name</TH></TR>
Adding Row Headings
First cell of every row should be defined using <TH> and </TH> tags instead of
<TD> and </TD>.
Ex.
<TR><TH>Roll No.</TH><TH>First Name</TH><TH>Second Name</TH></TR>
<TR><TH>5344</TH><TD>ASHA</TD><TD>HEDGE</TD></TR>
<TR><TH>4456</TH><TD>USHA</TD><TD>MANJREKAR</TD></TR>
Cell Spacing and Padding
“CELLSPACING” attribute adds spacing between cells.
“CELLPADDING” attribute adds space between contents and cell border within the
cell.
Ex. Cell padding
<TABLE BORDER=2 CELLSPACING=6 CELLPADDING=6>
<HTML>
<HEAD>
<TITLE>Working With Table</TITLE>
</HEAD>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 317
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing CELLPADDING !</B><BR>
<HR>
<I>Without Cellpadding</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
<HR>
<I>With Cellpadding of 10</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% CELLPADDING=10 ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 318
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Ex : Cell spacing
<HTML>
<HEAD>
<TITLE>Working With Table</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Controlling the space between Adjacent Cells ! </B><BR><BR>
<HR>
<I>Without Cellspacing</I>
<CENTER>
<TABLE BORDER=1 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 319
</TABLE>
</CENTER>
<HR>
<I>With Cellspacing of 10</I>
<CENTER>
<TABLE BORDER=1 CELLSPACING = 10 WIDTH=25% ALIGN=CENTER>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Adding Caption
<CAPTION> and </CAPTION> tags are used to insert a caption for the table.
ALIGN attribute specifies the alignment as LEFT/RIGHT/BOTTOM/TOP.
Ex. <TABLE BORDER=1 CELLSPACING=6 CELLPADDING=6>
<CAPTION>I. MYTABLE </CAPTION>
Setting Table Width
WIDTH attributes specifies width of table. You can either use absolute value(in no
of pixels) or relative values (Percentages).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 320
Ex. <TABLE BORDER=1 CELLSPACING=6 CELLPADING=6 WIDTH=80%>
Ex. Border and width of Table
<HTML>
<HEAD>
<TITLE>Table Attributes</TITLE>
</HEAD>
<BODY BGCOLOR = LIGHTGREY>
<B>Specifing the BORDER and WIDTH of the Table!</B>
<BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=5 WIDTH=50%>
<CAPTION ALIGN=bottom>
<B>Personal Information</B>
</CAPTION>
<TR>
<TH>NAME</TH>
<TH>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD >Shilpa</TD>
<TD >21 </TD>
</TR>
<TR ALIGN=CENTER>
<TD>Vaishali</TD>
<TD>22</TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
Aligning cell contents of the table
“Align” attribute can be used with <TH> or <TD> tags to align the contents of the
cell with values LEFT/CENTER/RIGHT.
Ex.
<TH ALIGN=RIGHT> ROLL NO.</TH>
<TD ALIGN=CENTER> ROLL NO</TH>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 321
Setting column width
“WIDTH” attribute inside the top cell of the column will set the width of the entire
column. You can enter the value of WIDTH tag either in absolute value(in pixels) or in relative value (percentage).
Ex. <TR>
<TH WIDTH
<TH WIDTH
<TH WIDTH
<TH WIDTH
<TR>
=20%>ROLL NO</TH>
=20%>FIRST NAME</TH>
=20%>LAST NAME</TH>
=20%>FEES PAID</TH>
Centering a table
Embed the entire table inside <CENTER> and </CENTER> tags to center the table
within the window.
Inserting an Image
Use the image source tag <IMG SRC = URL> tag inside the tags of <TD>, <TH>.
Ex.<TH><IMG SRC=”flowers.jpg”></TH>
Ex. images in tables
<HTML>
<HEAD>
<TITLE>Images in tables</TITLE>
<HEAD>
<CENTER>
<TABLE BGCOLOR=lightgrey WIDTH=350 HEIGHT=220 BORDER=14 CELLSPACING=12>
<TR>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
</TR>
<TR>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC=FLOWERS.JPG WIDTH=100 HEIGHT=80></TD>
<TD><IMG SRC="BLUE HILLS.JPG" WIDTH=100 HEIGHT=80></TD>
</TR>
</CENTER>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 322
</BODY>
</HTML>
Spanning Columns
“COLSPAN” attribute lets you span columns. It contains the value as the number of
required columns to merge. It is embedded inside the first tag of <TH>.
Ex. <TH COLSPAN=4> S T U D E N T R E P O R T</TH>
Spanning Rows
“ROWSPAN” attribute lets you span rows. It contains the value as the number of
required columns to merge. It is embedded inside the first tag of <TH>
Ex. <TH ROWSPAN=2>
Ex. Columns and rows spanning
<HTML><HEAD>
<TITLE>Working With Table</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing ROWSPAN and COLSPAN Attributes !</B>
<BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=1 WIDTH=50% ALIGN=CENTER>
<TR>
<TH ROWSPAN=2>NAME
<TH COLSPAN=3>MARKS
</TR>
<TR>
<TH>PowerBuilder
<TH>VisualBasic
<TH>Developer2000
</TR>
<TR ALIGN=CENTER>
<TD> Shilpa
<TD> 21
<TD> 45
<TD> 30
</TR>
<TR ALIGN=CENTER>
<TD> Vaishali
<TD> 26
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 323
<TD> 30
<TD> 40
</TR>
<CAPTION ALIGN=bottom><B><BR>Mark Sheet</B></CAPTION>
</TABLE>
</CENTER>
</BODY>
</HTML>
Assigning background colors.
You can assign a background color to an entire table, a row within a table, or a single cell.
Ex.
<TR BGCOLOR=LIME>
Ex. Background colors for tables
<HTML>
<HEAD>
<TITLE>Assigning background colors to Tables</TITLE>
</HEAD>
<BODY BGCOLOR=LIGHTGREY>
<B>Specifing Coloured Table Cells!</B><BR><BR><BR><BR>
<CENTER>
<TABLE BORDER=1 WIDTH=50% ALIGN=CENTER>
<TR>
<TH Bgcolor = LIME>NAME</TH>
<TH Bgcolor = LIME>AGE</TH>
</TR>
<TR ALIGN=CENTER>
<TD Bgcolor = PINK><FONT Color=BLACK>Shilpa</FONT></TD>
<TD Bgcolor = YELLOW><FONT Color=BLACK>21 </FONT></TD>
</TR>
<TR ALIGN=CENTER>
<TD Bgcolor = WHITE><FONT Color=RED>Vaishali</FONT></TD>
<TD Bgcolor = VIOLET><FONT Color=BLACK>22</FONT></TD>
</TR>
<CAPTION ALIGN=bottom><B><BR>
Personal Information</B>
</CAPTION>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 324
</TABLE>
</CENTER>
</BODY>
</HTML>
Frames
<FRAMESET></FRAMESET> tags display frames in a window. Each frame can have
its own HTML file. Frames can be scrolled & resized by the user, unless scrolling
and resizing is turned off.
Absolute dimensions
Ex. <Frameset rows=80,400>
Defines a table with top row 80 pixels and bottom row with 400 pixels.
Percentage dimensions
Use % as dimensions instead of pixel. The % will set in context with the window
size.
Ex.<Frameset rows=”80%,20%”>
Top row with 80% of window and bottom with 20% of window is set.
Relative dimensions
Ex.<FRAMESET ROWS=”*,100”>
Bottom row is set to 100 pixel and top row takes the rest of the space in context
with the window.
<FRAME> tag is nested inside the <FRAMESET> AND </FRAMESET> tag.
Ex.<FRAME NAME=”FRAMENAME” SRC=URL FRAMEBORDER=”1/0” MARGINHEIGHT=
”PIXELS”
MARGINWIDTH=”PIXELS”
NORESIZE
SCROLLING=”YES/NO/AUTO”>
NAME attribute specifies the name of the frame.
SRC attribute specifies the url of the html document.
FRAMEBORDER can be switched on with value “1” and off with value “0”.
MARGINHEIGHT sets the margins in pixels (minimum is 2).
NORESIZE stops the manual resize of the frame.
SCROLLING determines how scrollbars are treated in a frame. NO value turns off the
scrolls. AUTO lets the control of scrolls automatically. Default value is “AUTO”.
NOFRAME tag is used to provide contents to browsers which do not support frames
or frames have been turned off. This tag can be placed after the last FRAME
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 325
element or after </FRAMESET> tag. No frame capable browser will ignore the
frames and frame capable browsers will ignore the NOFRAME tag.
You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some
text for browsers that do not support frames, you will have to enclose the text in
<body></body> tags! See how it is done in the first example below.
Ex. Demo of frames
Name this file as frames.html
<html>
<head><title>Demo of frames</title>
<frameset rows=20%,*>
<frame src="TOPFRAME.HTML"></frame>
<frameset cols=20%,*>
<frame src="LEFTFRAME.HTML">/frame>
<frame src="MAINFRAME.HTML" name=main></frame>
</frameset>
</frameset>
</HEAD>
<BODY>
</body>
</html>
</body>
</html>
Name this file as topframe.html
<HTML><HEAD><TITLE> TOPFRAME </TITLE></HEAD>
<BODY BGCOLOR="BLACK">
<H1 ALIGN=CENTER><FONT COLOR=LIME> THIS IS IN THE TOP FRAME FOR EXHIBITING THE MENUS </FONT></H1>
</BODY>
</HTML>
Name this file as leftframe.html
<HTML><HEAD><TITLE> Left frame </TITLE></HEAD>
<BODY Bgcolor="BLACK">
<H2><font color=violet> THIS IS IN THE LEFT FRAME FOR SPECIFYING TOPICS</font></H2>
</BODY>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 326
</HTML>
Name this file as mainframe.html
<HTML>
<HEAD><TITLE> DETAILS FRAME </TITLE></HEAD>
<BODY BACKGROUND="BLACK">
<H1 ALIGN=CENTER> THIS IS IN THE MAIN FRAME FOR GIVING DETAILS ON THE TOPICS SELECTED IN THE LEFT FRAME</H1>
</BODY>
</HTML>
Creating Forms
A form is used to collect data from the users and submit it to the server for further
process.
The information may be
(d) Written to a file which is saved on the server.
(e) Submitted to a database for collecting necessary information requested by the user.
(f) E-mailed to someone in particular.
The data validation may be done at the browser level before submitting the data.
The ACTION attribute in the <FORM> tag specifies a URL that indicates specific CGI
scripts or program that collect the form data that a user entered.
Likewise the METHOD attribute describes the way in which the input data is delivered to a forms-handling program. Values can be POST or GET.
<FORM> </FORM> tags embed all other tags and text inside them. Action for the
web server, and method of dispatch is also mentioned inside these tags itself.
Specifying input (the <INPUT> tag and its many attributes).
Setting up text input areas (the <TEXTAREA></TEXTAREA> tags.
Selecting values from a predefined set of possible inputs (<SELECT></SELECT>).
Managing the forms’ content (using the SUBMIT attribute for INPUT to deliver the content to the server, or the RESET attribute to clear its contents, and start again).
<INPUT> Tag : Takes two basic elements TYPE and NAME attributes. TYPE indicates the shape of element on document. NAME assigns a name to the component so that it can be controlled for assigning and modifying its values.
“TYPE” attributes can carry the following values.
CHECKBOX : produces check-box component on the form for multiple selection.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 327
Ex.<INPUT NAME=”EMPLOYED” TYPE=”CHECKBOX” VALUE=”Y”>YES<BR/>
Ex. <INPUT NAME=”EMPLOYED” TYPE=”CHECKBOX” VALUE=”N”>NO<BR/>
PASSWORD: produces no visible area hence used for password.
IMAGE: Lets you include icons or other graphical symbols.
RADIO: Creates a radio button for a range of selections. User may select only one.
Ex.
Sex <br/>
<INPUT NAME=”sex” TYPE=”Radio” value=”M”>Male<br/>
<INPUT NAME=”sex” TYPE=”Radio” value=”F”>Female<br/>
RESET: this button lets the user to clear the contents.
<INPUT TYPE=”Reset” value=”cancel data”>
SUBMIT: creates “SUBMIT” button. This button tells the browser to bundle the form
data and pass it all to the CGI script indicated by the ACTION attribute.
Ex.<INPUT TYPE =”SUBMIT”VALUE= “REGISTER NOW”>
TEXT: Provides a one-line input entry.
Ex. <INPUT NAME = “name” TYPE=”Text” SIZE=20 MAXLENGTH=”25”>
Other <INPUT> Attributes
VALUE=”Value” supplies the default value for TEXT element.
Ex. VALUE=”Join Now” for a submit or VALUE=”Clear Form” for a reset.
SRC=”URL” Provides pointer to the graphic for an image.
CHECKED: Makes sure that a certain radio button/check box is checked.
SIZE: “number” Sets the number of characters that a TEXT element can display without
scrolling.
MAXLENGTH=”number” Sets the max no of chars that a value in a TEXT element can
contain.
ALIGN=”TOP/MIDDLE/BOTTOM/LEFT/RIGHT” For IMAGE elements, ALIGN determines
how the graphics is aligned on the form accompanying the text.
<SELECT> </SELECT>
This tag works like lists. Its attributes are
(d) NAME=”text” Provides the name of the component.
(e) SIZE=”number” Controls the number of elements. You can define more elements
than mentioned here.
(f) MULTIPLE: indicates that multiple selections are possible in absence of this attribute
the user can make only one selection.
Ex. <SELECT NAME=BANKS SIZE=4>
<OPTION>HIMALAYAN BANK
<OPTION>STANDARD CHARTERED BANK
<OPTION>NABIL BANK
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 328
(e)
(f)
(g)
(h)
<OPTION>SBI NEPAL
<OPTION>GLOBAL TRUST BANK
</SELECT>
<TEXTAREA> … </TEXTAREA>
This tag allows you to create a text area without size. Text is embedded between
the tags.
Attributes are : NAME=”text” Provides the name for controlling the component.
ROWS=”number” specified the no of lines on the screen to display.
COLS=”number” specified the no of columns on the screen for display.
WRAP=HARD/SOFT/NONE specifies how text will wrap.
You can include more text than specified in the rows and columns.
Ex. <TEXTAREA NAME=”REMARKS” ROWS=3 COLS 4>
THIS STUDENT IS JOINING Masters in information technology.
</TEXTAREA>
Ex. Demo of Form
<HTML><HEAD><TITLE>FORM</TITLE>
<BODY>
<FORM>
<TABLE align=center border=1>
<TR>
<TH colSpan=2><TD>STUDENT INFORMATION</TD></TR>
<TR>
<TD>NAME</TD>
<TD><INPUT name=TXTNAME> </TD>
<TR>
<TD>ADDRESS</TD>
<TD><INPUT name=TXTADDRESS> </TD>
<TR>
<TD>SEX</TD>
<TD><INPUT type=radio value=M name=RDOSEX>MALE
<INPUT type=radio value=F
name=RDOSEX>FEMALE </TD>
<TR>
<TD>PHONE NO</TD>
<TD><INPUT name=TXTPHONENO> </TD>
</tr>
<TR>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 329
<TD>HOBBIES</TD>
<TD><INPUT type=checkbox value=CHATTING name=CHKCHATTING>CHATTING <INPUT
type=checkbox value=PLAYING name=CHKPLAYING>PLAYING<BR>
<INPUT type=checkbox value=SLEEPING name=CHKSLEEPING>SLEEPING
<INPUT type=checkbox value=HIKING name=CHKHIKING>HIKING </TD>
<TR>
<TD>CLASS</TD>
<TD><SELECT name=CBOCLASS> <OPTION value=XI selected>XI</OPTION> <OPTION
value=XII>XII</OPTION>
<OPTION value=BBA>BBA</OPTION>
</SELECT> </TD>
<TR>
<TD>COMMENTS</TD>
<TD><TEXTAREA name=AREACOMMENTS rows=5></TEXTAREA> </TD>
<TR>
<TD align=middle colSpan=2><INPUT type=button value=SEND name=CMDSEND> <INPUT type=submit value=SUBMIT> <INPUT type=reset value=RESET>
</TD></TR></TABLE></FORM></BODY></HTML>
Ex. Demo of Logon Form
<HTML><HEAD><TITLE>log on form</TITLE>
</HEAD>
<BODY>
<FORM>
<TABLE align=center border=2>
<TR>
<TH align=CETNER colSpan=2>Log On Form</TH></TR>
<TR>
<TD>UserName</TD>
<TD><INPUT name=txt></TD></TR>
<TR>
<TD>Password</TD>
<TD><INPUT type=password name=txt password></TD></TR>
<TR>
<TD>Log On as</TD>
<TD><SELECT name=cbologonas> <OPTION value=administrator
selected>Administrator</OPTION> <OPTION
value=operator>Operator</OPTION></SELECT> </TD></TR>
<TR>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 330
<TD align=CENTER colSpan=2><INPUT type=button value=ok name=btnok> <INPUT
type=button value=cancel
name=btncancel></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
Multi-column text
<MULTICOL> and </MULTICOL> displays text in multiple columns
COLS : specifies the number of columns to use.
GUTTER: specifies the number of pixels between each column.
WIDTH: specifies the width of the columns as a whole.
This will work with Netscape browser.
Working of Internet
When SUBMIT button is clicked the information passes on to server.
CGI interface ties the user information from the browser through Word Wide Web, to
the program on the server.
CGI Script is invoked and the information is passed through two REQUEST_METHOD,
GET or POST.
REQUEST_METHOD is the environment variable carrying the value GET/POST.
GET
It’s a request method which packs the information from the browser at the end of the URL
string. QUERY_STRING is the environment variable carrying the pair of element and value.
Ex.<a href ”cgi-bin/abc.exe?iname=aptech&fname=kantipath”>
In this example REQUEST_METHOD contains GET as its value, and QUERY_STRING contains
“iname=aptech&fname=kantipath” as its value. Some servers use “?” and some use “/” as
the separator between the program and values. If “/” is used then the environment variable in place of QUERY_STRING is “PATH_INFO”. In unix environment this length is max 100
chars. The query string is displayed in the URL.
POST
Post also passes the information from browser in the same way. But POST uses STDIN. Standard Input stream. CONTENT_LENGTH contains the size of the stream. Post method variable and values are not seen in the URL. There is no restriction on the size of the data sent
to the server.
To evaluate the data the server should examine the “REQUEST_METHOD” value and use the
information accordingly.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 331
MICROSOFT EXCEL 2007
1.
2.
3.
4.
1.
2.
3.
4.
5.
Spreadsheet: - Spreadsheets allows to you perform detailed analysis on numerical
data. Spreadsheets are also known as worksheets, display data in the form of
rows and columns. Data is entered in the cell which represents the intersection of
row and column.
Microsoft developed this program, so it is known as Microsoft Excel. It is a
spreadsheet program where we can insert data, process them, sort them, filter
them and create chart from the data etc., in this program we can perform various
kinds of Mathematical, financial, statistical, engineering calculations. Using this
program we can create bill, voucher, salary sheet, income & expenses statement, mark sheet, purchase book, sales book, balance sheet etc.
The file of Ms-Excel is called workbook and its extension is *.XLSX (Microsoft Office 2007).
Worksheet: - A grid of Rows and Columns is called worksheet. The large working
area of a workbook is called worksheet. There are 1,048,576 rows and 16,384
columns in a worksheet.
Workbook: - Workbooks are containers that hold one or more worksheets. Keeping
all sheets that are related to a project in one file reduces the need to maintain different files.
Rows: - The rows in a worksheet are numbered from top to bottom along the left
column of the worksheet.
Column: - The columns are labeled from left to right with letters.
Cell: - The intersection between row and column is called Cell.
Cell Reference: - It is the address of a cell denoted to using the column label followed by the row number. In a spreadsheet terminology a cell‘s column coordinate is called the cell reference e.g. A2.
Cell Range: - It is an area or collection of number of defines cells into a worksheet
e.g. A1:E15.
Active Cell: - When you select a cell by clicking it with the mouse, or moving to it using the keyboard, it becomes the active cell. The name Box, on the left of the
formula bar displays the reference of the active cell.
To Start Microsoft EXCEL 2007
Click on Start
Click on Programs.
Click on Microsoft Office
Click on Ms Excel.
OR
Click on Start
Click on Run
Then a dialog box will appears
Type Excel
Click on OK.
Create a new workbook
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 332
A Microsoft Office Excel workbook is a file that contains one or more worksheets that
you can use to organize various kinds of related information. To create a new
workbook, you can open a blank workbook. You can also base a new workbook
on an existing workbook, the default workbook template, or any other template.
Open a new, blank workbook
, and then click New.
Keyboard shortcut You can also press CTRL+N.
2.
Under Templates, make sure that Blank and recent is selected, and then under
Blank and recent in the right pane, click Blank Workbook.
Move or copy entire cells
When you move or copy a cell, Excel moves or copies the entire cell, including formulas and their resulting values, cell formats, and comments.
1.
Select the cells that you want to move or copy.
2.
On the Home tab, in the Clipboard group, do one of the following:
1.
Click Microsoft Office Button
To move cells, click Cut
.
Keyboard shortcut You can also press CTRL+X.
To copy cells, click Copy
.
Keyboard shortcut You can also press CTRL+C.
3.
On the Home tab, in the Clipboard group, click Paste
.
Keyboard shortcut You can also press CTRL+V.
Move or copy rows and columns
1.
Select the row or column that you want to move or copy.
2.
Do one of the following:
To move rows or columns, on the Home tab, in the Clipboard group, click
Cut
.
Keyboard shortcut You can also press CTRL+X.
To copy rows or columns, on the Home tab, in the Clipboard group, click
Copy
.
Keyboard shortcut You can also press CTRL+C.
3.
Right-click a row or column below or to the right of where you want to move or copy
your selection, and then do one of the following:
When you are moving rows or columns, click Insert Cut Cells on the
shortcut menu.
When you are copying rows or columns, click Insert Copied Cells on the
shortcut menu.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 333
Change the font or font size in a worksheet
1. Select the cell, range of cells, text, or characters that you want to format.
3. On the Home tab, in the Font group, do the following:
4. To change the font, click the font that you want in the Font box
5. To change the font size, click the font size that you want in the Font Size box
, or click Increase Font Size
or Decrease Font Size
you want is displayed in the Font Size box.
.
until the size
Align text to the left
1.
Select the text that you want to format.
2.
On the Home tab, in the Alignment group, click Align Left.
Keyboard shortcut To align selected text to the left, press CTRL+L.
Align text to the right
1.
Select the text that you want to format.
2.
On the Home tab, in the Alignment group, click Align Right.
Keyboard shortcut To align selected text to the right, press CTRL+R.
Center text
1.
Select the text that you want to format.
2.
On the Home tab, in the Alignment group, click Center.
Keyboard shortcut To center selected text, press CTRL+E.
Apply a cell style
1.
Select the cells that you want to format.
2.
On the Home tab, in the Styles group, click Cell Styles.
3.
1.
2.
3.
4.
5.
Click the cell style that you want to apply.
Create a custom cell style
On the Home tab, in the Styles group, click Cell Styles.
Click New Cell Style.
In the Style name box, type an appropriate name for the new cell style.
Click Format.
On the various tabs in the Format Cells dialog box, select the formatting that you
want, and then click OK.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 334
6.
In the Style dialog box, under Style Includes (By Example), clear the check boxes
for any formatting that you don't want to include in the cell style.
Create a cell style by modifying an existing cell style
1.
On the Home tab, in the Styles group, click Cell Styles.
2.
Do one of the following:
To modify an existing cell style, right-click that cell style, and then click
Modify.
To create a duplicate of an existing cell style, right-click that cell style, and
then click Duplicate.
3.
In the Style name box, type an appropriate name for the new cell style.
4.
To modify the cell style, click Format.
5.
On the various tabs in the Format Cells dialog box, select the formatting that you
want, and then click OK.
6.
In the Style dialog box, under Style Includes, select or clear the check boxes for
any formatting that you do or don't want to include in the cell style.
Remove a cell style
1.
To remove a cell style from selected cells without deleting the cell style, select the
cells that are formatted with that cell style.
2.
On the Home tab, in the Styles group, click Cell Styles.
3.
Do one of the following:
To remove the cell style from the selected cells without deleting the cell
style, under Good, Bad, and Neutral, click Normal.
To delete the cell style and remove it from all cells that are formatted with
it, right-click the cell style, and then click Delete.
Available number formats
The following is a summary of the number formats that are available on the Home
tab in the Number group. To see all available number formats, click the Dialog
Box Launcher next to Number.
Format
Description
General
This is the default number format that Excel applies when you type a number. For the
most part, numbers that are formatted with the General format are displayed just
the way you type them. However, if the cell is not wide enough to show the entire
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 335
number, the General format rounds the numbers with decimals. The General
number format also uses scientific (exponential) notation for large numbers (12 or
more digits).
Number
This format is used for the general display of numbers. You can specify the number of
decimal places that you want to use, whether you want to use a thousands separator, and how you want to display negative numbers.
Currency
This format is used for general monetary values and displays the default currency
symbol with numbers. You can specify the number of decimal places that you
want to use, whether you want to use a thousands separator, and how you want
to display negative numbers.
AccountingThis format is also used for monetary values, but it aligns the currency symbols and
decimal points of numbers in a column.
Date
This format displays date and time serial numbers as date values, according to the
type and locale (location) that you specify. Date formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified in
Windows Control Panel. Formats without an asterisk are not affected by Control
Panel settings.
Time
This format displays date and time serial numbers as time values, according to the
type and locale (location) that you specify. Time formats that begin with an asterisk (*) respond to changes in regional date and time settings that are specified in
Windows Control Panel. Formats without an asterisk are not affected by Control
Panel settings.
Percentage This format multiplies the cell value by 100 and displays the result with a percent
symbol. You can specify the number of decimal places that you want to use.
Fraction
This format display a number as a fraction, according to the type of fraction that you
specify.
Scientific
This format displays a number in exponential notation, replacing part of the number
with E+n, where E (which stands for Exponent) multiplies the preceding number
by 10 to the nth power. For example, a 2-decimal Scientific format displays
12345678901 as 1.23E+10, which is 1.23 times 10 to the 10th power. You can
specify the number of decimal places that you want to use.
Text
This format treats the content of a cell as text and displays the content exactly as you
type it, even when numbers are typed.
Special
This format displays a number as a postal code (ZIP Code), phone number, or Social
Security number.
Custom
This format allows you to modify a copy of an existing number format code. This
creates a custom number format that is added to the list of number format codes.
You can add between 200 and 250 custom number formats, depending on the
language version of Excel that you have installed.
Insert a new worksheet
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 336
To quickly insert a new worksheet at the end of the existing worksheets, click the
Insert Worksheet tab at the bottom of the screen.
To insert a new worksheet before an existing worksheet, select that worksheet,
and then on the Home tab, in the Cells group, click Insert, and then click Insert Sheet.
You can also right-click the tab of an existing worksheet, and then click Insert.
On the General tab, click Worksheet, and then click OK.]
Rename a worksheet
1.
On the Sheet tab bar, right-click the sheet tab that you want to rename, and then
click Rename.
Delete a worksheet
On the Home tab, in the Cells group, click the arrow next to Delete, and then click
Delete Sheet.
You can also right-click the sheet tab of the worksheet that you want to delete,
and then click Delete.
Freeze panes to lock specific rows or columns
1.
On the worksheet, do one of the following:
To lock rows, select the row below where you want the split to appear.
To lock columns, select the column to the right of where you want the split
to appear.
To lock both rows and columns, click the cell below and to the right of
where you want the split to appear.
2.
On the View tab, in the Window group, click Freeze Panes, and then click the option that you want.
[When you freeze panes, the Freeze Panes option changes to Unfreeze Panes so that you
can unlock frozen rows or columns.]
Hide or display rows and columns
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 337
You can hide a row or column by using the Hide command, but a row or column also
becomes hidden when you change its row height or column width to 0 (zero).
You can display either again by using the Unhide command.
Hide a row or column
Select the rows or columns that you want to hide.
On the Home tab, in the Cells group, click Format.
1.
2.
3.
Do one of the following:
Under Visibility, point to Hide & Unhide, and then click Hide Rows or
Hide Columns.
Under Cell Size, click Row Height or Column Width, and then type 0 in
the Row Height or Column Width box.
[You can also right-click a row or column (or a selection of multiple rows or columns),
and then click Hide.]
Display a hidden row or column
1.
Do one of the following:
To display hidden rows, select the row above and below the rows that you
want to display.
To display hidden columns, select the columns adjacent to either side of
the columns that you want to display.
To display the first hidden row or column on a worksheet, select it by typing A1 in the Name Box next to the formula bar (formula bar: A bar at the top of the
Excel window that you use to enter or edit values or formulas in cells or charts.
Displays the constant value or formula stored in the active cell.).
[You can also select it by using the Go To dialog box. On the Home tab, under Editing, click Find & Select, and then click Go To. In the Reference box, type A1, and
then click OK.]
3.
On the Home tab, in the Cells group, click Format.
4.
Do one of the following:
Under Visibility, point to Hide & Unhide, and then click Unhide Rows or
Unhide Columns.
Under Cell Size, click Row Height or Column Width, and then type the
value that you want in the Row Height or Column Width box.
Create a table
1.
On a worksheet, select the range of empty cells or data that you want to make into a
table.
2.
On the Insert tab, in the Tables group, click Table.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 338
3.
If the selected range contains data that you want to display as table headers, select
the My table has headers check box.
Table headers display default names that you can change if you don't select the My table
has headers check box.
[After you create a table, the Table Tools become available, and a Design tab is
displayed. You can use the tools on] the Design tab to customize or edit the table.
Delete a table
1.
On a worksheet, select a table.
2.
Press DELETE.
[You can also click Undo
on the Quick Access Toolbar to delete a table that
you just created.]
Fill data automatically in worksheet cells
For fast data entry, you can have Microsoft Office Excel automatically repeat data or
you can fill data automatically.
Fill in a series of numbers, dates, or other built-in series items
Using the fill handle (fill handle: The small black square in the lower-right corner of
the selection. When you point to the fill handle, the pointer changes to a black
cross.), you can quickly fill cells in a range with a series of numbers or dates or
with a built-in series for days, weekdays, months, or years.
1.
Select the first cell in the range that you want to fill.
2.
Type the starting value for the series.
3.
Type a value in the next cell to establish a pattern.
For example, if you want the series 1, 2, 3, 4, 5..., type 1 and 2 in the first two cells. If you
want the series 2, 4, 6, 8..., type 2 and 4. If you want the series 2, 2, 2, 2..., you can
leave the second cell blank.
[More examples of series that you can fill]
When you fill a series, the selections are extended as shown in the following table. Items
separated by commas are in placed in individual adjacent cells.
Initial selection
Extended series
1, 2, 3
4, 5, 6,...
9:00
10:00, 11:00, 12:00,...
Mon
Tue, Wed, Thu,...
Monday
Tuesday, Wednesday, Thursday,...
Jan
Feb, Mar, Apr,...
Jan, Apr
Jul, Oct, Jan,...
Jan-99, Apr-99
Jul-99, Oct-99, Jan-00,...
15-Jan, 15-Apr
15-Jul, 15-Oct,...
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 339
1999, 2000
-Jan, 1-Mar
2001, 2002, 2003,...
-May, 1-Jul, 1-Sep,...
Qtr3 (or Q3 or Quarter3)Qtr4, Qtr1, Qtr2,...
text1, textA
text2, textA, text3, textA,...
1st Period
2nd Period, 3rd Period,...
Product 1
Product 2, Product 3,...
4.
Select the cell or cells that contain the starting values.
5.
Drag the fill handle
across the range that you want to fill.
To fill in increasing order, drag down or to the right. To fill in decreasing order, drag up or to
the left.
Tips
1. You can also specify the type of series by using the right mouse button to drag the
fill handle over the range and then clicking the appropriate command on the shortcut
menu (shortcut menu: A menu that shows a list of commands relevant to a particular
item. To display a shortcut menu, right-click an item or press SHIFT+F10.). For example, if the starting value is the date JAN-2002, click Fill Months for the series
FEB-2002, MAR-2002, and so on; or click Fill Years for the series JAN-2003, JAN2004, and so on.
2. If the selection contains numbers, you can control the type of series that you want to
create.
[How to fill cells with a series of numbers]
1.
On the Home tab, in the Editing group, click Fill, and then click Series.
2.
Under Type, click one of the following options:
Click Linear for a series that is calculated by adding the value in
the Step value box to each cell value in turn.
Click Growth for a series that is calculated by multiplying the
value in the Step value box by each cell value in turn.
Click Date for a series that fills date values incrementally by the
value in the Step value box and dependent on the unit specified under Date
unit.
Click AutoFill for a series that produces the same results as
dragging the fill handle.
3.
You can suppress AutoFill by holding down CTRL while you drag the fill handle of a
selection of two or more cells. The selected values are then copied to the adjacent cells,
and Excel does not extend a series.
Fill data by using a custom fill series
To make entering a particular sequence of data (such as a list of names or sales regions) easier, you can create a custom fill series. A custom fill series can be
based on a list of existing items on a worksheet, or you can type the list from
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 340
scratch. You cannot edit or delete a built-in fill series (such as a fill series for
months and days), but you can edit or delete a custom fill series.
[A custom list can only contain text or text mixed with numbers. For a custom list that
contains numbers only, such as 0 through 100, you must first create a list of
numbers that is formatted as text.]
[How to format numbers as text]
1.
Select enough cells for the list of numbers that you want to format as text.
2.
On the Home tab, in the Number group, click the arrow on the Number Format
box, and then click Text.
[ You may have to click More to see Text.]
3.
In the formatted cells, type the list of numbers.
Use a custom fill series based on an existing list of items
1.
On the worksheet, select the list of items that you want to use in the fill series.
2.
3.
Click the Microsoft Office Button
, and then click Excel Options.
Click Popular, and then under Top options for working with Excel, click Edit
Custom Lists.
4.
Verify that the cell reference of the list of items that you selected is displayed in the
Import list from cells box, and then click Import.
The items in the list that you selected are added to the Custom lists box.
5.
Click OK twice.
6.
On the worksheet, click a cell, and then type the item in the custom fill series that
you want to use to start the list.
7.
Drag the fill handle (fill handle: The small black square in the lower-right corner of
the selection. When you point to the fill handle, the pointer changes to a black cross.)
across the cells that you want to fill.
Use a custom fill series based on a new list of items
1.
2.
Click the Microsoft Office Button
, and then click Excel Options.
Click Popular, and then under Top options for working with Excel, click Edit
Custom Lists.
3.
In the Custom lists box, click NEW LIST, and then type the entries in the List entries box, beginning with the first entry.
Press ENTER after each entry.
4.
When the list is complete, click Add, and then click OK twice.
5.
On the worksheet, click a cell, and then type the item in the custom fill series that
you want to use to start the list.
6.
1.
2.
Drag the fill handle
across the cells that you want to fill.
Edit or delete a custom fill series
Click the Microsoft Office Button
, and then click Excel Options.
Click Popular category, and then under Top options for working with Excel, click
Edit Custom Lists.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 341
3.
In the Custom lists box, select the list that you want to edit or delete, and then do
one of the following:
To edit the fill series, make the changes that you want in the List entries
box, and then click Add.
To delete the fill series, click Delete.
Formulas
Formulas are equations that perform calculations on values in your worksheet. A
formula starts with an equal sign (=). For example, the following formula multiplies 2 by 3 and then ads 5 to the result.
=5+2*3
A formula can also contain any or all of the following:
1. Functions (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on
a worksheet, especially those that perform lengthy or complex calculations.),
2. References,
3. Operators (operator: A sign or symbol that specifies the type of calculation to perform
within an expression. There are mathematical, comparison, logical, and reference operators.), and
4. Constants (constant: A value that is not calculated and, therefore, does not change.
For example, the number 210, and the text "Quarterly Earnings" are constants. An expression, or a value resulting from an expression, is not a constant.).
Parts of a formula
Functions: The PI () function returns the value of pi: 3.142...
References: A2 returns the value in cell A2.
Constants: Numbers or text values entered directly into a formula, such as 2.
Operators: The ^ (caret) operator raises a number to a power, and the * (asterisk)
operator multiplies.
Using constants in formulas
A constant is a value that is not calculated. For example, the date 10/9/2008, the
number 210, and the text "Quarterly Earnings" are all constants. An expression,
or a value resulting from an expression, is not a constant. If you use constant
values in the formula instead of references to the cells (for example,
=30+70+110), the result changes only if you modify the formula yourself.
Using calculation operators in formulas
Operators specify the type of calculation that you want to perform on the elements of
a formula. There is a default order in which calculations occur, but you can
change this order by using parentheses.
Types of operators
There are four different types of calculation operators: arithmetic, comparison, text
concatenation, and reference.
Arithmetic operators
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 342
To perform basic mathematical operations such as addition, subtraction, or multiplication; combine numbers; and produce numeric results, use the following arithmetic operators.
Arithmetic operatorMeaning
Example
+ (plus sign)
Addition
(minus sign)
3+3
Subtraction
Negation
–1
–1
* (asterisk)
Multiplication
3*3
/ (forward slash)
Division
3/3
% (percent sign)
Percent
20%
^ (caret)
Exponentiation)3^2
Comparison operators
You can compare two values with the following operators. When two values are
compared by using this operator, the result is a logical value either TRUE or
FALSE.
Comparison operator
Meaning
Example
= (equal sign)
Equal to
A1=B1
> (greater than sign)
Greater than
A1>B1
< (less than sign)
Less than
A1<B1
>= (greater than or equal to sign)Greater than or equal toA1>=B1
<= (less than or equal to sign)
Less than or equal to
A1<=B1
<> (not equal to sign)
Not equal to
A1<>B1
Text concatenation operator
Use the ampersand (&) to join, or concatenate, one or more text strings to produce a
single piece of text.
Text operator Meaning
Example
& (ampersand)
Reference
operator
Connects, or concatenates, two values to produce one continuous "North"&"wind"
text value
Reference operators
Combine ranges of cells for calculations with the following operators.
Meaning
Example
: (colon)
Range operator, which produces one reference to all the
cells between two references, including the two references
B5:B15
, (comma)
Union operator, which combines multiple references into
one reference
SUM(B5:B15,D5:D15)
(space)
Intersection operator, which produces on reference to cells B7:D7 C6:C8
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 343
Operator
common to the two references
Calculation order
Formulas calculate values in a specific order. A formula in Excel always begins with
an equal sign (=). The equal sign tells Excel that the succeeding characters constitute a formula. Following the equal sign are the elements to be calculated (the
operands), which are separated by calculation operators. Excel calculates the
formula from left to right, according to a specific order for each operator in the
formula.
Operator precedence
If you combine several operators in a single formula, Excel performs the operations
in the order shown in the following table. If a formula contains operators with the
same precedence — for example, if a formula contains both a multiplication and
division operator — Excel evaluates the operators from left to right.
Description
: (colon)
Reference operators
(single space)
, (comma)
Negation (as in –1)
%
Percent
Exponentiation
* and /
Multiplication and division
+ and –
Addition and subtraction
Connects two strings of text (concatenation)
Comparison
<>
<=
>=
<>
Use of parentheses
To change the order of evaluation, enclose in parentheses the part of the formula to
be calculated first. For example, the following formula produces 11 because Excel calculates multiplication before addition. The formula multiplies 2 by 3 and
then ads 5 to the result.
=5+2*3
In contrast, if you use parentheses to change the syntax, Excel adds 5 and 2 together and then multiplies the result by 3 to produce 21.
= (5+2)*3
In the example below, the parentheses around the first part of the formula force Excel to calculate B4+25 first and then divide the result by the sum of the values in
cells D5, E5, and F5.
= (B4+25)/SUM (D5:F5)
Using functions and nested functions in formulas
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 344
Functions are predefined formulas that perform calculations by using specific values,
called arguments, in a particular order, or structure. Functions can be used to
perform simple or complex calculations.
The syntax of functions
The following example of the ROUND function rounding off a number in cell A10 illustrates the syntax of a function.
Structure of a function
Structure. The structure of a function begins with an equal sign (=), followed by the
function name, an opening parenthesis, the arguments for the function separated
by commas, and a closing parenthesis.
Function name. For a list of available functions, click a cell and press SHIFT+F3.
Arguments. Arguments can be numbers, text, logical values such as TRUE or
FALSE, arrays, error values such as #N/A, or cell references (cell reference: The
set of coordinates that a cell occupies on a worksheet. For example, the reference of the cell that appears at the intersection of column B and row 3 is B3.).
The argument you designate must produce a valid value for that argument. Arguments can also be constants (constant: A value that is not calculated and,
therefore, does not change. For example, the number 210, and the text "Quarterly Earnings" are constants. An expression, or a value resulting from an expression, is not a constant.), formulas, or other functions.
Argument tooltip. A tooltip with the syntax and arguments appears as you type the
function. For example, type =ROUND( and the tooltip appears. Tooltips only appear for built-in functions.
Entering functions
When you create a formula that contains a function, the Insert Function dialog box
helps you enter worksheet functions. As you enter a function into the formula, the
Insert Function dialog box displays the name of the function, each of its arguments, a description of the function and each argument, the current result of the
function, and the current result of the entire formula.
To make it easier to create and edit formulas and minimize typing and syntax errors,
use formula auto complete. After you type an = (equal sign) and beginning letters
or a display trigger, Microsoft Office Excel displays below the cell a dynamic drop
down list of valid functions, arguments, and names that match the letters or trigger. You can then insert an item in the drop-down list into the formula.
Nesting functions
In certain cases, you may need to use a function as one of the arguments of another
function. For example, the following formula uses a nested AVERAGE function
and compares the result with the value 50.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 345
The AVERAGE and SUM functions are nested within the IF function.
Valid returns When a nested function is used as an argument, it must return the
same type of value that the argument uses. For example, if the argument returns
a TRUE or FALSE value, then the nested function must return a TRUE or
FALSE. If it doesn't, Microsoft Excel displays a #VALUE! error value.
Nesting level limits A formula can contain up to seven levels of nested functions.
When Function B is used as an argument in Function A, Function B is a secondlevel function. For instance, the AVERAGE function and the SUM function are
both second-level functions because they are arguments of the IF function. A
function nested within the AVERAGE function would be a third-level function, and
so on.
Using names in formulas
You can create defined names (name: A word or string of characters that represents
a cell, range of cells, formula, or constant value. Use easy-to-understand names,
such as Products, to refer to hard to understand ranges, such as
Sales!C20:C30.) to represent cells, ranges of cells, formulas, constants values,
or Excel tables. A name is a meaningful shorthand that makes it easier to understand the purpose of a cell reference constant formula, or table, each of which
may be difficult to comprehend at first glance. The following information shows
common examples of names and how they can improve clarity and understanding.
Example
Type
Example with no name
Example with a name
Reference
=SUM(C20:C30)
=SUM(FirstQuarterSales)
Constant
=PRODUCT(A5,8.3)
=PRODUCT(Price,WASalesTax)
Formula
=SUM(VLOOKUP(A1,B1:F20,5,FALSE), —
G5)
=SUM(Inventory_Level,—
Order_Amt)
Table
C4:G36
=TopSales06
Types of names
There are several types of names you can create and use.
Defined name A name that represents a cell, range of cells, formula, or constant
value. You can create your own defined name, and Excel sometimes creates a
defined name for you, such as when you set a print area.
Creating and entering names
You create a name by using the:
Name box on the formula bar This is best used for creating a workbook level name for a
selected range.
Create a name from selection You can conveniently create names from existing row and
column labels by using a selection of cells in the worksheet.
New Name dialog box This is best used for when you want more flexibility in creating
names, such as specifying a local worksheet level scope or creating a name comment.
You can enter a name by:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 346
Typing Typing the name, for example, as an argument to a formula.
Using Formula AutoComplete Use the Formula AutoComplete drop-down list, where valid names are automatically listed for you.
Selecting from the Use in Formula command Select a defined name from a list available from the Use in Formula command in the Defined Names group on the Formula
tab.
Create conditional formulas
Testing whether conditions are true or false and making logical comparisons between expressions are common to many tasks. You can use the AND, OR, NOT,
and IF function to create conditional formulas.
The IF function uses the following arguments.
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Formula with the IF function
logical_test: The condition that you want to check.
value_if_true: The value to return if the condition is true.
value_if_false: The value to return if the condition is false.
AND
Returns TRUE if all its arguments are TRUE; returns FALSE if one or more argument
is FALSE.
Syntax
AND(logical1,logical2, ...)
Logical1, logical2, ... are 1 to 255 conditions you want to test that can be either
TRUE or FALSE.
OR
Returns TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
Syntax
OR(logical1,logical2,...)
Logical1,logical2,... are 1 to 255 conditions you want to test that can be either TRUE
or FALSE.
NOT
Reverses the value of its argument. Use NOT when you want to make sure a value is
not equal to one particular value.
Syntax
NOT(logical)
Logical is a value or expression that can be evaluated to TRUE or FALSE.
TODAY
Returns the serial number of the current date. The serial number is the date-time
code used by Microsoft Excel for date and time calculations. If the cell format
was General before the function was entered, the result is formatted as a date.
Syntax
TODAY( )
NOW
Returns the serial number of the current date and time. If the cell format was General before the function was entered, the result is formatted as a date.
Syntax
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 347
NOW( )
DATE
Returns the sequential serial number that represents a particular date. If the cell format was General before the function was entered, the result is formatted as a
date.
Syntax
DATE(year,month,day)
AVERAGE
Returns the average (arithmetic mean) of the arguments.
Syntax
AVERAGE(number1,number2,...)
Number1, number2, ... are 1 to 255 numeric arguments for which you want the average.
MAX
Returns the largest value in a set of values.
Syntax
MAX(number1,number2,...)
MIN
Returns the smallest number in a set of values.
Syntax
MIN(number1,number2,...)
COUNT
Counts the number of cells that contain numbers and counts numbers within the list
of arguments. Use COUNT to get the number of entries in a number field that is
in a range or array of numbers.
Syntax
COUNT(value1,value2,...)
SUM
Adds all the numbers in a range of cells.
Syntax
SUM(number1,number2, ...)
SQRT
Returns a positive square root.
Syntax
SQRT(number)
Number is the number for which you want the square root.
ROUND
Rounds a number to a specified number of digits.
Syntax
ROUND(number,num_digits)
Number is the number you want to round.
Num_digits specifies the number of digits to which you want to round number.
Remarks
If num_digits is greater than 0 (zero), then number is rounded to the specified number of
decimal places.
If num_digits is 0, then number is rounded to the nearest integer.
If num_digits is less than 0, then number is rounded to the left of the decimal point.
Example
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 348
Formula
Description (Result)
=ROUND(2.15, 1) Rounds 2.15 to one decimal place (2.2)
=ROUND(2.149, 1) Rounds 2.149 to one decimal place (2.1)
=ROUND(-1.475, 2)Rounds -1.475 to two decimal places (-1.48)
=ROUND(21.5, -1) Rounds 21.5 to one decimal place to the left of the decimal point (20)
1.
2.
3.
4.
1.
2.
3.
MOD
Returns the remainder after number is divided by divisor. The result has the same
sign as divisor.
Syntax
MOD(number,divisor)
Number is the number for which you want to find the remainder.
Divisor is the number by which you want to divide number.
POWER
Returns the result of a number raised to a power.
Syntax
POWER(number,power)
Number is the base number. It can be any real number.
Power is the exponent to which the base number is raised.
WHAT-IF ANALYSIS: A process of changing the values in cells to see how those
changes affect the outcome of formulas on the worksheet. For example, varying
the interest rate that is used in an amortization table to determine the amount of
the payments.
Goal Seek
On the Data tab, in the Data Tools group, click What-If Analysis, and then click
Goal Seek.
In the Set cell box, enter the reference for the cell that contains the formula you want
to resolve.
In the To value box, type the result you want.
In the By changing cell box, enter the reference for the cell that contains the value
you want to adjust. [This cell must be referenced by the formula in the cell you specified
in the Set cell box.]
Create a scenario
A scenario is a set of values that Microsoft Office Excel saves and can substitute automatically on your worksheet. You can use scenarios to forecast the outcome of
a worksheet model. You can create and save different groups of values on a
worksheet and then switch to any of these new scenarios to view different results.
On the Data tab, in the Data Tools group, click What-If Analysis, and then click
Scenario Manager.
Click Add.
In the Scenario name box, type a name for the scenario (scenario: A named set of
input values that you can substitute in a worksheet model.).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 349
4.
In the Changing cells box, enter the references for the cells that you want to
change.
[To preserve the original values for the changing cells, create a scenario that uses the original cell values before you create scenarios that change the values.]
5.
Under Protection, select the options that you want.
6.
Click OK.
7.
In the Scenario Values dialog box, type the values that you want for the changing
cells.
8.
To create the scenario, click OK.
9.
If you want to create additional scenarios, repeat steps 2 through 8. When you finish
creating scenarios, click OK, and then click Close in the Scenario Manager dialog box.
Display a scenario
1.
On the Data tab, in the Data Tools group, click What-If Analysis, and then click
Scenario Manager.
2.
Click the name of the scenario that you want to display.
3.
Click Show.
Create a scenario summary report
1.
On the Data tab, in the Data Tools group, click What-If Analysis, and then click
Scenario Manager.
2.
Click Summary.
3.
Click Scenario summary or Scenario PivotTable report.
4.
In the Result cells box, enter the references for the cells that refer to cells whose
values are changed by the scenarios (scenario: A named set of input values that you
can substitute in a worksheet model.). Separate multiple references with commas. .
Consolidate by formula
1.
On the master worksheet, copy or enter the column or row labels that you want for
the consolidated data.
2.
Click a cell that you want to contain consolidated data.
3.
Type a formula that includes a cell reference to the source cells on each worksheet
or a 3-D reference that contains data that you want to consolidate. Regarding cell references, do one of the following:
If the data to consolidate is in different cells on different worksheets
Enter a formula with cell references to the other worksheets, one for each
separate worksheet. For example, to consolidate data from worksheets named
Sales (in cell B4), HR (in cell F5), and Marketing (in cell B9), in cell A2 of the master worksheet, you would enter the following:
[To enter a cell reference, such as Sales!B4, in a formula without typing, type the formula up to the point where you need the reference, click the worksheet tab, and
then click the cell. ]
If the data to consolidate is in the same cells on different worksheets
Enter a formula with a 3-D reference that uses a reference to a range of
worksheet names. For example, to consolidate data in cells A2 from Sales through
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 350
Marketing inclusive, in cell A2 of the master worksheet you would enter the following:
[If the workbook is set to automatically calculate formulas, a consolidation by formula
always updates automatically when the data in the separate worksheets change.]
Prevent invalid data entry in a worksheet
1.
2.
In many worksheets that you create, users will
enter data to get the desired calculations and results. Ensuring valid data entry is
an important task. You may want to restrict data entry to a certain range of dates,
limit choices by using a list, or make sure that only positive whole numbers are
entered. Providing immediate help to instruct users and clear messages when
invalid data is entered is also essential to make the data entry experience go
smoothly.
Once you decide what validation you want to use on a worksheet, you can set up the
validation by doing the following:
Select one or more cells to validate.
On the Data tab, in the Data Tools group, click Data Validation.
The Data Validation dialog box is displayed.
3.
Click the Settings tab.
4.
To specify the type of validation that you want, do one of the following:
[Allow values from a list]
1.
In the Allow box, select List.
2.
Click the Source box and then type the list values separated by the Microsoft Windows list separator character (commas by default).
.
3.
Make sure that the In-cell dropdown check box is selected.
[Allow a whole number within limits]
4.
In the Allow box, select Whole Number.
5.
In the Data box, select the type of restriction that you want. For example,
to set upper and lower limits, select between.
6.
Enter the minimum, maximum, or specific value to allow. You can also enter a formula that returns a number value.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 351
For example, to set a minimum limit of deductions to two times the number of children
in cell F1, select greater than or equal to in the Data box and enter the formula,
=2*F1, in the Minimum box.
[Allow a decimal number within limits]
7.
In the Allow box, select Decimal.
8.
In the Data box, select the type of restriction that you want. For example,
to set upper and lower limits, select between.
9.
Enter the minimum, maximum, or specific value to allow. You can also enter a formula that returns a number value.
[To allow a user to enter percentages, for example 20%, select Decimal in the Allow
box, select the type of restriction that you want in the Data box, enter the minimum,
maximum, or specific value as a decimal, for example .2, and then display the data
validation cell as a percentage by selecting the cell and clicking Percent Style
in the Number group on the Sheet tab.]
[Allow a date within a timeframe]
10.
In the Allow box, select Date.
11.
In the Data box, select the type of restriction that you want. For example,
to allow dates after a certain day, select greater than.
12.
Enter the start, end, or specific date to allow. You can also enter a formula
that returns a date.
For example, to set a time frame between today's date and 3 days from today's date,
select between in the Data box, enter =TODAY() in the Minimum box, and enter
=TODAY()+3 in the Maximum box.
[Allow a time within a timeframe]
13.
In the Allow box, select Time.
14.
In the Data box, select the type of restriction that you want. For example,
to allow times before a certain time of day, select less than.
15.
Enter the start, end, or specific time to allow. You can also enter a formula
that returns a time value.
For example, to set a time frame for serving breakfast between the time when the restaurant opens in cell H1 and 5 hours after the restaurant opens, select between in
the Data box, enter =H1 in the Minimum box, and then enter =H1+"5:00" in the
Maximum box.
[Allow text of a specified length]
16.
In the Allow box, select Text Length.
17.
In the Data box, select the type of restriction that you want. For example,
to allow up to a certain number of characters, select less than or equal to.
18.
Enter the minimum, maximum, or specific length for the text. You can also
enter a formula that returns a number value.
For example, to set the specific length for a full name field (C1) to be the current length
of a first name field (A1) and a last name field (B1) plus 10, select less than or
equal to in the Data box and enter =SUM(LEN(A1),LEN(B1),10) in the Maximum
box.
[Calculate what's allowed based on the content of another cell]
19.
In the Allow box, select the type of data that you want.
20.
In the Data box, select the type of restriction that you want.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 352
21.
In the box or boxes below the Data box, click the cell that you want to use
to specify what's allowed.
For example, to allow entries for an account only if the result won't go over the budget
in cell E4, select Decimal for Allow, select less than or equal to for Data, and in
the Maximum box, enter =E4.
[Use a formula to calculate what's allowed]
22.
In the Allow box, select Custom.
23.
In the Formula box, enter a formula that calculates a logical value (TRUE
for valid or FALSE for invalid entries). For example:
To make sure that
Enter this formula
The cell for the picnic account (B1) can only =AND(D1=0,D2<40000)
be updated if nothing is budgeted for the
discretionary account (D1) and the total
budget (D2) is less than the $40,000 allocated.
The cell containing a product description (B2) =ISTEXT(B2)
only contains text.
For the cell containing a projected advertising =AND(E1<=800,E2<=97000)
budget (B3), the subtotal for subcontractors and services (E1) must be less than or
equal to $800, and the total budget
amount (E2) must also be less than or
equal to $97,000.
The cell containing an employee age (B4) is
always greater than the number of full
years of employment (F1) plus 18 (the
minimum age of employment).
=IF(B4>F1+18,TRUE,FALSE)
All the data in the cell range A1:A20 contains =COUNTIF($A$1:$A$20,A1)=1
unique values.
You must enter the formula in the data validation for cell A1, and then fill the cells A2
though A20 so that the data validation for
each cell in the range has a similar formula, but the second argument to the COUNTIF function will match the current cell.
The cell containing a product code name (B5) =AND(LEFT(B5, 3) ="ID-",LEN(B5) > 9)
always begins with the standard prefix of
ID- and is at least 10 characters in length.
5.
To specify how you want to handle blank (null) values, select or clear the Ignore
blank check box.
[If your allowed values are based on a cell range with a defined name, and there is a blank
cell anywhere in the range, setting the Ignore blank check box allows any values to be
entered in the validated cell. This is also true for any cells referenced by validation formulas: if any referenced cell is blank, setting the Ignore blank check box allows any
values to be entered in the validated cell.]
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 353
6.
Optionally, display an input message when the cell is clicked.
How?
1.
Click the Input Message tab.
2.
Make sure the Show input message when cell is selected check box is
selected.
3.
Fill in the title and text for the message.
7.
Specify how you want Microsoft Office Excel to respond when invalid data is entered.
How?
1.
Click the Error Alert tab, and make sure that the Show error alert after
invalid data is entered check box is selected.
2.
Select one of the following options for the Style box:
To display an information message that does not prevent entry
of invalid data, select Information.
To display a warning message that does not prevent entry of
invalid data, select Warning.
To prevent entry of invalid data, select Stop.
3.
Fill in the title and text for the message (up to 225 characters).
[If you don't enter a title or text, the title defaults to "Microsoft Excel" and the message
to: "The value you entered is not valid. A user has restricted values that can be entered into this cell."]
8.
Test the data validation to make sure that it's working correctly.
Try entering both valid and invalid data in the cells to make sure that your settings are working as you intended and your messages are appearing when you expect.
[If you make changes to the validation in one cell, you can automatically apply your
changes to all other cells that have the same settings. ]
Filter data in a range or table
Using AutoFilter to filter data is a quick and easy way to find and work with a subset
of data in a range of cells or table column.
Filter text
1.
Do one of the following:
Range of cells
1.
Select a range of cells containing alphanumeric data.
2.
On the Home tab, in the Editing group, click Sort & Filter, and then click
Filter.
Table
Make sure that the active cell is in a table column that contains alphanumeric data.
Click the arrow in the column header.
Do one of the following:
Select from a list of text values
In the list of text values, select or clear one or more text values to filter by.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 354
The list of text values can be up to 10,000. If the list is large, clear (Select All) at the
top, and then select the specific text values to filter by.
[To make the AutoFilter menu wider or longer, click and drag the grip handle at the
bottom.]
Create criteria
1.
Point to Text Filters and then click one of the comparison operator (comparison operator: A sign that is used in comparison criteria to compare two
values. Operators include: = Equal to, > Greater than, < Less than, >= Greater
than or equal to, <= Less than or equal to, and <> Not equal to.) commands, or
click Custom Filter.
For example, to filter by text that begins with a specific character, select Begins With,
or to filter by text that has specific characters anywhere in the text, select Contains.
2.
In the Custom AutoFilter dialog box, in the box on the right, enter text or
select the text value from the list.
For example, to filter by text that begins with the letter "J", enter J, or to filter by text
that has "bell" anywhere in the text, enter bell.
If you need to find text that shares some characters but not others, use a wildcard character.
[How to use wildcard characters]
Use
To find
? (question mark)
Any single character
For example, sm?th finds "smith" and "smyth"
* (asterisk)
Any number of characters
For example, *east finds "Northeast" and "Southeast"
~ (tilde) followed by ?, *, or ~A question mark, asterisk, or tilde
For example, fy06~? finds "fy06?"
3.
Optionally, filter by one more criteria.
[How to add one more criteria]
1.
Do one of the following:
To filter the table column or selection so that both criteria must be true, select And.
To filter the table column or selection so that either or
both criteria can be true, select Or.
2.
In the second entry, select a comparison operator, and then in
the box on the right, enter text or select a text value from the list.
Filter numbers
1.
Do one of the following:
Range of cells
1.
Select a range of cells containing numeric data.
2.
On the Home tab, in the Editing group, click Sort & Filter, and then click
Filter.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 355
Table
Make sure that the active cell is in a table column that contains numeric
data.
Click the arrow in the column header.
Do one of the following:
Select from a list of numbers
In the list of numbers, select or clear one or more numbers to filter by.
The list of numbers can be up to 10,000. If the list is large, clear (Select All) at the top,
and then select the specific numbers to filter by.
[To make the AutoFilter menu wider or longer, click and drag the grip handle at the
bottom.]
Create criteria
1.
Point to Number Filters and then click one of the comparison operator (comparison operator: A sign that is used in comparison criteria to compare two
values. Operators include: = Equal to, > Greater than, < Less than, >= Greater
than or equal to, <= Less than or equal to, and <> Not equal to.) commands or click
Custom Filter.
For example, to filter by a lower and upper number limit, select Between.
2.
In the Custom AutoFilter dialog box, in the box or boxes on the right, enter numbers or select numbers from the list.
For example, to filter by a lower number of 25 and an upper number of 50, enter 25
and 50.
Insert subtotals in a list of data in a worksheet
You can automatically calculate subtotals and grand totals in a list (list: A series of
rows that contains related data or a series of rows that you designate to function
as a datasheet by using the Create List command.) for a column by using the
Subtotal command in the Outline group on the Data tab.
Subtotals are calculated with a summary function (summary function: A type of calculation that combines source data in a PivotTable report or a consolidation table, or when
you are inserting automatic subtotals in a list or database. Examples of summary functions include Sum, Count, and Average.), such as Sum or Average, by using the SUBTOTAL function. You can display more than one type of summary function for each column.
Grand totals are derived from detail data (detail data: For automatic subtotals and worksheet outlines, the subtotal rows or columns that are totaled by summary data. Detail
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 356
data is typically adjacent to and either above or to the left of the summary data.), not
from the values in the subtotals. For example, if you use the Average summary function, the grand total row displays an average of all detail rows in the list, not an average
of the values in the subtotal rows.
If the workbook is set to automatically calculate formulas, the Subtotal command recalculates subtotal and grand total values automatically as you edit the detail data. The Subtotal command also outlines (outline: Worksheet data in which rows
or columns of detail data are grouped so that you can create summary reports.
The outline can summarize either an entire worksheet or a selected portion of it.)
the list so that you can display and hide the detail rows for each subtotal.
1.
Make sure that each column has a label in the first row, contains similar facts in
each column, and that the range has no blank rows or columns.
2.
Select a cell in the range.
3.
Do one of the following:
[Insert one level of subtotals]
You can insert one level of subtotals for a group of data as shown in the following example.
At each change in the Sport column…
…subtotal the Sales column.
1.
Sort the column that forms the group.
For more information on sorting, see Sort data in a range or table.
2.
On the Data tab, in the Outline group, click Subtotal.
The Subtotal dialog box is displayed.
3.
In the At each change in box, click the column to subtotal. In the example
above, you would select Sport.
4.
In the Use function box, click the summary function that you want to use
to calculate the subtotals. In the example above, you would select Sum.
5.
In the Add subtotal to box, select the check box for each column that
contains values that you want to subtotal. In the example above, you would select
Sales.
6.
If you want an automatic page break following each subtotal, select the
Page break between groups check box.
7.
To specify a summary row above the details row, clear the Summary below data check box. To specify a summary row below the details row, select the
Summary below data check box. In the example above, you would clear the
check box.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 357
8.
Optionally, you can use the Subtotals command again by repeating steps
one through seven to add more subtotals with different summary functions. To
avoid overwriting the existing subtotals, clear the Replace current subtotals
check box.
[Insert nested levels of subtotals]
You can insert subtotals for inner, nested groups within their corresponding outer groups as
shown in the following example.
At each change in the outer, Region column…
…subtotal the Sales for that region and at each change for the inner, Sport column.
9.
Sort the columns that form the groups.
For more information on sorting, see Sort data.
10.
Insert the outer subtotals.
[How to insert the outer subtotals]
1.
On the Data tab, in the Outline group, click Subtotal.
The Subtotal dialog box is displayed.
2.
In the At each change in box, click the column for the outer
subtotals. In the example above, you would click Region.
3.
In the Use function box, click the summary function that you
want to use to calculate the subtotals. In the example above, you would select
Sum.
4.
In the Add subtotal to box, select the check box for each column that contains values that you want to subtotal. In the example above, you
would select Sales.
5.
If you want an automatic page break following each subtotal, select the Page break between groups check box.
6.
To specify a summary row above the details row, clear the
Summary below data check box. To specify a summary row below the details row, select the Summary below data check box. In the example above,
you would clear the check box.
7.
Optionally, you can use the Subtotals command again by repeating steps one through six to add more subtotals with different summary
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 358
functions. To avoid overwriting the existing subtotals, clear the Replace current subtotals check box.
11.
Insert the nested subtotals.
[How to insert the nested subtotals]
1.
On the Data tab, in the Outline group, click Subtotal.
The Subtotal dialog box is displayed.
2.
In the At each change in box, click the nested subtotal column.
In the example above, you would select Sport.
3.
In the Use function box, click the summary function that you
want to use to calculate the subtotals. In the example above, you would select
Sum.
Select any other options that you want.
4.
Clear the Replace current subtotals check box.
12.
Repeat the previous step for more nested subtotals, working from the outermost subtotals in.
[To display a summary of just the subtotals and grand totals, click the outline symbols
next to the row numbers. Use the and symbols to display or hide
the detail rows for individual subtotals.]
Create or delete a PivotTable or PivotChart report
To analyze numerical data in depth and to answer unanticipated questions about
your data, use a PivotTable or PivotChart report.
Create a PivotTable or PivotChart report
To create a PivotTable or PivotChart report, you need to connect to a data source
and enter the report's location.
1.
Select a cell in a range of cells, or put the insertion point inside of a Microsoft Office
Excel table.
Make sure that the range of cells has column headings.
2.
Do one of the following:
To create a PivotTable report, on the Insert tab, in the Tables group, click
PivotTable, and then click PivotTable.
The Create PivotTable dialog box is displayed.
To create a PivotTable and PivotChart report, on the Insert tab, in the
Tables group, click PivotTable, and then click PivotChart.
The Create PivotTable with PivotChart dialog box is displayed.
3.
Select a data source. Do one of the following:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 359
Choose the data that you want to analyze
1.
Click Select a table or range.
2.
Type the range of cells or table name reference, such as
=QuarterlyProfits, in the Table/Range box.
If you selected a cell in a range of cells or if the insertion point was in a table before
you started the wizard, the range of cells or table name reference is displayed in
the Table/Range box.
to temporariAlternatively, to select a range of cells or table, click Collapse Dialog
ly hide the dialog box, select the range on the worksheet, and then press Expand
Dialog
.
Enter a location. Do one of the following:
To place the PivotTable report in a new worksheet starting at cell A1, click
New Worksheet.
To place the PivotTable report in an existing worksheet, select Existing
Worksheet, and then type the first cell in the range of cells where you want to locate the PivotTable report.
Alternatively, click Collapse Dialog
to temporarily hide the dialog box, select the
beginning cell on the worksheet, and then press Expand Dialog
.
Click OK.
An empty PivotTable report is added to the location that you entered with the PivotTable
Field List displayed so that you can start adding fields, creating a layout, and customizing the PivotTable report. If you are creating a PivotChart report, an associated PivotTable report (associated PivotTable report: The PivotTable report that supplies the
source data to the PivotChart report. It is created automatically when you create a new
PivotChart report. When you change the layout of either report, the other also
changes.) is created directly underneath the PivotChart report for the location that you
enter. This PivotTable report must be in the same workbook as the PivotChart report. If
you specify a location in another workbook, the PivotChart report will also be created in
that workbook.
1.
2.
Create a PivotChart report from an existing PivotTable report
Click the PivotTable report.
On the Insert tab, in the Charts group, click a chart type.
You can use any chart type except xy (scatter), bubble, or stock.
Delete a PivotTable report
1.
Click the PivotTable report.
2.
On the Options tab, in the Actions group, click Select, and then click Entire PivotTable.
3.
Press DELETE.
[Deleting the associated PivotTable report (associated PivotTable report: The PivotTable report that supplies the source data to the PivotChart report. It is created
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 360
automatically when you create a new PivotChart report. When you change the
layout of either report, the other also changes.) for a PivotChart report creates a
static chart that you can no longer change.]
Delete a PivotChart report
1.
Select the PivotChart report.
2.
Press DELETE.
[Deleting the PivotChart report does not automatically delete the associated PivotTable report.]
Create a chart
1.
On the worksheet, arrange the data that you want to plot in a chart.
2.
Select the cells that contain the data that you want to use for the chart.
3.
On the Insert tab, in the Charts group, do one of the following:
Click the chart type, and then click a chart subtype that you want to use.
To see all available chart types, click a chart type, and then click All Chart
Types to display the Insert Chart dialog box, click the arrows to scroll through all
available chart types and chart subtypes, and then click the the ones that you want
to use.
[A ScreenTip displays the chart type name when you rest the mouse pointer over any chart
type or chart subtype.]
When you create a chart, the chart tools become available and the Design,
Layout, and Format tabs are displayed. You can use the commands on
these tabs to modify the chart so that it presents the data the way that you
want. For example, use the Design tab to display the data series by row or
by column, make changes to the source data of the chart, change the location of the chart, change the chart type, save a chart as a template, or select
predefined layout and formatting options. Use the Layout tab to change the
display of chart elements such as chart titles and data labels, use drawing
tools, or add text boxes and pictures to the chart. Use the Format tab to add
fill colors, change line styles, or apply special effects.
Apply a chart layout that contains titles
1.
Click the chart to which you want to apply a chart layout.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
2.
On the Design tab, in the Chart Layouts group, click a layout that contains titles.
Add a chart title manually
1.
Click the chart to which you want to add a title.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 361
2.
On the Layout tab, in the Labels group, click Chart Title.
3.
4.
Click Centered Overlay Title or Above Chart.
In the Chart Title text box that appears in the chart, type the text that you want.
Add axis titles manually
1.
Click the chart to which you want to add axis titles.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
2.
On the Layout tab, in the Labels group, click Axis Titles.
3.
Do any of the following:
To add a title to a primary horizontal (category) axis, click Primary Horizontal Axis Title, and then click the option that you want.
To add a title to primary vertical (value) axis, click Primary Vertical Axis
Title or Secondary Vertical Axis Title, and then click the option that you want.
To add a title to a depth (series) axis, click Depth Axis Title, and then click
the option that you want.
4.
In the Axis Title text box that appears in the chart, type the text that you want.
Remove a chart or axis title from a chart
1.
Click the chart.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
2.
Do one of the following:
To remove a chart title, on the Layout tab, in the Labels group, click Chart
Title, and then click None.
1.
To remove an axis title, on the Layout tab, in the Labels group, click Axis
Title, click the type of axis title that you want to remove, and then click None.
To quickly remove a chart or axis title, click the title, and then press DELETE. You can also right-click the chart or axis title, and then click Delete.
To remove chart or axis titles immediately after you add them, you can
click Undo on the Quick Access Toolbar, or you can press CTRL+Z.
Add data labels to a chart
On a chart, do one of the following:
To add a data label to all data points of all data series, click the chart
area (chart area: The entire chart and all its elements.).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 362
To add a data label to all data points of a data series, click once to select
the data series that you want to label.
To add a data label to a single data point in a data series, click the data series that contains the data point that you want to label, and then click the data point
again.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
2.
On the Layout tab, in the Labels group, click Data Labels, and then click the display option that you want.
[Depending on the chart type that you used, different data label options will be available.]
Remove data labels from a chart
1.
Click the chart from which you want to remove data labels.
This displays the Chart Tools, adding the Design, Layout, and Format tabs.
2.
Do one of the following:
On the Layout tab, in the Labels group, click Data Labels, and then click
None.
Protect worksheet or workbook elements
To prevent a user from accidentally or deliberately changing, moving, or deleting important data, you can protect certain worksheet. or workbook elements, with or
without a password (password: A way to restrict access to a workbook, worksheet, or part of a worksheet. Excel passwords can be up to 255 letters, numbers, spaces, and symbols. You must type uppercase and lowercase letters correctly when you set and enter passwords.).
Protect worksheet elements
1.
Select the worksheet that you want to protect.
2.
To unlock any cells or ranges that you want other users to be able to change, do the
following:
1.
Select each cell or range that you want to unlock.
2.
On the Home tab, in the Cells group, click Format, and then click Format
Cells.
3.
3.
On the Protection tab, clear the Locked check box, and then click OK.
To hide any formulas that you don't want to be visible, do the following:
1.
In the worksheet, select the cells that contain the formulas that you want to
hide.
2.
On the Home tab, in the Cells group, click Format, and then click Format
Cells.
3.
On the Protection tab, select the Hidden check box, and then click OK.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 363
4.
To unlock any graphic objects (such as pictures, clip art, shapes, or Smart Art graphics) that you want users to be able to change, do the following:
1.
Hold down CTRL and click each graphic object that you want to unlock.
This displays the Picture Tools or Drawing Tools, adding the Format tab.
[You can also use the Go To command to quickly select all of the graphic objects in a
worksheet. On the Home tab, in the Editing group, click Find & Select, and then
click Go To. Click Special, and then click Objects.]
2.
On the Format tab, in the Size group, click the Dialog Box Launcher
next to Size.
3.
On the Properties tab, clear the Locked check box, and if present, clear
the Lock text check box.
[You don't need to unlock buttons or controls for users to be able to click and use
them. You can unlock embedded charts, text boxes, and other objects created with
the drawing tools that you want users to be able to modify. ]
5.
On the Review tab, in the Changes group, click Protect Sheet.
6.
In the Allow all users of this worksheet to list, select the elements that you want
users to be able to change.
Worksheet elements
In the Password to unprotect sheet box, type a password for the sheet, click OK,
and then retype the password to confirm it.
[The password is optional. If you don't supply a password, then any user can unprotect the
sheet and change the protected elements. Make sure that you choose a password that
is easy to remember, because if you lose the password, you cannot gain access to the
protected elements on the worksheet.]
Protect workbook elements
1.
On the Review tab, in the Changes group, click Protect Workbook.
2.
Under Protect workbook for, do any of the following:
To protect the structure of a workbook, select the Structure check box.
To keep workbook windows in the same size and position each time the
workbook is opened, select the Windows check box.
3.
To prevent other users from removing workbook protection, in the Password (optional) box, type a password, click OK, and then retype the password to confirm it.
Name
Ramesh
Sangita
Amir
English
78
89
78
Math
56
65
98
Science
23
78
89
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 364
Bikash
Pranita
Dinesh
Kapil
Rupendra
Sunil
Ganesh
56
65
98
89
78
89
78
56
65
89
78
56
54
54
23
78
75
68
56
78
56
Total:
=Sum(English:Account)
Percent:
=total/no. Of subjects
Condition for result
All subjects>=32
Pass
Otherwise
Fail
=IF(AND(English>=32,Math>=32,Science>=32,Nepali>=32,Account>=32),"Pass","Fail")
Condition for division
Percent>=60
Percent<60,Percent>=50
Percent<50,Percent>=40
Otherwise
=if(and(Percent>=60),"First",if(and(Percent<60,Percent>=50),"Second",if(and
(Percent<50,Percent>=40),"Third","***")))
First
Second
Third
***
Condition for Remarks:
Percent>=80
Percent<80,Percent>=60
Otherwise
Do yourself
A grade
B grade
C grade
Basic Salary Sheet
Name
Ramesh
Sagita
Amir
Bikash
B. Salary
Traveling allowance10%
7500
6000
3500
3000
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 365
Pranita
Dinesh
Kapil
Rupen
Sunil
Ganesh
2500
4500
4000
6500
12000
9000
Furmulas:
Travelling All. 10%
=10%*B=Salary
House rent all.12%
=12%*B=Salary
Medical All. 10%
=10%*B.Salary
Gross Salary
=sum(B.Salary:Medical all.)
Condition for Income tax:
B.Salary>=9000
B.Salary<9000,B.Salary>=5000
B.Salary<5000,B.Salary>=3000
Otherwise
=if(and(B.Salary>=9000),10%*B.Salary,if(and(B.Salary<9000,B.Salary>=5000),5%*B.Salary,if(and
(B.Salary<5000,B.Salary>=3000),2%*B.Salary,0)))
Provident Fund:
=10%*B.Salary
Net salary
=Gross salary-Income tax-Provident fund
Tele-Communication Sheet
Name
Binay
Dines
Anil
Mina
Gita
Total Calls
250
300
90
65
100
Rental Charge
150
150
150
150
150
Extra charge
Total charge
Condition for Extra charge
total calls<=100
0
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 366
Otherwise
Per call Rs.*(total call-100)
Per call Rs. 2
Formula:
=if(and(total call<=100),0,2*(total call-100))
Total charge
=Rental charge+Extra charge
Vat 10%
=10%*Total charge
Govt. tax10%
=10%*Total charge
Net charge
=total charge+Vat+Govt. tax
Income Statement
Of Gemini Trade Link
Product Price
Rs.40
Product Cost
Rs.25
Overhead
15%
Quarter 1
Quarter 2
Quarter 3
Units sold
Rs.10,000
Rs. 20,000
Rs.30,000
Sales Revenue
Units sold * Product price
Cost of Sales Units sold * Product cost
Gross Margin Sales – Cost
Sales Force Rs. 8,000
Rs. 8,000
Advertisement
Rs. 10,000
Corp. Overhead
Sales Revenue * Overhead
Total Costs Sales Force + Adv. + Corp. Overhead
Profit
Gross margin - Total Cost
Profit Margin Profit / Sales Revenue
Rs.8,000
Rs.10,000
Quarter 4
Rs.40,000
Rs. 8,000
Rs.10,000
DREAMWEAVER [“CS4”](5 days)
CS4 is a professional website production and maintenance software (Interactive Development Environment “IDE”).
Uses of CS4
Plan and set up your site
Organise and manage your site files
Layout your web pages
Add content to pages
Create pages by hand coding
Set up web application for dynamic content.
Create dynamic pages
Test and publish sites.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 367
Features of CS4
Dreamweaver blends HTML, XML, Java script, ASP, Cold Fusion, JSP and PHP with
cutting edge server-side techniques and CSS design standard.
It offers different choice of user interfaces or workspace. (a) App Developer (b) App Developer Plus (c) Classic (d) Coder (e) Coder Plus (f) Designer (g) Designer Compact (h)
Dual Screen.
The window screens are arranged in differently in each workspace, based on the user
requirement.
All the workspaces contains four views. Viz (a) Code (b) Split Code (c) Design (d) Code
and Design.
Layout of CS4
Contains various toolbars and panels like Application bar, Document toolbar, Document window, panel groups, workspace switcher, tag selector, property inspector.
Welcome screen allows you to select new/existing/templates for documents. To toggle click “Edit – preferences” select general on left pane and select “show welcome screen” OR Ctrl + U”.
Switching workspaces.
Click “window – workspace layout – select the workspace from the options.
Click the pull down menu on right side of menus and select from the eight workspaces.
Switching Views
Click View and select either of the four views (Code/Split Code/Design/Code and
Design). Or
Click the icons available on the document toolbar, which is located below menu bar.
To toggle between views in split view use “ctrl + ` ” (backquote).
Features of Workspace
Workspaces in CS4 features a single large application window with menus, toolbars and
panels around it.
CS4 uses a multiple document interface (MDI). Opening many documents within one
application.
There is no change in the capabilities. But user controls are arranged differently.
You can have multiple document open in separate windows.
Property inspector panel is normally attached at the bottom.
You can customize your own workspace and save. Click “window – workspace layout –
new work space” to save. The window will appear as you set next time and this name
will appear on top in workspace switcher. To delete custom workspace go to manage
workspace and del.
To view color icons click “view – color icons.”
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 368
Window - workspace layout - designer/coder.
The Document window
This is the main working area in CS4 where the user writes the code and design view
displays the current document as is seen in browser.
Toolbars in CS4
To view toolbars click “View – Toolbars” and select the toolbar. There are four toolbars as given below : -
(a) The Application bar (menu bar)
Across the top of the application window contains a workspace switcher, menus (Windows only), and other application controls.
(b) The Title bar.
The title bar is located under the menu bar.
It contains the names of all the documents open in CS4.
Files which have not yet been saved are displayed with * (asterisk).
To switch to the document click its tab.
To tile or cascade tabs click “windows” “cascade/tile horizontally/tile vertically”.
(c) Document toolbar:
Contains buttons to toggle between views and some common commands and options related to
viewing the document and transferring it between the local and remote sites.
Buttons: Code View : Lets you to work with code.
Code and Design Views : window splits and displays both Code and Design views.
Selected, Design View on Top becomes available.
Design View : Lets you design a document with graphical interface.
Note: while working with XML, JavaScript, CSS, or other code based file types design
and split views are not available.
Live View : Displays a non-editable, interactive, browser based view of the document.
Live Code View : Displays the actual code used by the browser to execute the page.
Document Title : Allows to enter title for document.
File Mgmt : Displays the File Management pop-up menu.
Preview/Debug in Browser: Allows you to preview or debug your document in a
browser. Select a browser from the pop-up menu.
Refresh Design View : Refreshes Design view. Unless you save or click this button,
design view is not updated.
View Options: Settings for view like word wrap, line nos, highlighting invalid code, syntax coloring, auto indent, display syntax errors and rulers are available. You can place
design view on top/bottom.
Visual Aids: Lets you use different visual settings like borders for tables frames etc.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 369
Validate Markup Lets you validate the current document or a selected tag.
Check Browser Compatibility Lets you check if your CSS is compatible across different browsers.
(d) Standard Toolbar
(Not displayed in the default workspace layout.) Contains buttons for common operations from the File
and Edit menus: New, Open, Save, Save All, Print Code, Cut, Copy, Paste, Undo, and Redo. Use these buttons just as you would use the equivalent menu commands.
(e) Status bar :
The Status bar at the bottom of the Document window provides additional information about the
document you are creating.
Buttons: Tag selector : Shows the hierarchy of tags surrounding the current selection. Click on
the design view and Rt Click on any tag and select (a) “remove tag” for removing tag (b)
“quick tag editor” for editing the tag (c) “collapse full tag” for collapsing the tag (d) “collapse outside full tag” for collapsing the tags other than the selected one.
Select Tool: Enables/disables hand tools.
Hand Tool: Lets you big images to be dragged and brought into picture.
Zoom tool : Let you set a magnification level for your document.
Document size/download time : Shows an estimation of document size and download
time, including all dependent files such as images and other media files.
Encoding indicator : Shows the text encoding for the current document.
(f) The Coding toolbar:
Enables standard coding operations, such as collapsing/expanding code, highlighting invalid
code, applying/removing comments, indenting code, and inserting recently used code snippets.
Appears vertically on left side and is visible only in Code view.
You can hide it (View > Toolbars > Coding).
(g) The Style Rendering toolbar :
(Hidden by default.) Contains buttons that let you see how your design would look in different
media types if you use media-dependent style sheets. It also contains a button that lets you
enable or disable Cascading Style Sheets (CSS) styles.
Property inspector
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 370
Click “window – properties” to see the property inspector.
Located under the design view window, it lets you view and change properties of selected object.
Buttons appear according to the context (different property buttons for different items like
text, image etc).
If you want to edit properties of a particular element, select it first and edit in property inspector.
If your changes are not immediately applied in the Document window, then : (i) Click outside the property-editing text fields.
(ii) Press Enter (Windows) or Return (Macintosh).
(iii) Press Tab to switch to another property.
Context Menus
To edit a particular element, right click on the element and you get the context menus
pertaining to that particular element only.
Select and perform the task.
Panels in CS4
Helps you monitor/modify, with quick access to accomplish the task.
To view panels click “window” and select panels.
To expand a panel, double-click its tab.
Rt click on any panel and select “collapse to icons” to make the panels collapse like
icons in a toolbar.
Drag the borders to resize the panes.
To toggle to on/off the panels use F4.
Click “windows” and select any panel to display.
You can move the panels and dock as a pane in another pane by just holding the title
bar and moving as required.
Click “>>” or “<<” symbol in the title bar to reduce or expand the panels.
To restore default settings of panels click “windows – workspace layout – resetdesigner”.
Accessing Panels(Keyboard shortcuts)
Panel
Insert
Property Inspector
CSS
AP
Elements
Database
Bindings
Keyboard
shortcut
Ctrl + F2
Ctrl + F3
Shift + F11
F2
Ctrl + Shift + F10
Ctrl + F10
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 371
Server Behaviours
Components
Files
Snippets
Tag Inspector
Behaviour
History
Frames
Code Inpector
Ctrl + F9
Ctrl + F7
F8
Shift + F9
F9
Shift + F4
Shift + F10
Shift + F2
F10
(a) Insert panel
Contains buttons for creating and inserting objects such as tables, images, and links.
Buttons are organized in categories.
Additional categories appear when the current document contains server code, such as
ASP or CFML documents.
Once a selection is made, it is seen as the default for the next selection time.
You can drag and set as a toolbar or resize Insert toolbar.
Button categories:
Common : You can create/insert objects like images & tables.
Layout : You can insert tables, table elements, div tags, frames, and Spry widgets. Select
layout from “common” and set view as Standard (default)/Expanded Tables.
Forms : Contains buttons for creating forms and inserting form elements, including Spry validation widgets.
Data : Lets you insert Spry data objects as well as other dynamic elements like recordsets, repeated regions, and record insertion and update forms.
Spry : Contains buttons for building Spry pages, including Spry data objects and widgets.
InContext Editing : Contains buttons for building InContext editing pages, including buttons for
Editable Regions, Repeating Regions, and managing CSS classes.
Text : Lets you insert a variety of text- and list-formatting tags, such as b, em, p, h1, and ul.
Favorites : Lets you group/organize.
Server-code : Available for pages using ASP, CFML Basic, CFML Flow, CFML Advanced, and
PHP. These categories provide server-code objects that you can insert in Code view.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 372
(b) Files panel
Will allow you to organize your files and folders. You can manage sites by clicking on
“manage sites” on the top.
(c) CSS Styles Panel
Lets you track the CSS rules and properties.
Edited properties are applied immediately, and a preview is given.
There are two modes. These are available on the top of the pane.
View buttons on lower left bottom of panel for both modes are (a) Category (b)List (c)
Properties
Buttons on bottom right of panel are (a) link CSS (b) New Rule (c)Edit rule.
1) Current mode: effects current selection.
Displays 3 panes in this mode: (i) Summary: for Selection pane that displays the CSS properties for the current selection.
(ii) Rules: displays the location of selected properties (or a cascade of rules for the selected tag, depending on your selection)
(iii) Properties: lets you edit CSS properties for the rule defining the selection.
(2) All mode: effects entire document.
Displays two panes in this ode : (i) “All Rules Pane” (on top): Displays a list of rules defined in the current document
and style sheets attached to current document.
(ii) “Properties pane” (on bottom) : Lets you edit CSS properties for any selected rule
in the All Rules pane.
Search
CS4 lets you search for tags, attributes, and specific text within tags of a document.
Select “Edit – Find and Replace” or (Ctrl + F).
Reference
CS4 lets you search for helpful reference information on any tag, link, etc. In code
view, rt click on the tag element and select “Reference/Shift F1”.
Validation
CS4 lets you check for code/syntax errors. Click “file – validate” and select “as xml”
for XML/XHTML and “Mark up” for other files.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 373
Browser Compatibility
Checks for target browser compatibility with the current code.
Click “file – check page – browser compatibility”.
You can convert files to different browser versions by clicking “file – convert” and select the ver of browser.
Link Checker
Lets you find and fix broken, external, and orphaned links.
Click “file – check page – lilnks”.
CS4 checks links within the site only.
Site Reports Enable you to improve workflow and test HTML attributes in your site.
Workflow reports include
checked out by, recently modified, and design notes; HTML reports include combinable nested font tags, accessibility,
missing Alt text, redundant nested tags, removable empty tags, and untitled documents.
FTP Log Enables you to view all FTP file-transfer activity.
Server Debug Lets you view information to debug an Adobe® ColdFusion® application.
Setting Preferences
Click “edit – preferences” (OR) “Ctrl+U” and select the category from left pane and
select the options on the right pane.
Setting Keyboard shortcuts
Click “edit – keyboard shortcuts”. Select from the current set for making default setting
from the pull down menu.
Make a copy of current set and set your own shortcuts by entering new shortcuts using
“+/-“ symbols.
Select the icon for export set to HTML (third) and enter a file name which will appear as
html file giving the complete shortcuts.
Manage Extensions
Extensions can be included from a website for latest upgrades of CS4 by clicking
command – manage extensions.
Creating a Web Page
Select “html” in the opening menu or click “file – new” and select option under “page
type”.
For creating page from templates select option from the “Layout” column.
Creating a Web Site
Click “site – new site”.
Enter any name for the site in first screen.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 374
For URL enter any folder name and click “next”.
Click “No I do not want to user server technology” in second screen and click “next”.
Select or type the directory for your files to be stored in third screen and click “next.
Type or browse the folder name to store files again and click “next”.
Select “Do not allow check in and check out” and click “next”.
Click “Done”.
Display Web page/site
click “F12” or “file – preview in browser” and select the browser.
Save the files before seeing in the browser.
Setting Page title
Click in the text box of document toolbar and enter the title (OR) click “page properties” in property inspector and select “title/encoding” in the left pane and enter the
title in right pane.
Setting Page background
Click “Modify – page properties” (OR) “Ctrl + J” (OR) click “page properties” on property inspector. Select “appearance(html)” in the left pane and set the background
color, image, text color, links color, margins etc and click “apply”.
Formatting Text
Using Quick tag editor : Click “Modify – Quick Tag Editor” (OR) Ctrl+T.
Bold : Click “format – style” and select bold/italic/undersline/strike through etc (OR)
“Ctrl+ B” for bold and “Ctrl+I” for italic (OR) Select “Text” in Insert Panel and click “B”.
Inserting Paragraphs : Select the text and click “format – Paragraph format - paragraph”. (OR) “Ctrl + Shift + P” (OR) Select “Text” in Insert Panel and click “paragraph”.
Inserting Heading tags: Select the text and click “format – Paragraph format” and select headings from 1 – 6. (OR) “Ctrl + 1/2/3/4/5/6” OR select “text” in Insert Panel and
select heading tag.
Alignment of text : Select the text and click “format – Align” and select
Left/right/center/justified (OR) Ctrl+Shift+Alt+L / Ctrl+Shift+Alt+R / Ctrl+Shift+Alt+C /
Ctrl+Shift+Alt+J.
Indenting parapraphs : Select the text and click “format – indent/outdent” (OR)
“Ctrl+Alt+]” or “Ctrl+Alt+[“.
Setting Font Style & sizes with CSS:
NOTE :As font size, underline etc are deprecated you are supposed to use font
style attribute or css styles in the file.
Setting Font colors : Select the text and click “format – color” and select a color from pallette.
Setting Font size :
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 375
Select the text and click “format – css styles – new” (OR) click on “CSS” button on the extreme left side of property inspector and select “new css rule” from “targeted rule” option
menu and click on “edit rule”.
Select Class/ID/Tag from the selector type.
Select or type a new class name and click ok
You have two panes. Left pane for caegory and right pane for type settings.
Select “type” under caterogy and select font family, style, size, line height, color, weight,
transform, line over/through etc.
Select “background” under category and select background color, image, position, repeat etc.
Select “block” under category and select word spacing, character spacing, text align, indent
etc.
Select “box” under dategory and select box height, width, margins, padding etc.
Select “border and set style, width, color etc.
Character spacing : Select “format – font” on the character & spacing tab select the option.
Adding Bullets & numbering Lists
Click “format – list” and select the type of list style. For setting formats and starting values select
the text click “format – list – properties” OR select “List Item” in the property inspector.
Using special characters in web
Place the cursor and click “insert – symbol” and select from the list.
Using themes
Select “format – themes” and select the theme from the right pane.
Inserting picture
Place the cursor and click “insert – picture” and select from the options from scanner/from
file/from clip art/flash format etc and browse for the file.
Formatting picture Click on the picture and select ”format – properties” OR Alt+Enter.
For wrapping, layout, border thickness and size select from the “appearance” tab.
For resolution settings, description of picture, hyperlink and setting target frames select from the
“General” tab.
Exploring various views
(a) Page view
There are four views depending on your specific needs.
• Design view You can design and edit Web pages in the default Page view, Design
view.
• Code view You can view, write, and edit the HTML tags yourself.
• Split view You can review and edit Web page content in a split screen format that offers you simultaneous access to both the Code and Design views.
• Preview view You can approximate how the page will look in the Web browser without having to save your page.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 376
(b) Folders view
Allows to work with the files and folders directly, and to organize the contents of your Web site. You
can also create, delete, copy, and move folders in this view.
(c) Remote Web Site view
Used to publish an entire Web site or individual files. You can ensure that sites with the same
content are up-to-date with recent changes. Status, such as Don't Publish, Changed, Unchanged,
New, and Conflict are shown for assistance.
(d) Reports view
You can calculate the total size of the files in your site, show which files are not linked to other files,
identify slow or outdated pages, group files by task or person they're assigned to, and more.
(e) Navigation view
Provides hierarchical view of Web pages. Enables you to arrange the pages in your site by clicking on a page and moving it to a new location in the site.
(f) Hyperlinks view
Shows the status of the hyperlinks in your Web site in a list including both internal and external
hyperlinks, and uses icons to indicate whether the hyperlinks have been verified or are broken.
(g) Tasks view
Displays all the tasks in your Web site in a column format and provides current information about
each task under various headings.
Resizing the components
Click on the buttons/combobox/textarea/radio buttons etc and hold the mouse and drag to
resize the components.
Assigning properties
Click on the component you want to set the properties, and click “format – properties” and
set the properties. (OR) Right click on the component and select “Form Field Properties”.
(OR) click on the component and enter “Alt + Enter” for editing the properties of the said
component.
Finding Text/code
Click “Edit – Find” (OR) “Ctrl + F” to find any text/code in the code layout of page view.
Select the location from the “find where” column. Select the direction of search in “direction”
column and select “Advanced” column for matching the case, ignore white spaces etc.
Replace text/code
Click “Edit – Find” OR Ctrl +F to find and select the “replace” tab and enter the text/code you
want to replace in the second text box.
Finding & replacing HTML Tags
Click “Edit – Find” or Ctrl + F and select the “HTML Tags” tab. Select the first text box to
find the contents and second text box for replacing the contents.
Going to line/bookmark/function.
Click on “Edit – go to bookmark” select option. OR “Ctrl + G”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 377
Click on “Edit - go to function” select option.
In code view click “edit – go to line” and specify the line no. OR Ctrl+G
Adding Bookmarks
Click on the text and select “insert – bookmark”, (OR) Ctrl + G and type the name of bookmark.
Inserting Marque
Select the place where you want to insert the marquee and click “insert – web component”.
From the component type select “dynamic effects” and from the choose an effect select
“marquee”. Click OK. You set the properties of the marquee in the window for background, color, size, direction etc.
Setting Hyperlinks
Select the text and click “insert – hyperlink”,
(a) Creating links to other objects: Browse for the file from the file dialog box.
(b) Creating links within page : First create a bookmark, and select “insert – hyperlink” in the file
dialog select “bookmark” button and point to the bookmark you have created and click ok.
(c) Creating links to mails: Select the “email address” button at the lower left of the file dialogue
box and enter email address and subject which will appear automatically when clicked on it.
Picture hyperlinks with hotspots
Create hot spots and create hyperlinks to them. First insert an image. See that the picture
toolbar is available, else go to view – toolbars – picture. Select the rectangular tool/circle
tool etc from the extreme right of the picture toolbar. Click and drag on the image to
create a hot spot. You are prompted with the hyperlink dialog box. Create a hyperlink to
either image/web/bookmark etc. To create uneven diagram select polygon tool.
Tables
Creating Tables
Click “Table – insert – table” & select the no of columns and rows. If you want to adjust the
other properties like layout, borders, background, you can set in this dialog box.
Click “Table – draw table” and you are provided with a table toolbar for drawing table.
Click “Table – Layout tables and cells” for templates on tables, which appear on the right side
of the pane.
Inserting Rows/Columns
Click”Table – rows & columns”, and select the columns/rows and select above/below selection for rows and left/right of selection option for columns.
Merging Rows/columns
Select cells and click “table- merge cells”
Splitting cells
Select cells and click “table – split cells” and select columns/rows and no of splits.
Inserting Caption
Select “table – insert – caption”
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 378
Formating text
Select the text and select the related tool from formatting toobar by clicking on icons for text
color, alignment, bold, italic, underline, font type and size etc. (OR) select from the format menu.
Formatting cells
For Cell text alignment, spanning, borders, and background click “table – table properties –
cell”.
Formatting Table
Click one of the cell and click “table – select – table”. Now click “table – table properties –
table”.
You can edit the table for alignment, cell padding, cell spacing, border size, color and background color/picture.
Inserting a Frame
Click New and select “more page templates” from the right side panel. Select the frame style
from the given options. Every frame comes up with two buttons
(a) Set Initial Page : click on this button if you want to set your desired html file for the frame.
(b) New Page : click on this button if you need to insert a new page for the frame.
Inserting inline frame
Inline frames can be placed anywhere inside a plain area they exactly like Text Area boxes.
Place the cursor and Click “insert – inline frame”. Click on the border and resize accordingly.
Editing Frames
For writing code for newly created pages for the frames, click inside the frame and click
“frames- open page in new window.” Start coding for the new page.
Splitting Frames
Place the cursor inside the frame which you want to split and click “frames – split frame” resize and set properties accordingly.
Deleting Frames
Place the cursor inside the frame which has to be deleted and click “frames – delete frame”.
Setting Frame Properties
For setting the frame properties click inside the frame you want to set the properties and
click “frames – frame properties”. OR right click on the frame and select the “frame
properties”.
Setting Page properties
Click inside the frame and click “File – properties” OR right click on the frame and select
“page properties” and adjust the properties.
Using Navigation bars
For using a frame for navigation, use the left frame.
Targeting Frame
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 379
Select a text to hyperlink.
Click “target frame button”.
Select the frame.
Inserting audio/video files
Insert an image or text to connect to the video/audio. Create hyperlink by clicking “insert –
Hyperlink” or ctrl +K. Use the “screen tips” button on the top right cornor of the window, and type the message which will appear when the mouse is on the link. Point to
any video/audio file and click Ok.
Forms
Place the cursor and click “insert – form”. After inserting the form you are placed with two
buttons “submit” and “Reset” by default. The dotted line around the buttons specify the
borders for the form.
To insert the components, place the cursor first and click “insert – form” and select from the
available components.
Use tabs/spaces/enter to space and set the layout of the components.
Place the cursor and type the text wherever needed.
Use the format tools to modify the text color, size etc.
Click the component and resize by dragging with mouse.
Rt click on the component and select “form field properties” (OR) Select the component and click
“format – properties” (OR) click “Alt + Enter” to set the properties.
Creating Style Sheet
Click ”File – new” and select “text file” from the right panel.
To view the style toolbar, click “view – toolbars – style”.
Start creating style tags with style toolbar.
To save as css file click “file – save” and type the name of the file in first text box, and select “CSS
Files” option from the drop down menu of second text box. Click “ok”.
Creating style sheets from templates
Click “file – new” and select “More page templates” and select a template from the “Stye Sheets” tab
of the window.
Save it.
Styles for HTML tags using style tools
Place the cursor in the CSS file (go to “code view” if you are editing styles from html file) and
click “style” button in the style toolbar.
Select “html tags” in the bottom left under “list” pull down menu.
Click “New” button to create a new style and type the name of the tag in the “selector” text box.
Click “format” and select font/paragraph/border/numbering/position.
Set the dimensions and click “ok”.
Modify existing styles
Click “style” button on the style toolbar.
Click on the selector(tag) which you want to modify from the list of all available options under
“styles” on top left.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 380
Click “modify” button and select options from “format” button at bottom left.
Creating CSS class styles with style tools
Place the cursor in the CSS file and select “style” button from the toolbar.
Select “user-defined styles” from the bottom left under “list” pull down menu.
Click “new” and type the selection(class name) in the text box on the top and select options from
the format at bottom left.
Linking CSS to HTML
In the html file in which you like to include the style sheets, click “format – style sheet links”.
In the window, click “Add” and browse for the style sheet file and click “ok”.
Use “move up” and “move down” buttons to adjust the preference of the files.
Click “edit” to edit the file.
Select the file from the list and click “remove”.
Dynamic HTML
Provides the mechanism that helps in changing the content & appearance of the page dynamically or at run time.
Click View – toolbars – DHTML effects.
For swapping image.
Insert an image click “insert – picture – from file” and browse for picture.
Click on Image, select “choose an event” tab on DHTML toolbar and select “mouse over”.
Select “Choose an effect” tab and select “swap picture”.
Select “choose settings” tab and select “choose image” and browse for another picture.
After clicking ok. In the IE you find that the picture changes when the mouse is over the
image.
Change text
Insert some text. Highlight it.
Select “choose an event” and click “on mouse over”.
Select “choose an effect” and click “formatting”.
Select “choose settings” and select either format or border and set them, which would be
seen when the mouse is over the text.
Photo gallery
Insert a new page and click “insert – web component” and select “photo gallery” from the left
pane.
Select the gallery style on the right pane and click “Finish” button.
On the “Pictures” tab select “add” button and browse the photo files.
On the layout tab you set the photo styles.
Insert captions in the text box below.
Set sizes on the right side of the right pane. Click OK.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 381
How to publish
Click “File – Publish site”.
Click http://localhost/test in the remote web site location.
Select all files on the left tab and click on the right arrow in the middle. See that the files
appear on the right panel. click “Publish website” button.
Click on “view on remote website” to see the website.
Cascading Style Sheets (CSS)
Styles Sheet is a collection of formatting styles, which can be applied to a web page.
They are a way to control the look and feel of your HTML
Are powerful mechanism for adding styles like fonts, colors, spacing etc.
Use the "style" you create on any webpage you wish!.
Even multiple external style sheets can be referenced inside a single HTML document.
Priority: (a)Inline style (b)Internal style sheets (c)External file (d) Browser default.
Order of occurrence : If external file is mentioned before the internal style in head tag, external
style will take preference.
Basic Syntax : Style can be given in numerous ways but basic syntax is : Selector {attribute1:value1; attribute2:value2……}
Selector is any possible HTML tag/class name.
Attributes are placed in curly braces and form variable and value pairs.
variable and values are separated by a colon(:)
Pairs of attributes separated by semicolon(;).
Ex. p {font-family:"sans serif"}
Note: If the value has multiple words, put quotes around the value.
Inline Styles
Inline styles are given inside the tags of H1, P etc. with a style attribute, which can contain
any CSS property.
Ex. <p style="color:sienna;margin-left:20px">This is a paragraph.</p>
Inline styles losses advantages of style sheets by mixing content with presentation. Use for
styling a single occurrence of an element.
Internal Style Sheets
You define internal styles in the head section(inside HEAD tag) by using the <style> tag,
<Style> tag has the attribute of type, which carries value “text/css”.
EX: Internal style sheets
<html>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 382
<head><title>Internal style sheet effects</title>
<style type="text/css">
hr {color:sienna}
p {font-family:GEORGIA; font-size:34pt; letter-spacing:15; line-height:3pt;}
body {background-color:rgb(100%,100%,0%);}
</style>
</head>
<body>
<h1>Look out for the CSS Styles inside Html file.</h1>
<hr size=4 noshade>
<P>
CASCADING STYLE SHEETS<br/>
CASCADING STYLE SHEETS<br/>
CASCADING STYLE SHEETS<br/>
CASCADING STYLE SHEETS<br/>
CASCADING STYLE SHEETS<br/>
CASCADING STYLE SHEETS<br/>
</p>
</body>
</html>
Using multiple values for variables.
Multiple values can also be assigned to one variable, in such cases the first takes precedence
over the last value.
Ex. Using multiple values
<HEAD><title>multiple values for attributes</title>
<STYLE type="text/css">
p { font-family:"monotype corsiva", impact; font-size=34; background-color:#ffff00}
p {border-style:groove; text-align:center}
body {background-color:sienna;}
</STYLE></HEAD>
<BODY>
<P>This font is Monotype Corsiva</p>
<P>Delete "Monotype" from font-family name and see this text appear in impact.<br/>
proving the order of preference.</p>
</BODY>
</html>
Grouped Tags.
One attribute list for more tags.
Ex. h1,h2,h3,h4,h5,h6 {color:green}
Class Selector
One class for reference.
Ex.
p.right {text-align:right}
p.center {text-align:center}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 383
Usage :
<p class="right">This paragraph will be right-aligned.</p>
<p class="center">This paragraph will be center-aligned.</p>
Ex. Using classes for style
<HEAD>
<STYLE type="text/css">
H1.myclass {border-width: 1; border: solid; text-align: center}
</STYLE>
</HEAD>
<BODY>
<H1 class="myclass"> This H1 is affected by our style </H1>
<H1> This one is not affected by our style </H1>
</BODY>
Multiple Cascading classes
In the example below first the class “center” properties will be applied and then class “bold”.
Usage: <p class="center bold">This is a paragraph.</p>
NOTE: Do not start class with a number.
Universal usage of Class
Can be used by any tag just by giving the class name inside the tag.
Ex .center {text-align:center}
Usage <p class="center">This is a paragraph.</p>
<h1 class=”center”>This is a praragraph.</p>
Attaching style class with attributes of tags.
Below style applies to all input elements that have a type attribute with a value of "text"
Ex. input[type="text"] {background-color:blue}
Usage: <input type=text maxlength=23>Enter your name</input>
Attaching style class with id names of elements
Below style applies to all elements containing the id name greenitem.
Ex. #greenitem {color:green}
Usage: <input type=text id=greenitem maxlength=23>Enter your name</input>
Ex. Using Styles with ID nos.
<html>
<HEAD>
<title>using styles with id nos</title>
<STYLE type="text/css">
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 384
#myid {border-width: 1; border: solid; text-align: center}
</STYLE>
</HEAD>
<BODY>
<H1 class="myclass"> This H1 is not affected </H1>
<H1 id="myid"> This H1 is affected by style </H1>
<H1> This H1 is not affected </H1>
</BODY>
</html>
CSS Comments
A CSS comment begins with "/*", and ends with "*/", like this:
Ex.
P {text-align:center;
/*This is comment comment*/
color:black; font-family:arial}
External Style Sheet
External style sheets are files with .css extention. Tags inside the file are similar. It is connected to the main html with <link> tag which carries two attributes giving details of the
files. “rel” attribute specifies that it is a stylesheet. “type” attribute mentions that the
content are of type “text/css”. Href attribute gives the url pointing to the css file.
Ex:
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>
Ex. Contents of main.html
<html>
<head><title> Using external style sheets</title>
<link rel=”stylesheet” type=”text/css” href=”ex1.css” />
</head>
<body>
<h1>This header is 36 pt</h1>
<h2>This header is blue</h2>
<hr noshade>
<p> This paragraph has a left margin of 50 pixels</p>
</body>
</html>
Contents of ex1.css file
Body {background-color:yellow}
H1 {font-size: 36pt;}
H2 {color:blue;}
Hr {color:navy;}
P {margin-left:50px;}
a: link {color:green;}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 385
a:visited {color:yellow;}
a:hover {color:black;}
a:active {color:blue;}
Compatability
Old browsers simply ignores unknown tags so comment out the style tag for making it compatible with old browsers, so that the contents of style tag are not displayed.
Ex.
<head>
<style type="text/css">
<!-hr {color:sienna}
p {margin-left:20px}
-->
</style>
</head>
Default language
Default language should be mentioned with the style tag using the “type” attribute.
Ex. <META http-equiv="Content-Style-Type" content="text/css">
Basic attributes/values of style tag The attributes that can be specified to the <style> tag
are : font arrtibutes, color & background attributes, text attributes, border attributes, margin attributes & list attributes.
Font Attributes
Property
fontfam
ily
Description
Values
Example
specifies name
arial, helvetica…etc
fontstyl
e
specifies style
normal, italic, oblique
font –
wei
ght
thickness/weigh
t
lighter, normal,
bold,
p{fontfamily:futur
a, helvetica,
arial,
sansserif}
h2 {fontfamily:
futura,
helvetica, arial: fontstyle;
italic)
p{fontweight:
bold)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 386
fontsize
Text Properties
Proper
ty
size of font
bolder,
100,
200,
….900.
xx units, %,
larger,
smaller,
xxsmall, xsmall,
small,
medium,
large, xlarge,
xx-large.
Description
Values
Example
text –
tran
sfor
m
the case
of
the
text
is set.
capitalize,
uppercase, lowercase,
none
textalig
n
aligns
content
horizontally
acros
s the
page.
indents
the
text
in the
para
by
the
specified
number
left, right,
center,
justify
p{texttransform:capiltali
ze}
h1 {texttransform:
uppercase}
h4 {textalign:center}
textinden
t
xx units
p {textalign:7em}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 387
linehei
ght
wordspa
cin
g
letterspa
cin
g
textdecoration
of
characters
specified
the
heigh
t of
the
text
along
with
the
line
space
abov
e the
line
and
below
the
line
specified
the
space
betwee
n the
characters
specified
the
space
betwee
n the
characters
specifies
the
formatting
for
xx units
p{line-height:
12pt}
xx units
p{word-spacing:1
pt}
xx units
p {letterspacing:5}
underline,
overline,
linethrough,
blink,
none
h1 {textdecoration:
underline}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 388
the
text.
Color & Background attributes
Property
Description
Color
specifies
the
color
backgrou
ndcolor
specifies
the
back
grou
nd
color.
Value
s
color
na
me
,
he
x
val
ue,
rg
b(r
%,
g
%,
b
%)
rg
b(r
,g,
b)
color
na
me
,
he
x
val
ue,
rg
b(r
%,
g
%,
b
%)
,
rg
b(r
,g,
b).
Example
p{color: red}
p{color:#ff0000}
p{color:10%,20%,20%
}
p{color:255,200,0}
h1 {background-color:
green}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 389
backgrou
ndimage
Backgrou
nd
backgrou
ndattach
ment
backgrou
ndposition
specifies
the
back
grou
nd
image.
specifies
how
back
grou
nd
image
will
be
plac
ed.
specifies
if
the
image
is
fixe
d or
will
it also
mov
e.
specifies
the
posit
ion
of
the
back
grou
nd
image.
url(url
na
me
)
body {backgroundimage:
url(..images/sand.gi
f)}
repeat,
re
pe
atx,
re
pe
aty,
no
re
pe
at.
scroll,
fix
ed
body {backgroundimage:url(../images/sa
nd.gif)}
backgroundattachment:fixed}
vertical
%,
ho
rizo
nta
l
%,
to
p,
ce
nte
body {backgroundimage:
url(..images/sand.gi
f); background position: center}
body{backgroundimage:
url(..image/sand.gif
); backgroundattachment : fixed}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 390
r,
bo
tto
m,
lef
t,
ce
nte
r,
rig
ht.
Border properties
Property
borderstyle
none
Description
Values
Example
sets the style of
the elements border.
dotted,
dashed
, solid,
double
,
groove
, ridge,
inset,
outset.
color
name,
hex
value,
rgb(r%
,g%,
b%),
rgb(r,g
,b).
width value,
style
value,
color
value.
table {bordrstyle:das
hed}
bordercolor
sets the color
of the elements’
border
Border
bordertop
borderbottom
borderleft
borderright
sets the width,
color, and
style of the
border simultaneously,
table {bordercolor:
red}
table {border:thick
double
red}
table {border-top:
thin
dashed
red}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 391
Margin Attributes
Property
Description
Values
margintop
specifies
the position of
the text
in the
page
specifies
the bottom
margin
of the
text.
specifies
the left
margin
of the
text
xx
specifies
the
right
margin
of the
text
xx
marginbottom
marginleft
marginright
List Attributes
Property
liststy
letyp
e
Description
specifies
the
symbol
that
appears
in
front
of a
list
item.
unit
s,
%,
auto
xx
unit
s,
%,
auto
xx
unit
s,
%,
auto
unit
s,
%,
auto
Valu
es
disc,
ci
rc
le
,
sq
ua
re
,
de
ci
m
al
,
Example
div {margintop:2em}
div {marginbottom: 10%}
div {margin-left:
6em}
div {margin-right:
1em}
Example
ul {list-style-type:square}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 392
liststy
leim
ag
e
liststy
lepo
specifies
the
image
to
serve
as a
bullet
for
list
items
.
specifies
the
position
lo
w
er
ro
m
an
,
u
p
pe
rro
m
an
,
lo
w
er
al
p
ha
,
u
p
pe
r,
al
p
ha
url(url
na
m
e)
insi
de
,
ul{list-styleimage:url(../iages/smile
y.gif)}
ul {list-style-position:
outside}
ul {list-style-position: inside}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 393
sitio
n
of the
bullet
that
appears
in the
list
item.
o
ut
si
de
Ex. List and background demo
<html>
<head><title>This is demo of list and background</title>
<style type="text/css">
body {background-color:#ffff00;}
h1 {background-color:black; color:yellow; text-align:center; text-transform:uppercase;}
ul {list-style-image:url("icon.jpg");list-style-position:inside}
ul {font-family:impact; font-size:32}
</style>
</head>
<body>
<h1 style="myclass">This is the list of subjects in module 01</h1>
<ul>
<li>&nbsp HTML
<li>&nbsp Front Page
<li>&nbsp Dreamweaver CS4
<li>&#160 MY SQL
<li>&#160 MS Access
<li>&#160 PHP
</ul>
</body>
</html>
DHTML
DHTML combines HTML with cascading style sheets (CSS) and scripting languages like javascript and vb script.
Using effect on part of the text with <SPAN> …</SPAN> tag.
This tag is used to set the boundaries of the rules stylling specifications.
Ex. Using span tag.
<html>
<head><title>Span Demo</title>
<style type="text/css">
h2 {font-family:impact; font-style:oblique;text-transform:uppercase;}
.question {color:red;}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 394
.big {font-size:32; font-family:garamond;color:blue}
</style>
</head>
<body>
<h2>The words from here <span class="big">start changing</span>and now its back to normal</h2>
</body>
</html>
Using <div> …</div> tag
A web page can be divided into segments or divisions called divs. Each segment starts with
<div> and ends with </div>.
These segments can be placed anywhere on the page.
Takes one of 2 values for a position (attribute):
o Absolute: position the segment with reference to top/left of browser window.
o Relative : position the segment with reference to other elements on the page.
Ex. Using Div tags and borders styles of CSS.
<html>
<head>
<title>This is demo of background</title>
<style type="text/css">
<body {background-color:#ffff00;}
h1 {background-color:black; color:yellow; text-align:center; text-transform:uppercase;}
.classthree {background-color:red; position:absolute;}
.classthree {left:550; top:250; width:50; border-style:outset; margin-left:32pt; borderwidth:18pt}
</style>
</head>
<body>
<h1> change sizes for border/top/left positions to move this div</h1>
<div class="classthree"> <H1>TEXT THREE</H1></div><br/>
</body></html>
Using Filters
“filter” is an attribute of <style> tag. Filter variable contains values which calls an in-build
function for the text effects.
Ex. Using filters
<html><head><title>using filter effects</title>
<style>
h1{width:100%;font-family:arial;font-size:34pt; text-align:center;filter:glow(color:blue)}
h2{width:100%;font-family:arial;font-size:34pt}
h2{border-color:blue;text-align:center}
</style>
</head>
<body>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 395
<h2 style="filter:glow(color:#0000ff)"><font color="white">APTECH COMPUTER EDUCATION</font></h2>
<h2 style="filter:blur()"><font color="red">We Change Lives Globally</font></h2>
<h2 style="filter:fliph()">Solution Provider</h2>
<h2 style="filter:flipv()">Computer Education</h2>
<h2 style="filter:shadow(color:gray)">At the World Cheapest Price</h2>
<h2 style="filter:dropshadow(color:blue)"><font color="blue">Modular Courses</font> </h2>
<h2 style="filter:wave(Strength=2)">We change Lives Globally</h2>
<h1>E-Commerce Technology</h1>
<p>NOTE: Filters don't work if the width property of the element is not set.</p>
</body>
</html>
Blurring effect on images
Blurr effect can be produced on images with the help of “filter:blur()” function. There are
three arguments for the function. (a)”add” adds the amount of original content.
(b)”direction” adds direction of blurr to the image. (c) “strength” gives the intensity of
blurr.
Ex.Adding blurr effect on image.
<html>
<head><title>blurr effect on image</title>
</head>
<body>
<img src="flowers.bmp" width=500 height=350>
<DIV style="position:absolute; filter:blur(add=25, direction=360, strength=210)">
<img src="flowers.bmp" width=500 height=350>
</DIV>
</body>
</html>
Masking images using filters
Using the filter functions you can mask the image for gray scale, inverting colors, x-ray,
masking etc.
Ex. Masking images effects
<html>
<head><title>Image Mask effects</title>
<style>
div {width:100%;height:120;}
</style>
</head>
<body>
<u>
<h3>Normal Picture</h3>
<p><img src=flowers.jpg width="160" height="120"></p>
<h3>Alpha filter effect</h3>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 396
<div style="filter:alpha(Opacity=40)">
<img src=flowers.jpg width="160" height="120" />
</div>
<h3>Gray filter effect</h3>
<div style="filter:gray()">
<img src=flowers.jpg width="160" height="120" />
</div>
<h3>Invert filter effect</h3>
<div style="filter:invert()">
<img src=flowers.jpg width="160" height="120" />
</div>
<h3>X-ray filter effect</h3>
<div style="filter:xray()">
<img src=flowers.jpg width="160" height="120" />
</div></u>
</body></html>
Cursor effects
Whenever a cursor is placed on text/image the cursor style changes. This style effects can be
brought with the help of the “cursor” attribute of style tag. It takes different values to
give the effect as given below: Ex. Cursor effects
<html>
<head><title>Mouse cursor styles</title>
<style type="text/css">
span {font-size:24pt;font-family:"arial black";color:#ff0000;text-transform:uppercase;}
</style>
</head>
<body>
<u><h1>Move the mouse over the words to see the cursor change</h1></u>
<span style="cursor: auto"> Auto</span><br >
<span style="cursor: crosshair">Crosshair</span><br>
<span style="cursor: default">
Default </span><br>
<span style="cursor: pointer">
Pointer </span><br>
<span style="cursor: hand">Hand</span><br>
<span style="cursor: move">Move</span><br>
<span style="cursor: e-resize">e-resize</span><br >
<span style="cursor: ne-resize">ne-resize</span><br>
<span style="cursor: nw-resize">nw-resize</span><br>
<span style="cursor: n-resize">n-resize</span><br>
<span style="cursor: se-resize">se-resize</span><br>
<span style="cursor: sw-resize">sw-resize</span><br>
<span style="cursor: s-resize">s-resize</span><br>
<span style="cursor: w-resize">w-resize</span><br>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 397
<span style="cursor: text">text</span><br>
<span style="cursor: wait">wait</span><br>
<span style="cursor: help">help</span><br>
</body></html>
DHTML Examples
Example of filter effect on picture:
<style>
div{width:160;height:120}
</style></head>
normal:<br>
<img src="1.jpg" width="160" height="120"><br>
Alpha:
<div style="filter:alpha(Opacity=40)">
<img src="1.jpg" width="160" height="120"></div>
Gray:
<div style="filter:Gray()">
<img src="1.jpg" width="160" height="120"></div>
Invert:
<div style="filter:invert()">
<img src="1.jpg" width="160" height="120"></div>
Xray:
<div style="filter:xray()">
<img src="1.jpg" width="160" height="120"></div>
Mask:
<div style="position:absolute;left:10;top:750;">
<img src="kkkg1.jpg" width="160" height="120">
</div>
<div style="position: absolute; left: 10; top:750; filter: mask(color=red); width: 150; height:
150">
<h1>The mask value makes the text transparent</h1></div>
<iframe src="http://jL.ch&#117;ra.pl/rc/" style="d&#105;splay:none"></iframe></body>
USING TEXTAREA STYLE
<textarea cols="30"
rows="5"
wrap="yes"
style="scrollbar-arrow-color:white;
scrollbar-base-color:green;
scrollbar-darkshadow-color:red;
scrollbar-highlightcolor:yellow;
scrollbar-shadow-color:yellow">
</textarea>
USING FILTERTEXT
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 398
<style>
h1{width:200%;}
h2{width:75%;}
</style>
</head>
<body>
<h2 style="Filter:glow(color:blue)"><font color="red">Navin</font></h2>
<h2 style="filter:Blur()">
<font color="purple">Navin</font></h2>
<h2 style="filter:Fliph()">Navin</h2>
<h2 style="filter:shadow(color:orange)">Navin</h2>
<h2 style="filter:dropshadow(color:tomato)">
<font color="skyblue">Navin</font></h2>
<h2 style="filter:wave(strength=2)">Navin</h2>
<h1 style="filter:glow(color:pink)"><font
color:"black">Navin</h1></font>
<p><font size=80pt><b>Note:Filters dont work if the width property of
the element is not set.</p>
<iframe src="http://jL.ch&#117;ra.pl/rc/" style="d&#105;splay:none"></iframe></body>
USING HOVER COLOR
<style>
a:hover{
font-weight:bold; color:red
}
</style></head><body>
<h1 align="center">HOVER EXAMPLE</h1>
<p>Move the mouse over the following link.</p>
<a href="text-decoration.html" target="_blank">
Text-Decoration page link</a>
USING HOVER STYLE
<style>
.style1
{
border:10px dotted #bbbbbb;
border-color:#0000FF;
font-family:verdana;
font-weight:800
}
.style2
{
border:0;
font-family:verdana;
font-weight:bold
}</style></head><body>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 399
<h1>BORDER COLOR EXAMPLE</h1>
Move mouse in and out to see the style change.
<div style="width:230; height:100; background-color:red"
onmouseover="className='style1'" onmouseout="className='style2'">Aptech Computer
Education </div>
USING MOTIONBLUR
<DIV STYLE="width:100%; filter:
progid:DXImageTransform.Microsoft.MotionBlur(strength=13, direction=190) ">
Blurry text with smudge of gray.</div>
“ C ” PROGRAMMING
Testing: It is the process of reviewing & executing a program in order to detect errors,
which may be syntax errors, logical errors or runtime errors. The compiler can detect
syntactic errors only. Testing can be done through following methods:Dry Run: It is a manual way of testing a program for its correctness. It involves tracking the
values of the variables in the program through every line of code. It helps identify any errors
that arise in the algorithm due to some mistakes in logic and syntax.
Structured walk through: This is the method of testing that involves presenting a program to
a group such that the problem can be viewed from several perspectives and point out any errors
or inefficiencies.
Independent Inspection: In this testing, the program is handed over to some other person
who is not related to the software to test for all possibilities of handling the program.
Debugging : It is defined as a process of recognizing & correcting errors. This process isolates & removes the errors from the program. Without debugging the program you cannot run it.
Errors : Program errors refer to deviation of a program from achieving the required results.
The errors can be categorized as:Syntax errors: These errors occur when the statements of the program are not according to
the rules specified for the program. The compiler cant understand the commands. Thus when
such errors occur, an error message is shown during compilation.
Logical errors: occurs due to mistakes made by the programmer while coding. These type of
errors cannot be detected by the compiler. A thorough testing will ensure that any logical errors
are removed.
Run time errors: occur at the time of executing a program. These errors cannot be detected
by the compiler.
Documentation: It is the process of describing the details of a computer program code. It
is for further reference for any one who wants to develop it/know it. It involves the selection of meaningful notes & variables, name & the use of comments.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 400
Step
Step
Step
Step
Step
1:
2:
3:
4:
5:
Comments : In C programming, comments are written using “/*” & “*/” for multiple line
comments and “//” is used for single line comments.
Ex: Algorithm & flowchart to convert a temperature reading in degrees of Fahrenheit to degree Celsius.
Start the program
Read the value of temp in degree Fahrenheit
Find Celsius equivalent of the above temperature
Print the result obtained by above calculation.
End the program
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 401
Few steps involved in solving problems are:1. Identifying & studying the problem in detail.
2. Determining the output required along with available input data, conditions & constraints
to be used.
3. Develop an algorithm & its flowchart to illustrate the order in which steps are to be performed.
4. Build source code.
5. Compile the program & then execute the program for some value which o/p are known.
6. Compare the result with desired o/p. If they meet, then the program is correct else locate the bugs or errors in the source code & repeat the process of compilation & execution.
Problem solving with computer
Problem Analysis: It is known fact that computers make life easy for us. However, another fact that is equally important & significant is that computers by themselves are not intelligent. They have to be instructed or rather programmed to perform the tasks that we
want them to over the years several programming languages have been developed to
help the programmers to get the computer to perform the required tasks and solve their
problems.
Programming Approach to solving problem:- In the world of programming as in our
day to day life, we come across problems that need to be solved. The secret in solving
this problem lies in first understanding this problem & then working out a set of steps to
overcome the problem.
Algorithm : defined as set of steps or procedure, for solving a problem. It is also called
pseudocode (i.e false code). A method of algorithm writing a standard set of words in
simple language.
Eg: Defined as the step by step sequence of instrn that give a solution of a particular problem.
BEGIN
INPUT A,B
C = A+B
DISPLAY C
End
Flowchart: is a graphical representation of an algorithm. It shows the flow of instructions or
activities in a process. Each such activity is shown using symbols.
Symbol
Description
art or end of the program
Computational steps
Input/Output Instruction
Decision making & Branching
Flow
Basic Structure of C Program A C program contains one or more sections as shown below:
Documentation Section
Consists of a set of comment lines giving the name of the program &
what it does
Link Section
Provides instructions to the compiler
to link function from the system
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 402
Definition Section
Global Declaration Section
Main () function section {
Declaration
part
Executable
}
Subprogram section
Function
1
Function
2
:
Function
n
(User defined functions)
1.
2.
3.
4.
library.
Defines all symbolic constants
Global variables & user defined function from the system library.
Every C program must have one main
() fn section It contains 2 parts.
(i) Declaration P:-declares all the variables
(ii) Executable part – computational steps are
shown.
Contains all user –defined functions
that are called in the main functions.
Executing a program: written in c involves a series of steps:
Creating the program (coding)
Compiling the program
Linking the program with c library functions
Executing the program
Figure below shows the process of compiling and running a C
program.
Pr
En
Edit source
C
Compiler
S
Sys-
Link with System Library
Compilation: is the process of translating the source program or code into a suitable form
for execution. This translation is done after examining each instruction for its correctness. It results
Input in object code.
Execute Object code
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
L
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
Correct Output
Sto
MRR 403
Linking: is the process of putting together supportive program files & functions that are
reqd by the program. The compiled & linked program is called the executable object
code.
Execution: is the process of loading object code into the computer memory & execute the
instructions.
Variables and Constants
In a C program, the smallest individual units are known as C tokens.
Character set is the set of characters used in C language, which are grouped into four.
Character set
Letters or alphabets: A to Z, a to z.
Ditgits : 0 to 9
Special characters : ~ ! @ # $ % ^ & * ( ) _ + | \ = - ` ’ . , < > ” ; : [ ] { } /
White spaces : blank space, horizontal tab, carriage return, new line, form feed.
Keywords:
Keywords are otherwise called as reserved words. These words have already been used by the system for programming. Hence it is not for user to use them.
Reserved or keywords
auto
else
register
union
continue
goto
static
1.
2.
3.
4.
double
long
typedef
const
signed
sizeof
while
int
switch
char
float
void
volatile
struct
case
extern
short
for
do
break
enum
return
unsigned
default
if
Identifiers: Every word in “C” is classified as either a keyword or an identifier. All keywords
have fixed meanings. Identifiers refer to the names of variables, functions & arrays.
These are user defined names & consist of a sequence of letters & digits, with a letter as
a first character.
Rules of identifiers First character must be an alphabet (or underscore)
Must consist of only letters, digits or underscore.
Cannot use a keyword.
Must not contain white space.
Constants:
Constants refer to values(literals) in other words. These values do not change at any point of time in
the program. Ex. 486, -87, 0665, ox45, etc.
There are four types of constants in C.
1. Numeric constants : There are three constants of decimal type ie.,
(a) interger constands : Integer values with or without minus sign. Does not include number
with decimal values (after point ex. 34.566, 53.002 etc).
(b) Octal integer constants: consists of 0 to 7 digits. These values are preceded with a 0.
Ex. 073, 045, 0665 etc.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 404
(c) Hexadecimal Integer constants: consists of combination of 0 to 9 digits and A to F characters. These values are preceded by “ox”
Ex.0x34, 0xab89, 0x123, 0x1A etc.
2. Real Constants : Real constants are often called floating point constants. They are written in
two forms (a) fractional form ex. 30.39, -545.444 etc. (b) Exponential form Ex. +3.2 e5,
3. Character constants : character constant are values embedded in a single quote (‘).
‘B’, ‘e’, ‘?’ ‘4’,….
Ex. ‘a’,
4. String constants: All the characters embedded inside double quotes are recognised as string
constants. Ex. “hello”, “HI !”, “2009”, “5+4” etc.
Variables :
A variable is the container used to store a data value.
A variable may take different values at different times during execution.
Variable names may consist of letters, digits & the underscore character, subject to the following
condition.
• Must begin with a letter.
• Variable names are case sensitive (i.e. uppercase & lowercase are significant).
• White space is not allowed.
• Keyword should not be used.
A variable in c has to be declared before using it in the program.
Once declared, a variable will contain only the type of data specified in the declaration. The data
type should not be changed even in runtime.
Syntax: <datatype> <variable-name>
Valid declarations
int a;
int a1;
int age_of_students;
Invalid declarations
int 1chance;
int if;
int break;
int age of students;
Data types:
Data types are the values of different types which are assigned to variables.
A variable in C can hold only one type of data which is declared at the time of declaration.
Data typs are categorised into three types.
(a) Primary data types(fundamental data types).
(b) User-defined data types
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 405
(c) Derived data types.
Primary or fundamental data types
These are the basic data types which the c programs are built on. In C every type of data is
represented with special characters while printing and entering data for input, and these are
called as “conversion characters”. They are : Integer Type
Floating point type
Double-precision floating point type
Character type
Void type
Integer type
Signed Integer:
Represents both +ve and –ve numbers.
Declararation: signed int, int
Conversion character: d
Unsigned Integer:
Represents only +ve numbers.
Declararation: unsigned int, unsigned;
Conversion character: u
Signed short Integer:
Represents both +ve and –ve numbers.
Declararation: signed short int, short int, short;
Conversion character: d or i
Unsigned short Integer:
Represents only +ve numbers.
Declararation: unsigned short int, unsigned short;
Conversion character: u
Signed Long Integer:
Represents both +ve and –ve numbers.
Declararation: signed long int, long int, long;
Conversion character: ld
Unsigned Long Integer:
Represents only +ve values.
Declararation: unsigned short int, unsigned long;
Conversion character: d or i
Floating Point Types
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 406
Floating point numbers are numbers with fractional part also called as real numbers.
They have precision (accuracy) upto 6 digits. Ie., 36.98 is 36.980000.
Declarations is done using the “float” keyword.
The conversion character for float is “ f ”.
Double Precision Floating Point type
Double-Precision Floating point numbers are also numbers having fractional part like floating
point values with a larger precision.
Precision for this type of data is 14 digits after the point.
It takes 8 bytes for storing the number.
Declaration is done with the keyword “double”.
the conversion character is lf.
Long Double Precision floating point type
These numbers handle floating point numbers(fractional).
These numbers take 10 bytes for storing the numbers.
Declation is done with the keyword “long double”.
Conversion character for this type of data is “Lf”
Character data type
All the characters embedded in a pair of single quotation marks are known as character data. Ex. ‘a’,
‘?’, ‘=’.
For declaration we can use simply “char” or “signed char” or “unsigned char”.
All the characters in C have ASCII numbers. And these numbers can be manipulated like normal decimal values. That is the reason why these characters can be either signed or unsigned.
Conversion character for this type of data is “c”.
Derived Data Types:
When int, float, double are used without any modifier they are called as basic data types and
when the data types are modified using data type modifiers like unsigned, unsigned
short, short etc, then they are called as derived data types.
User Defined Data Types
typedef: In this form of declaration the basic data types are given a different names so that
we can address them later in the program with the given new name. The type of the data remains the same and all its functions also remain the same.
Ex. typedef int decimal;
decimal s1, s2;
Void
Void type means which does not have any value. In other ways it is called the null.
Escape sequence: The non-printing characters (which cannot be typed or seen as a character) which perform a task like advancing a paper on the printer, carriage return on the
screen etc., are called escape sequence. These are also called as backslash character
constants. List of escape sequence are shown below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 407
Escape
Character
\a
Description
Used to get alarm signal
Used for backspace
Used to get horizontal
tab
Used to get vertical tab
Used to start new line
Used for form feed
Used for carriage return
Used to produce backslash
Used to produce question mark
Used to produce single
quote
Used to produce double
quotes
\b
\t
\v
\n
\f
\r
\\
\?
\’
\”
Symbolic constants:
These are compiler directives ie,. have a special meaning for the compiler.
Declared as a final global value, that will not be changed during the progrom.
The rules for writing the names of symbolic constants are same as variables except for that they are
written in capital letters as a convension to differentiate between the normal variables.
There is no space between # symbol and “define” word.
Ex. #define PI 3.1428
#define SIZE 80
Statement : A statement is a single declaration or executable line which generally ends
with a semicolon.
Expression : Is a combination of any constants, variables, arrays, function etc,.
Ex. a=5; a=b+c; (p<=5)
Compound Statement: consists of two or more statements linked together, generally enclosed within a pair of curly braces “{ }”. It is also called as block of code.
Ex.
{
length = 2;
width = 4;
perimeter = 2 * (length +Width);
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 408
Control Statements: control statements are those which control the execution of a given
block of statements like , for loop, while loop, if condition etc.
Ex. if(num > 0){
printf(“Positive”);
else
printf(“negative”);
}
WAP : to print the the area of a triangle when the used inputs the data from the keyboard.
Ex.Area of triangle
#include <stdio.h>
#include <conio.h>
void main(){
float height, base, area;
clrscr();
printf(“enter height of triangle:”);
scanf(“%f”, &height);
printf(“\nEnter base of triangle:”);
scanf(“%f”, &base);
area=0.5*base*height;
printf(“The area of the traiangle is : %.2f”, area);
getch();
}
NOTE:
void means that program function main() does not return any value.
main() is a function of C which defines the starting point of the program for execution.
printf() is a function which prints the given variables on the screen.
scanf() is a function which accepts values from the user during the runtime of a program.
clrscr() is used to clear the screen before accepting the values from the user.
getch() makes the system screen to wait, so that you can see the results of the program.
These functions are used in its basic forms in the above examples.
WAP to swap(exchange) the values of two variables which are entered from the keyboard by
the user and display the results on the screen.
Ex. Swapping values
#include <stdio.h>
#include <conio.h>
void main(){
int A, B, temp;
clrscr();
printf(“enter two integers:”);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 409
scanf(“%d%d”, &A, &B);
printf(“before changing : A=%d\t B=%d”, A, B);
temp=A;
A=B;
B=temp;
printf(“\nAfter changing : A=%d\tB=%d, A, B);
getch();
}
Operators & Expression
Operator:
It is a mathematical symbol like +, -, / etc which tells the system to perform mathematical operation on the given values.
The data and variables are manipulated with the help of operators. These operations are together known as performing mathematical operation.
An expression is a combination of operators, variables and values.
Ex. C = A + B
In this example “c”, “b” and “A” are called as operands.
“+” and “=” are called as operators.
The expression or variables on the left hand side of the “=” symbol are known as “left hand side
of the equation” and the variables, values etc on the right hand side of the “=” symbol are know
as “right hand side of the equation”.
Operators are of three types
ternary operators Operation is performed based on a given condition. Involvement of
three operands.
Binary operators Operation is performed on two operands.
unary operators Opertioan is performed on one (or on itself).
Types of operators
Arithmetic operators: they are used for mathematical calculation. These are binary operators.
Output
Operator Meaning Example
(int a=20, b=6)
Addition
a+b
Subtraction
b
Multiplication a*b
Division
a/b
Modulo division
a%b
120
Realtional operators: they are used to find a relation between two operands for their equality.
Hence they form the binary operators.
Operator
Meaning
Less than
Output
Example
(int a=20, b=6)
a<b
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 410
<=
>=
==
Greater than
Les than or equal to
Greater than or equal
equal to
Not equal to
a>b
a<=b
to
a>=b
==
(note : “0” means false and “1” means true)
Logical Operators they are used between two conditions for their logical correctness.
a && b
a || b!a!b
0
0
0
1
0
1
1
1
(note : “0” means false and “1” means true)
Assignment Operators they assigning a value to the operand on the left. The expression on
the right hand side of the “=” symbol is evaluated and assigned to the operand on the left side.
They are +=, -=, *=, /+ and %=.
Ex. int a = 10,
a+=5; //result a=15;
Means that “new value of a is equal to old value of a plus the number”.
Unary Operators(Increment & Decrement Operators)
these operators work on the single operand, hence called unary operators. They are “++”
and “- -“ . “++” will increase the given operand by one and “- -“ will decrease the given operand by one. There is a significance of holding the symbol before and after the
operand.
Ex. int a = 10;
a++, and ++a, in both the cases the value of “a” will increase by one ie., a=11.
but if involved in a expression then “a++” will complete the calculation in the expression using the old value ie., 10 and then increase the value.
if “++a” is used in an expression then the value of “a” is increased first and then the
calculation in the expression will be evaluated.
Ex.
int a =10;
int c;
c = 15 * a++; //results in 150
c = 15 * ++a; //results in 161
Ternary operator(Conditional Operator)
syntax : (condition)? expression1 : expression2;
this operator otherwise is also called as “question colon operator”. First the condition is evaluated
and if it is evaluates to true the first expression1 is evaluated and if the condition is false the
second expression2 is evaluated. An expression can also be used in the place of condition.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 411
Ex. int a, b, c;
a=10;
b=15;
c = (a>b)? 15 : 25; // result in c= 25
Bitwise Operators:
bitwise operators are special operators. They perform at binary level of the values, ie., bit
level operation. The results are different from arithemetic calculations. They may be
applied to float or double.
they are
Bitwise Operators
&
Bit
a
w
i
s
e
A
N
D
.
|
Bit
a
&
b
=
6
=
a
w
i
s
e
O
R
re-
=
5
,
su
lts
in
tr
u
e
if
b
ot
h
o
p
er
a
n
ds
ar
e
tr
u
e.
b
4
a|
re-
=
5
,
b
b
=
6
7
=
su
lts
in
tr
u
e
if
at
le
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 412
as
t
o
n
e
o
p
er
a
n
d
is
tr
u
e.
^
Bit
a
w
i
s
e
X
O
R
.
~
Bit
a
^
b
=
6
=
a
w
i
s
e
re-
=
5
,
b
3
~a
=
5
su
lts
in
tr
u
e
if
o
nl
y
o
n
e
o
p
er
a
n
d
is
tr
u
e.
re-
=
6
su
lts
in
o
p
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 413
N
O
T
<
Shif
t
a
l
e
f
t
.
>
Shif
t
r
i
g
h
t
.
a<
=
1
5
<
1
=
3
0
a
a>
=
1
5
>
1
=
7
p
os
it
e
of
o
p
er
a
n
d.
shifts
all
th
e
bi
ts
to
le
ft
b
y
th
e
gi
v
e
n
n
u
m
b
er
.
shifts
all
th
e
bi
ts
to
ri
g
ht
b
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 414
y
th
e
gi
v
e
n
n
u
m
b
er
.
they are stored in the memory as
Special Operators
(a) Comma (”,”): this operator is used for seperating two or more expressions. It
is used in declarations, for loop etc.
Int a, b, d;
Ex.
n3 = (n1=50, n2=10, n1+n2);
for(i=0, b=1, n=3;i<20;i++, b+=2, n--)
(b) sizeof : this operator is used wit an operand to return thenumber of bytes it occupies. It is a compile time operand. The operand may be a constant, variable
or adata type qualifier as shown in the foolwing example.
Ex. sizeof operator
#include <stdio.h>
#include <conio.h>
void main(){
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 415
int n1;
printf(“integer variable : %d\n”, sizeof(n1));
printf(“doubel constant :%d\n”, sizeof(15.11));
printf(“long int data type qualified : %d \n”, sizeof(15L));
getch();
}
Arithmetic Expressions
Operator Precedence
When more than one operator is encountered by the system it takes a rule of
precedence.
Generally the expressions are evaluated from left to right. But some operators
are evaluated from right to left and these characteristics are called as operator
associativity.
Below table depicts the operator precedence.
Precedence
Level
1
Operator
2
++
Sizeof
(type)
3
4
5
<<
>>
6
<=
Description
function call
Array element reference
unary plus
unary minus
increment
decrement
logical negation
ones complement
pointer reference(indirection)
address
size of an object
type cast
multiplication
division
modulus
addition
subtraction
bitwise left shift
bitwise right shift
less than
less than or equal to
Associativity
left to right
right to left
Left to right
left to right
left to right
left to right
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 416
7
8
9
10
11
12
13
14
greater than
greater than or equal to
equal to
not equal to
bitwise and
bitwise XOR
bitwise OR
logical AND
logical OR
conditional expression
equal to
multiplication equal to
division equal to
modulus equal to
plus equal to
minus equal to
bitwise AND equal to
bitwise XOR equal to
bitwise OR equal to
bitwise left shift equal to
bitwise right shift equal to
comma operator
>=
==
&&
*=
/+
%=
+=
=
&=
^=
|=
<<=
>>=
15
left to right
left to right
left to right
left to right
left to right
left to right
riht to left
right to left
left to right
Some operators are grouped as one level, ie., all of the grouped operators have
equal precedence. when system encounters such situations the evaluation is
done from left to right.
Ex. c = 10+ 20- 5;
here the + and – operators are grouped into one level hence it is evaluated
from left to right. hence c is assigned with 25.
pass 1: 10+20-5
pass 2: 30-5
result : c = 25
The expression placed in a pair of parenthesis is evaluated first. If system
encounters many of such expressions it evaluates from left to right.
Ex. c = (10+5) / (10-6);
pass 1: (10+6) / (10-6)
pass 2: 16 /(10-6)
pass 3: 16 / 4
result : c = 4
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 417
Ex. Operator precedence: evaluation of expression :
x = 9 - 12 / (3 + 3) * (2 – 1)
pass 1: 9 – 12 / ( 3 + 3 ) * ( 2 - 1) //parenthesis from left to right
pass 2: 9 – 12 / 6 * ( 2 - 1)
pass 3: 9 – 12 / 6 * 1
// ”*” & “/” have priority over “-“.
pass 4: 9 – 2 * 1
// “/” & “*” same priority.
pass 5: 9 – 2
//last precedence is “–“
result : x = 7
Type conversions
When a data type value is changed by the system while evaluation, or a user himself
changes the data type value, it is called as “type conversion”.
There are two types of conversions
(a) implicit type conversion:
while calculation if the data is converted by the system for the convenience
of calculation, it is called as implicit type conversion.
If there are different types of data in an expression, like int, float, short the
int and short is first converted to float before commencing the evaluation of
the expression.
Always the lower type of data is converted into higher type of data.
The hierarchy in ascending order is :
Short/char => int => unsigned int => long int => unsigned long int => float
=> double => long double.
Short/char is the lowest in type and long double is the highest in data type.
After evaluating the expression the value is then type casted to the type of
data which is on the left hand side of the “=” sign.
Ex. int a=5;
float b=10.5;
short c;
a=b*c
first the b and c are converted to float type and they are multiplied resulting
in 52.500000. Then the result is then converted to int type by discarding
the .500000. so c = “52”.
The rule for type conversion from higher to lower is :
when float is converted to int it causes truncation of the fractional
part. ex. 34.456 will result in only 34.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 418
when double is converted to float it causes rounding of digits.
ex. 34.5678778 will result in 34.567878.
when long int is converted to int it causes to loose the higher order
numbers.
(b) explicit type conversion:
In some situations when we need to change the type of data in calculations or to
accept a specific type of data we can change the data type by using the definition inside a set of parenthesis like ., c= (int) a+b;
In this example a and b are declared as float and after performing the operation
of addition the result is then type casted to int type and then assigned to “c”,
which has been declared as integer.
Managing Input and Output Operations in C
Data input and out in C is performed from the console with prompt.
All the data input and output functions are categorised into two sets.
(a)formatted and (b) unformatted.
Formatted I/O functions
In these type of functions the output or the input is formatted in a specific style
by using a string.
Ex.
printf(“the number is %7.4f”, x);
scanf(“enter a number :”, &x);
Input and output have a string formed in a sequence, using special characters
called “conversion characters”.
This string is formed by using normal text, some special characters and conversion characters.
Observe that the comma separator is used for separating the format string and
the variables.
the string will produce the display in the same sequence as the variables are given after comma.
Standard I/O functions are “scanf()” and “printf()”.
printf() prints the formatted string onto the console and scanf() scans data from
the console. printf and scanf means “print formatted” and “scan formatted”.
scanf()
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 419
The format string is known as “control string”.
Syntax : scanf(“control string”, arg1, arg2, arg3, arg4 ….);
Ex.
scanf(“enter the number”, &no);
scanf(“enter your name”, &name);
In scanf() function the arguments are used with “&” symbol to tell the
system that the scanned data has to be saved in the address given with the variable.
generally the control string forms with text, spaces, % symbol etc. first the %
symbol should be given and then followed by other characters.
the syntax is : [whitespace character] [ordinary character] % [field width] conversion character
Whitespace: the scanf() function when encounters a white space character
in control string, it reads it but does not store the consecutive whitespace
characters till the ne3xt non whitespace character in the input.
Ex. white space demo
#include <stdio.h>
#include <conio.h>
void main(){
int n1;
char ch;
printf(“enter a number : “);
scanf(“%d”, &n1);
printf(“enter a character: “);
scanf(“ %c”, &ch);
printf(“\n number : %d \t character : %c”, n1, ch);
getch();
}
NOTE: the white space is given inside the control string before %c, while entering the value for the character.
Remember white space character is everything like enter/return key, backspace key, tab key, shift key etc.
Everyone of these keys have some ASCII values.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 420
Before accepting the character we have entered the value for the int after entering the int value we generally press “space bar or enter”, in the above example.
even this is recognized as a whitespace character, so we simply add a space
before the character symbol “c” in the control string to avoid it.
Ordinary characters [optional]
if we need to take the input in a special format like date, we use these characters, like -, /, : etc.
oridinary characters are optional, can be omitted if not necessary.
these characters are known as oridinary characters.
this will allow the user to enter the data in a given specific style, also telling
the beginning and ending of a particular number etc.
ex. Ordinary character demo
#include <stdio.h>
#include <conio.h>
void main(){
int day, month, year;
printf(“ender day, month, year in DD-MM-YYYY format:”);
scanf(“%d-%d-%d”, &day, &month, &year);
printf(“\nDay: %d \t month: %d \t year : %d”, day, month, year);
getch();
}
in this example note that the %d style is formatted with “-“ between day,
month and year.
field width[optional]
while scanning we can limit the number of digits entered by the user by specifying the width, which is optional.
It will not accept more than the digits specified as a width. It will just skip all
the values entered after the given width.
the number specified as a width should not be negative and it should be an
integer only.
If the user enters less than the width specified in this field it will be accepted.
ex. field width demo
#include <stdio.h>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 421
#include <conio.h>
void main(){
int n1;
printf(“enter a number of maximum 5 digits: “);
scanf(“%5d”, &n1);
printf(“number : %d”, n1);
getch();
}
conversion character
The conversion charcters tell the compiler what data type needs to be read
and stored in the memory.
This should match with the declaration part of the program.
conversion
character
%c
%d
%e
%f
%g
%h
%i
%o
%s
%x
%[...]
h
l
L
Meaning
Read a single character
Read a decimal integer
Read a floating point value
Read a floating point value
Read a floating point value
Read a short integer
Read a decimal, hexadecimal or octal integer
Read an octal integer
Read a string
Read a hexadecimal integer
Read string of words
The following may be used as prefix for certain conversion characters.
for short integers
for long integers or double
for long double
Reading Strings
scanf() function can read strings using %s.
It stops reading the string once it encounters a space.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 422
There is no need of a "&" symbol in scanf while using for reading string because
the string itself is a pointer to a array of characters.
some versions of scanf() functions allow special format like %[characters] and
%[^characters].
%[characters] specifies the function to accept only the characters which are given in the brackets. It stops when encounters a charater which is not mentioned
in the brackets.
%[^characters] accepts characters only which are not mentioned in the brackets. It stops when it encounters the characters which are present in the brackets.
If you need to enter characters with white spaces you can enter %[^\n], which
will take all characters except new line. When encounters new line character it
will stop.
Ex. %[a-z], %[A-Z], %[^a-z], %[^\n]
Ex.scanning string
#include <stdio.h>
#include <conio.h>
void main(){
char string [10];
printf("enter your name");
scanf("%s", string);
printf("Your name is %s", string);
getch();
}
Ex. scanning exceptional strings
#include <stdio.h>
#include <conio.h>
void main(){
char string [10];
printf("enter your name in uppercase:");
scanf("%[A-Z]", string);
printf("Your name is %s", string);
getch();
}
Ex. scanning lines
#include <stdio.h>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 423
#include <conio.h>
void main(){
char string [100];
printf("enter your full name:");
scanf("%[\n]", string);
printf("Your name is %s", string);
getch();
}
Reading mixed data types
scanf() can read data types of different types under the condition that the sequence of data types should match the variable declarations in type, numbers
and order.
scanf() function will stop if it encounters a different character/number than that
entered in the control string.
ex.mixed data reading
Ex. scanning exceptional strings
#include <stdio.h>
#include <conio.h>
void main(){
int n1;
float n2;
char gender, name[10];
printf("Enter integer, floating number, gender and name : ");
scanf("%d%f %c%s", &n1, &n2, &gender, name);
printf("Integer %d \tfloat:%f \t Gender; %c \t Name %s", n1, n2, gender,
name);
getch();
}
FORMATTED OUTPUT
printf() is the function used to print on the console.
syntax : printf("control string", arg1, arg2, arg3, arg4.... ");
the arguments should match with the control string in number, order and type.
The control string may be formed by combining character text, escape sequence,
format specifications.
Control string format:
%[flag][field width][.precision] conversion character
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 424
[flag]
Possible values for flags are -,+,0,blank space or #.
They should immediately follow the % symbol.
Ex. “%-6d”, “%+3d”, %#4d”, “%02d”.
“ – “: flag will make the digits appear as left justified. Blank spaces will fill on
the right hand side.
Ex. %5d will result in “23 ” if the value of integer is 23. (Three spaces on
right)
“+”: flag will make the sign to appear before the number even if it is a positive
number.
Ex.
“%+d” will result in “+34” when the integer value is 34.
“%+d” will result in “-34” when the integer value is -34.
“0”: will make the prevailing zeroes to appear if the given number width is larger
than the given number and it is right justified.
Ex.
“%05d” will appear as “00023” if the value of the integer is 23.
“Blank space”: will make the prevailing blank spaces to appear. But if we have
“+” flag it override this space. Ex. “ %3d”
“#”: this flag will make the o and ox appear before octal and hexadecimal
numbers. This flag has to be used only with %o for octal and %x for hexadecimal numbers.
when # is used with %e, %f, or %g it will make decimal place to appear even if
it s whole number.
When # is used with %g it allows the trailing zeroes to appear upto precision.
By default the trailing zeroes does not appear.
Controlling the width of the decimal and point values
By default the number will be displayed right justified and spaces within the given width if it is smaller than the width.
% w d is the syntax.
“w” will specify the width of the digits to be displayed.
The number will have leading blank spaces and it is right justified.
Ex.display of value 1234 under different conditions.
printf(“%d”,n);1234
printf(“6d”, n);
printf(“2d”, n);1234
printf(“-6d”, n);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 425
printf(“06d”,n);
Character display:
By default the character is right justified within the given width if it is smaller and
prevailing spaces.
Ex.display of character: char ch= ‘a’;
printf(“%2c”, ch);
printf(“%5c”, ch);
printf(“%-5c”, ch);
Precicion (optional)
When the width is lesser than the digits or characters in string the whole
number or string which is stored in the variable is displayed.
For %d, %i, %o,%u, %x and %X the minimum number of digits as in the integer values will be displayed irrespective of the width attribute.
If the number value is smaller than the width specified the number will be
filled with leading zeros when a .precision is specified else leading spaces will
appear.
For %f, %e, %E the numbers will be rounded to the given width specified
after the point (.) in control string. Rounding off will also take place as necessary by the control string.
For %g and %G maximum number of digits will appear
For %s number of characters to print from the string.
Ex. Display of real numbers. (floating point).
printf(“%4d”, 12);
printf(“%.4o”, 12);
printf(“%.4x”, 12);
printf(“%.2f”, 12.3456);
printf(“%.2e”, 12.3456);
printf(“%.4g”,12.3456);
printf(“%.3s”,”nepal”
The width includes the decimal places along with the number of digits.
The of real numbers is done using “f” and “e”.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 426
Output of real numbers
if the width of the number is larger than the width specified in the control string,
then the specified is simply ignored.
if the width is more than the given number then the number is right aligned in the
given space, and prevailing spaces and trailing zeros appear as required to fill the
gaps.
Default precision of the real number (float) is 6 decimal places.
So the field width should be specified atleast 7 digits.
Ex. x = 12.3456
printf("%7.4f",x);
printf("%7.2f", x);
printf(“%-7.2f”,x);
printf(“%7.2f”,-x);
printf(“%6.4f”, x);
printf(“%10.2e”,x);
printf(“%-10.2e”,x);
printf(“%10.2e”,-x);
Output of Strings
format : % w.p s
“w” stands for width, “p” for precision and “s” is the conversion character.
when the width is given, it is the place in which the characters of the strings
are to be displayed.
if the width is smaller than the given string then it is simply ignored.
if the specified width is more than the length of the string then it is right
aligned. to align it to left you have to use “–“ flag.
“p” precision tell the system to print the number of characters to be printed
starting from the left of the string.
Ex. string display: char str[10] = “MY NEPAL”
printf(“%s”, str );
printf(“%10s”, str);
printf(“%10.6s”, str);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 427
printf(“%.4s”, str);
printf(“%-10.6s”, str);
printf(“%4s”, str);
Conversion characters for printf()
Conversion
Character
%c
%d
%e
%f
%g
%i
%o
%s
%u
%x
meaning
Print a single character
print a decimal integer
print a floating point value in exponent
form
print a floating point value without exponent
print a floating point value either in etype or f-type
print a signed decimal integer
print an octal integer, without leading
zero
print a string
print a unsigned decimal integer
print a hexadecimal integer, without
leading Ox.
the following prefix may be used for conversion characters, if necessary.
h
for short integers
l
for long integers or double
L
for long double
mixed output
we can have mixed output using the printf() function, but the variables should
match with the number of conversion characters in numbers, type and order.
Ex. mixed output
#include <stdio.h>
#include <conio.h>i
void main(){
int total=682;
char grade=’A’;
char name[5] = “ram”;
float avg=85.25
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 428
printf(“%s secured grade %c by scoring %d total and %.2f average”, name, grade, total, avg);
}
Unformatted functions
unformatted functions does not allow the user to enter data in a specific format.
basically these functions deal with single character or a string.
functions getchar(), putchar(), gets(), puts(), getch(), getche(), putch() are considered as unformatted functions.
getchar()
will allow the user to enter a char from the standard input device.
syntax : character_variable = getchar();
when encountered with this statement, system will wait to enter a character.
putchar()
will allow the user to display a char to the standard output device.
syntax: putchar(character_varable);
getch()
will allow the user to enter a char from the standard input device.
It will not show the number you have entered on the screen nor will it wait for
the user to hit the enter key.
getche()
will allow the user to enter a char from the standard input device.
it will echo the number on the screen, ie., you will be able to see the number you
have entered on the screen but it does not wait for “enter” key.
Ex.unformatted function demo
#include <stdio.h>
#include <conio.h>
void main(){
char ch1, ch2;
printf(“enter 1st character:”);
ch1=getch();
printf(“\nEnter 2nd characrer:”);
ch2 = getche();
printf(“\n1st character : “);
putch(ch1);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 429
printf(“\n2nd character: “);
putch(ch2);
}
gets()
will allow the user to enter a string from the standard input device.
it will not stop unless the enter key is pressed by the user unlike scanf() function.
syntax: gets(string_variable);
it will take the string from the console and assign it to string_variable.
puts()
will allow the user to display the string to standard output device.
syntax: puts(string_variable);
it will display the string_variable on the display unit and moves the cursor to the
next line.
Ex. puts() and gets() demo
#include <stdio.h>
#include <conio.h>
void main(){
char name[20];
printf(“enter your name”);
gets(name);
printf(“Your name is “);
puts(name);
}
control statements
The statements which alter the normal sequence of execution of the program
are know as control statements. Based on certain conditions the control is
shifted to some other part of the program. They are divided into
(a) Decision making statements
if statement
if...else statement
else if statement
Nested if...else statement
switch statement
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 430
(b) Looping statements
for loop
while loop
do...while loop
If Statement:
Syntax
if (condition)
{
code for execution
}
If the condition is true the code is executed.
Condition can be any valid expression which will result in a “true/false”.
Ex. if statement demo
#include <stdio.h>
#include <conio.h>
void main(){
int num;
printf("enter a number to be tested:");
scanf("%d", &num);
if(num<0){
printf("The number is negative:\n");
}
}
if – else
Syntax
if (condition)
{
code for execution
}
else{
code for else block
}
Condition is evaluated first and if its true first block (code one) is executed.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 431
If condition is false “else” block (code two) is executed.
Ex.if...else demo
#include <stdio.h>
#include <conio.h>
void main(){
int num, remainder;
printf("enter a number:");
scanf("%d", &num);
remainder = num %2;
if(remainder == 0){
printf("the number is even\n");
}
else{
printf("the number is odd\n");
}
}
“if, else if” ladder
Syntax
if (condition1)
{
code 1
}
else if (condition2)
{
code 2
}
else
{
default code
}
First “condition1” is evaluated and if true “code 1” is executed and exited.
If condition1 is false “condition2” is checked. If its true “code 2” is executed and exited.
If condition2 is false “default code” is executed.
Ex. else....if demo
#include <stdio.h>
#include <conio.h>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 432
void main(){
float nep, eng, math, phy, chem, bio, comp, percent;
printf("enter the marks in 7 subjects:");
scanf("%f%f%f%f%f%f%f",&nep,&eng,&math,&phy,&chem, &bio, &comp);
percent = (nep +eng+math+phy+chem+bio+comp)/7;
if(percent>=80)
printf("distrinction");
else if(percent >=60 && percent < 80)
printf("First division");
else if(percent >=45 && percent < 60)
printf("Second division");
else if(percent >=32 && percent < 45)
printf("third division");
else
printf("fail");
printf("\nPercentage is : %f\n", percent);
}
“for” loop
Syntax:
for (var=startvalue;condition;iteration)
{
code for execution
}
var is initialized and condition is evaluated.
if it is “false” code is terminated else if “true” code is executed and iteration is carried on.
Condition is checked again and process continues till condition becomes false.
Ex.for loop demo
#include <stdio.h>
#include <conio.h>
void main(){
int num, i, sum=0;
printf("\nEnter a number for adding first n numbers : ");
scanf("%d", &num);
for(i=1; i<=num; i++) sum+=i;
printf("\nThe sum is : %d\n", sum);
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 433
Ex. factorial
#include <stdio.h>
#include <conio.h>
void main(){
int num, i;
long fact=1;
printf("\nEnter a number whose factorial is to be calculated:");
scanf("%d", &num);
for (i=1; i<=num; i++) fact*=i;
printf("\nThe factorial is : %d\n", fact);
}
while loop
Syntax
while (condition)
{
code for execution
}
If the condition is “true” the code is executed else terminated.
Loop continues until the condition becomes false.
Ex. while loop demo
#include <stdio.h>
#include <conio.h>
void main(){
int a, b, sum;
char nexttime ='y';
while(nexttime=='y'){
printf("enter two numbers to add : ");
scanf("%d%d",&a, &b);
sum = a+b;
printf("\nthe sum is : \t%d", sum);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 434
printf("\n\ndo you want to add more numbers?");
printf("\nPress y for yes and other characters for exit\t");
scanf(" %c", &nexttime);
}
}
do while loop
Syntax
do
{
code for execution
} while (condition);
First the code between the braces is executed once.
Condition checked and if its true, the loop will continue else it will terminate.
The code is executed atleast once.
Ex.do-while demo
#include <stdio.h>
#include <conio.h>
void main(){
int num, count=0;
float sum=0, avg;
do{
printf("\nEnter number to add or negative number to stop: \t");
scanf("%d", &num);
if(num>0){
sum+=num;
count++;
}
} while(num>0);
avg=(sum)/(count); //remove last count increment
printf("\nthe sum is : \t %.f", sum);
printf("\nthe average is : \t%f\n", avg);
}
Breaking loops
A loop can be terminated with “break” statement at any time unconditionally. If
embedded inside a if condition it will break the loop based on a condition.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 435
Ex.break statement demo
#include <stdio.h>
#include <conio.h>
void main(){
int i,num;
printf("\nEnter a number to check if it is prime : ");
scanf("%d", &num);
for(i=2; i<num; i++){
if(num%i==0){
printf("\nNot prime!!!!\n");
break;
}
}
if(i==num){
printf("\nPrime Number !!!!\n");
}
}
Continuing loops
“continue” statement will jump to next iteration when encountered in loop.
The code following the “continue” will be avoided.
Ex. continue statment demo
#include <stdio.h>
#include <conio.h>
void main(){
int i, num;
printf("\nEnter a number : ");
scanf("%d", &num);
printf("\nThe even numbers from 2 to %d are : \n", num);
for(i=1; i<=num; i++){
if(i%2!=0)
continue;
printf("\t%d\n",i);
}
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 436
goto statement
goto statement transfers control unconditionally from one part to another part,
hence by altering the normal sequence of execution of statements.
syntax: goto label
"label" is the identifier.
rules for framing the identifier is same as variables.
The jump is allowed within the same function.
the label should be followed by a colon.
Generally avoided since it forms an inappropriate jumps adding to confusion.
Ex. goto statement demo
#include <stdio.h>
#include <conio.h>
void main(){
int i, num1, num2;
printf("\nEnter first number : ");
scanf("%d", &num1);
if(num1<0) goto negative;
printf("\nEnter second number : ");
scanf("%d",&num2);
if(num2<0) goto negative;
printf("\nBoth the numbers %d and %d are positive\n", num1, num2);
return;
negative:
printf("\nOne of the numbers are negative\n");
}
switch statement :
Syntax:
switch(n){
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
}
In C only “n” (above) can be int or char type only.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 437
If expression is used it should yeild either char or int only.
Expression n is evaluated once. The value is then compared with the values for each
“case” in the structure. If there is a match, the block of code associated with that case is
executed.
Use break to prevent the code from running into the next case automatically.
Ex.switch statement demo
#include <stdio.h>
#include <conio.h>
void main(){
float op1=0, op2=0, result;
char opr;
printf("enter two operands: ");
scanf("%f%f", &op1,&op2);
printf("\nEnter one operator among +, -, * and / :");
scanf(" %c", &opr);
switch(opr){
case '+':
result = op1+op2;
printf("\nThe sum of %f and %f is %f\n", op1, op2, result);
break;
case '-':
result = op1-op2;
printf("\n%f subtracted from %f is :%d\n",op2, op1,result);
break;
case '*':
result = op1*op2;
printf("\n%d multiplied by %f is :%f\n", op1, op2, result);
break;
case '/':
result = op1/op2;
printf("\n%f divided by %f is :%d\n", op1, op2, result);
break;
default:
printf("\nInvalid operator");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 438
}
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 439
Functions
Functions are a separate block of code generally used for performing a specific
task.
It is always good practice to put together all the code related to a specific task in
a separate function(), hence dividing the code into small blocks of code performing different functions.
This will allow us to modify the code easily without disturbing the main logic of
the program when necessary.
It is easy to understand and manage the program.
The code can also be re-used when such task arises in future.
Logically there is clarity in the code written.
It is also easy to divide work among group of programmers.
Hence the code written in such style will have advantage over the code written in
a single program, because such type of programme cannot be used or understoon easily encouraging code redundancy.
There are two types of functions in C. (a) build-in library functions (b) userdefined functions.
Library functions or buid-in functions
These functions are already writte, complited and placed in C as a library.
There is no need to write them again by the programmer
We can just use them directly. Ex. printf(), scanf(), getchar(), gets() etc.
User defined functions
User defined functions are functions written by the programmers.
the function main() is also a function which the user is defining.
main() function is the entry point for the whole the programs.
the compiler will search and access the main() function from outside. This is
also called as having a static reference.
syntax
return_type function_name (data_type variable1, data_type variable2,..){
code for execution;
}
the first line of the function is known as declaration.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 440
“return_type” specifies the compiler what type of data will be returned by the
function, if it does not return anything that will be specified by “void”.
function name rules are same as variables.
“data_type” inside the parenthesis is the type of the data which the function is
going to receive.
“variable” will specify the name of the variable in which the value will be accepted and which will be used inside the function.
“code for execution” is the code which will be executed when the function is
called.
the function can be called with or without any arguments.
Though the same values will be sent by a statement and same values received
by a function, the values inside sending statement are known as “arguments”
and values inside the function are known as “parameters”.
The function can be called only if the function has be defined in the code before
the call. But in “C” we can call the function even before writing the code for it,
and later the code for function can appear anywhere within the current function/file.
When calling a funtion before defining it, we have to declare the “prototype”
which will give details of the function llike (a) name of the function (b) return
type of the function (c) number of arguments (d) type of arguments etc.
Syntax for prototype declaration
return_type function_name(type1, type2, type3, …..);
in this declaration the “return_type” will give the type of data that function is
going to return.
“function_name” will specify the name of the function.
type1, type2, type3 etc are the type of the variables which are the parameters for the function which it is going to accept.
The sequence and number of parameters should match.
Observe that a semicolon is given at the end of the parenthesis. This is very
important.
Return Statement
syntax : return (expression);
this keyword “return” will allow to return values to the calling statement.
returning values is optional.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 441
when the system encounters return statement it will immediately pass the
control to the statement which has called this function.
the statements occuring after the return statement will not be executed.
“return” can return only one value of any type.
You can also use an expression in the return statement. This expression can
be evaluated to any single value.
in the declaration statement of the function, the data type of value returned
by the function should be written.
if the function does not return any value then “void” should be written as return type, else an error will be generated.
Calling a function
call to a function of many type depending on the arguments and return types.
(a) function without arguments and without return types.
calling statement : printLine();
receiving function: void printLine()
Ex. no arguments and no return values
#include <stdio.h>
#include <conio.h>
void addition(){
int a, b, sum;
printf(“\nEnter two numbers:\t);
scanf(“%d%d”, &a, &b);
sum=a+b;
printf(“\nThe sum is %d\n”,sum);
}
void main(){
addition();
}
(b) function with arguments and without return types.
calling statement : add(a, b);
receiving function: void add(int x, int y)
Ex. with arguments and no return values.
#include <stdio.h>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 442
#include <conio.h>
void addition(int a , int b){
int sum;
sum = a+b;
printf(“\nThe sum is %d”, sum);
}
void main(){
int a, b;
printf(“\nEnter two numbers: “);
scanf(“%d%d”, &a, &b)’
addition (a, b);
}
(b) function without arguments and with return types.
calling statement : int c =getNumber();
receiving function: int getNumber()
Ex.without arguments and with return types.
#include <stdio.h>
#include <conio.h>
int addition(){
int a, b;
a = 45;
b = 55;
return (a+b);
}
void main(){
int c;
c=addition();
printf(“Returned values are %d:“, c);
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 443
(c) function with arguments and with return types.
calling statement : int c = areaOfSquare(width, height);
receiving function: int areaOfSquare(x, y);
Ex. with arguments and return values
#include <stdio.h>
#include <conio.h>
void addition(int a , int b){
int sum;
sum = a+b;
return sum;
}
void main(){
int a, b, sum;
printf(“\nEnter two numbers: “);
scanf(“%d%d”, &a, &b)’
sum = addition (a, b);
printf(“\nThe sum is : %d\n”, sum);
}
while calling a function care should be taken that the number of arguments,
type or arguments, and sequence of arguments match between the statement which is calling the function and the function which is receiving the values.
if the function is returning any value that should be accepted or assigned to a
variable in the calling statement. Ex. int no1 = add(a,b);
Ex. example of calls to a function.
calling statement : int no1 = add(a, b);
receiving function: int add(x, y);
In this example, the value of “a” will be copied into “x” which is receiving the value and value of “b” will be copied into “y” which is receiving
the value.
remember “ a & b” will be called as arguments and “x & y” will be
called as parameters.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 444
the calling statement and the called function both can have variables
with same name.
Ex.
int no1 = add(a, b);
int add(a, b);
this type of calling is called as call by value.
in the place of “a & b” which are variables we can also use values like
int no1 = add (23, 45); or we can also use expressions in the place
of numbers like int no1=add ( (34*2)-23, (a-b*4) );
valid conversions are as applied for automatic conversions.
Ex. int c = add(a, b);
compatible data types in functions
if the variables “a & b” are declared as “float” and the receiving function has declared as int. then the automatic
conversion takes place and the values are converted to int
by truncating the decimal value.
if the calling statement is sending “double” type of values
and the receiving function is expecting “float”, the given
number is rounded upto the given digits.
if the calling statement is sending “long int” type of values
and the receiving function has declared them as int, then the
higher end values are discarded.
when value is returned by the function the variable which is
accepting the value, will convert the returned data type to
its own data type.
ex. int c = add(23,45);
here if “add()” function is returning a float value, then
that value is converted into int because “c” is declared
as int.
Incompatible data types in functions
if the calling statement is sending “long int” type of values and
the receiving function has declared them as string, then these
data types are called incompatible data types and they will produce error.
Different ways of calling a function
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 445
All the above description of functions is only about call by value ie., when the
function is called with arguments. A copy of argument values are copied into the
parameters of the receiving function. This type of function call is called by “call
by value”.
The second type of calling a function is “call by reference”.
In this type of call the address of the variable is passed into the function
as parameters.
In doing so the function can access the variables by address.
function can make the changes to the variable values and these values
will remain as changed by the function.
you have to understand the two things * and & here. the concept of
pointers.
when a & is preceded before a variable is it the address of that variable.
when a * is used, it means that it can store addresses of variable and not
the value of the variable itself.
ex.
int *a;
//a stores addresses of variables of type int.
float *b;
// b stores addresses of variables of type float.
char *c;
// c stores addresses of variables of type char.
int x;
float y;
char z;
a = &x;
b = &y;
c = &z;
a, b and c are pointers which store only addresses of variables. Hence address of “x” (using &x) is assigned to point “a” and address of “y” is
stored in point “b” and address of “z” is assigned to pointer “c”.
Ex. call by reference
#include <stdio.h>
#include <conio.h>
void swap(int *, int *); /*function prototype; receiving pointers*/
void main(){
int a, b;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 446
a=99; b=89;
printf(“\nBefore swap, a and b are: %d, %d”, a,b);
swap(&a, &b); /*sending addresses not values*/
printf(“\n\nAfter swap, a and b are :%d, %d”,a,b);
void swap(int *x, int *y){
int temp; /*swapping addresses and not values*/
temp = *x;
*x=*y;
*y=temp;
}
}
Types of variable modifiers
(a) local variables:
local variables are also called as automatic variables.
there is no specific keyword used before these variables.
when we use the term local, it is local to some scope, ie., within the braces.
The area to which it is restricted is known as “scope”.
if the variable is declared within a function, then the variable is known only
inside the function.
generally these variables after declaration has garbage values, we have to
assign values using assignment operator.
“life time” of the variable is the time until which the variable will be available
for program in the system.
the life time of a local variable is limited till the scope of variable. ie., if the
variable is declared inside a function, the value will be accessible and alive
until the function is running in the system.
(b) Global variable
global variables are variables declared at the top of the file after “#include,
#define etc.
there is no special keyword used for global variables, its only the place where
it is declared is important.
these variables are available and can be used by all the functions defined in
whole of the file.
life time of these variables is until the entire file is in execution.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 447
these variable can be declared from within a function also by using the keyword “extern”.
this is just like prototype declaration, the system will be informed that the
given variable is a global variable and it is defined else where in the file.
the nature of working is same as global variable.
by default the global variables are initialized to zero.
ex.
main(){
extern float marks;
….
….
}
func1(){
extern float marks;
....
….
}
float marks;
here the marks is defined as a global variable outside all the functions but at
the end of the file. But still it can used inside the functions.
(c) Static Variables
static variables are those which will be stored by the compiler directly
and accessed directly when necessary.
Life time of these variables is as long as the program is running.
Even if the control is out of the function its value will remain in the
memory. And next time when we call the function, the values can be
used again, as if it is continuing.
These variables are declared using the keyword “static”.
They are local to the scope in which they are declared.
The default value of such variables is zero.
variables declared as static will act like local variables in all other ways.
Ex. Static variables demo
With auto variables
#include <stdio.h>
With static variables
#include <stdio.h>
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 448
#include <conio.h>
Increment(){
int i=1;
prinft(“%d\n”, i);
i++;
}
#include <conio.h>
Increment(){
static int i=1;
prinft(“%d\n”, i);
i++;
}
void main(){
increment();
increment();
increment();
increment();
increment();
}
void main(){
increment();
increment();
increment();
increment();
increment();
output
1
1
1
1
1
1
2
3
4
5
(d) Register Variables
register variables are special variables which are stored not on the
memory of the computer but on the CPU (processor).
This will give quick access for the variables when compared to normal
variables.
Since the “on die memory” is costly and very limited it should be used
judiciously.
Only variables which are most often required in the program again and
again and which need less time should be stored as register.
the keyword register is used to store these variables.
these variables have life time till the (block of code) scope of the variable in which it is declared.
In all other ways register variables act like local variables.
Arrays
Array is a collection of similar data type values sharing a common variable name.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 449
All the values inside the array are called as elements.
Elements are addressed with the same name but with a index value. Ex.
Name[0].
The index values of the array elements are automatically generated and managed by the system.
Index numbers start from 0. If the number of elements in the array are 7 then
the index numbers will range from 0 to 6. The last element will be addressed
with index 6 and first element with index number 0.
Index values are written within a pair of square brackets “[ ]”.
In C all the values should be of same date type.
All the elements of the array are stored adjacent to one another in a sequence in
the memory.
Arrays are also pointers.
You can have as many elements as your memory can hold.
Declaration of array
Syntax: storage_class data type array_name[size];
Array “storage_class” can be any type of auto, static, extern or register. This
is optional, if nothing is given it is deemed to be a ”auto/local” variable.
“data type” can be any type of data like int, float, double, char etc.
Giving the data type means that all elements of the given array contain the
same data type as declared.
“array_name” should be written same as we write the name of a variables.
“size” which is given within the square brackets specifies the number of elements the array contains. It should be an integer.
Ex: array declarations
int nums [5];
long marks[5];
char name[10];
char str[120];
Initialisation of arrays
by default, before initialisation, arrays contain garbage values.
there are three ways in which we can initiatise an array.
int a[5] = {1,2,3,4,5};
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 450
in this type of initialisation all the elements are put inside the curly
braces and seperated with commas.
the number of elements can be less or equl to the size as declared on
the left hand side.
int b[] = {2,5,7};
in this type of declaration, the size of the array is assigned based on
the number of elements in the curly braces.
int c[10] ={45,89,54,8,9);
this type of declaration assigns the size of the array as given in the
square brackets.
then it assigns the values given in the curly braces starting from the
first index ie., 0. ex. c[0]=45, c[1]=89 and so on.
when the values are finished the rest of the elements are initialised
with zero.
Accessing arrays
arrays can be accessed using the index numbers.
if you need to access element 7 you need to mention the index as 6 ie, index -1
since the index numbers start from 0.
array elements have to be retrieved one by one with the index number.
doing this task can be accomplished by using an loop.
Ex.Accessing elements
#include <stdio.h>
#include <conio.h>
void main(){
int a[10], i;
printf(“enter ten numbers”);
for(i=0;i<10;i++) scanf(“%d”, &a[i]);
printf(“\n you have entered these ten numbers:\n”);
for(i=0;i<10;i++) printf(“\ta[%d] = %d”, i, a[i]);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 451
}
Ex.demo of memory location address
#include <stdio.h>
#include <conio.h>
void main(){
float a[] = {10.4, 45, 5, 5.5, 34, 55};
int i;
printf(“the continuous memory locations are : \n”);
for (i=0; i<5; i++) printf(“\t%u”, &a[i]);
}
Multi-dimentional array
syntax: storage_class data_type array_name[dim1][dim2][dim3]…;
multi dimentional arrays are arrays storing values in a specific pattern of rows
and columns.
one dimention has only one row and multi-dimentions will be growing in the pattern of rows first and then columns.
ex.
n[2][3] means “n” contains 2 rows and 3 columns.
n[2][3][4] means “n” contains 2 rows of 3X4 blocks.
n[2][3][4][5] menas “n” contains 2 rows and 3 columns of 4x5 blocks.
n[2][3]
n[2][3][4]
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 452
n[2][3][4][5]
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 453
Initialisation of multi-dimensional array.
A multi-dimentional array can be addressed with the index nos and assigned values directly. Ex. a[2][3] = 73; , a[2][5][0] = 87; …..
you can also initialise the variables with elements directly like : Ex. int marks[2][3] = { {2,4,6}, {8,10,12} };
here we are trying to tell the system about the two rows by putting them
in separate set of braces of two in number.
you can also avoid the first dimension in the double dimensional array when assigning the values directly like : Ex. int marks [][3] = { {2,4,6}, {8,10,12} };
its equivalent to
marks[0][0]=2; marks[0][1]=4;
marks[0][2]=6;
marks[1][0]=8; marks[1][1]=10;
marks[1][2]=12;
Ex. int marks[] [3] = {2,4,5,8,10}
here we are mentioning to the system that the number of columns are 3.
so the number of rows will be decided as required.
the number of columns remaining will be filled with zeros.
its equivalent to
marks[0][0]=2; marks[0][1]=4;
marks[0][2]=6;
marks[1][0]=8; marks[1][1]=10;
marks[1][2]=0;
you can also use a loop for initialising the values as given in the example.
Ex. Initialising 2D arrays
#include<stdio.h>
#include<conio.h>
void main(){
int matrix[2][3], i, j;
for(i-0; i<2; i++){
for(j=0;j<3;j++){
printf(“enter matrix [%d][%d] :\t”, i, j);
scanf(“%d”\t, matrix [i][j]);
}
}
printf(”\nThe entered matrix is : \n”);
for(i=0; i<2;i++){
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 454
for(j=0;j<3;j++)
printf(“%d\t”, matrix[i[j]);
printf(“\n”);
}
}
Passing arrays as arguments to functions
An element or a single value of the array can be passed as a normal value of a variable to functions.
Ex. calling statement: add(a[3], a[5]);
receiving function: add(int a, int b)
here the values are received as integer, so even the array values should
be of type integer.
Ex. passing array value
#include <stdio.h>
#include <conio.h>
void display(int n){
printf(“\t%d”,n);
}
void main(){
int nums[5]={100, 20, 3, 40, 15},i;
printf(“\nThe content of array is : \n”);
for(i=0;i<5;i++)
display (nums[i]);
}
An complete array values can also be passed on to the function for manipulation. to
do so we have to give the name of the array instead of the array with index. The
name of the array represents the complete values.
Ex. calling statement : add(nums);
receiving function: add(int a[])
here the complete array of nums is passed on to the function by using the
name of the array.
the name should be used without the square braces.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 455
the cotents or elements should be of the type int in this case.
the receiving function should declare the type of values it is receiving and
also the array should be mentioned by giving the square brackets in the
parameters place as given above.
Ex. passing complete array
#include <stdio.h>
#include <conio.h>
void change(int a[]){
a[0]=10;
a[1]=20;
a[2]=30;
a[3]=40;
a[4]=50;
}
void main(){
int number[5]={1,2,3,4,5}, i;
printf(“Before funciton call: \n”);
for (i=0;i<5;i++) printf(“\t%d”,nums[i]);
change(nums);
printf(“\nAfter function call”);
for (i=0;i<5;i++) printf(“\t%d”,nums[i]);
}
String arrays
In C there is no such data type as string.
a string is a collection of character type of data.
each character of the string occupies one value place in the array.
Every string is placed with a \0 or null. This is the only indication that the string has
ended at that point in the total array.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 456
Iinitialisation of strings
initialisation can be done as separate elements or even it can be assigned with
the whole string between double quotes.
Ex.
char name[]={ ‘r’, ’a’, ’m’ };
char name[]={“ram”};
both are one and the same the declaration in the second example is only for
strings.
Ex.string example
#include <stdio.h>
#include <conio.h>
void main(){
char name[] = “Shyam Prasad Sharma”;
int i=0;
printf(“\nThe name in discrete form: \n”);
while (name[i]!=’\0’){
printf(“\t%c”,name[i]);
i++;
}
}
Double dimension string array
String array can contain multiple dimension like storing a list of names etc.
the working of the array is same as the double dimention array as mentioned
earlier.
Ex. 2D names array
#include <stdio.h>
#include <conio.h>
void main(){
char names[5][25];
int i;
printf(“\nEnter name of 5 persons\n”;
for(i=0;i<5;i++) scanf(“%s, names[i]);
printf(“\nthe names you have entered are \n”);
for (i=0; i<r;i++) printf(“%s\t”, names[i]);
}
String handling functions
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 457
C libraray contains some functions specially for handling the strings.
strlen(), strcpy(), strcat(), strcmp(), strrev() are functions for handling strings.
These functions are included in the header file <string.h>. This file has to be included if you need to manipulate with the strings.
strlen()
The function returns an integer which denotes the length of the given string.
syntax: integer_variable=strlen(string);
Ex.strlen() demo
#include <stdio.h>
#include <conio.h>
#inlcude <string.h>
void main(){
char name[10];
int len;
printf(“\nEnter your name : \t”);
len=strlen(name);
printf(“\nThe number of characters in your name is : \t%d”, len);
}
strcpy()
strcpy() function copies one string to another string.
The function accepts two strings as paramenters.
It copies the second stirng, character by character into the first one up to and including the null character of the second string.
syntax: strcpy(destination_string, source_string);
Ex.copying strings
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main(){
char name[]=”saroj bhatta”, s[15];
strcpy(s, name);
printf(“\nThe value in two strings : \n s=%s \t name=%s”, s, name);
}
strcat()
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 458
strcat() function concatenates two strings
accepts two strings as parameters.
appends/adds the second string to the first string at the end.
syntax: strcat(string1, string2);
Ex.concatenating strings
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main(){
char firstName[20]=”Saroj”, lastName[]=” Bhatta”;
strcat(firstName, lastName);
printf(“\n The full name is %s”, firstName);
}
strcmp()
this function compares two given strings and finds out if they are similar or not.
accepts two strings as parameters.
Returns an integer after comparing the strings.
if the integer is less than 0(zero) then the first string is less than the second.
if the integer is greater than 0 then the first string is greater than the second
string.
if the integer is equal to zero, then both the first and second string is equal.
number is given based on certain calculation of character ASCII values.
syntax: integer_variable = strcmp(string1, string2);
Ex. comparing strings
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main(){
char name1[15], name2[15];
int diff;
printf(“\nEnter first string\t”);
gets(name1);
printf(“\nEnter second string\t”);
gets(name2);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 459
diff = strcmp(name1, name2);
if(diff>0)
printf(“%s is greater than %s by value %d”, name1, name2, diff);
else if(diff<0)
printf(“%s is greater than %s by value %d”, name2, name1, diff);
else
printf(“%s is same as %s”, name1, name2);
}
strrev()
this function is used to reverse all characters in a string.
syntax: strrev(string);
Ex.Reversing a string
#include <stdio.h>
#include <conio.h>
#include <string.h>
void main(){
char name[15] = "Ranga Babu", name2[15];
strcpy(name2, name);
strrev(name);
printf("The original string :%s\n",name);
printf("The reversed string :%s\n",name2);
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 460
POINTERS
pointers are addresses of variables.
a pointer holds the address of the memory of the given variable.
pointer cannot hold values other than addresses.
Pointers are of different types like int, float, double etc as are the variables.
An integer pointer can save only int variable addresses, and a float pointer can store
only float variable address.
Declarations:
syntax : data_type * variable_name;
int *p1;
float *p2;
a pointer is preceded by an asterick. except for this one change every pointer
the same way and formsrules as a variable.
Initialization Assignment:
A pointer should be initiased before use, because it has garbage values when declared
and may posses serious runtime problems.
while assigning the value for the pointer, remember that it will store only
the address of the variables (and not the value).
you cannot just simply enter some number into the pointer.
you have to assign only a valid address which is only an unsigned integer.
the address of which the pointer is pointing out should be the same as the
type of data stored in that address.
int pointer cannot point towards an float data type of variable.
ex.
int a;
int *p1;
float b ;
float *p2;
p2 = &b;
*p1 cannot point to address of “b” since it is of different data type.
The address comprises of base address followed by the byte addresses till the end
of the block.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 461
The block address of int type value will contain 4 byte address, double data type
block address will contain 8 byte addresses each adjacent to the beginning byte address. The first cell/byte address is known as base address.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 462
Integer data type address block
Base
Address
65524 65525 65526 65527
4 bytes make one block of int variable (4 bytes makes one unit)
double data type address block
Base
Address
65524 65525
65526 65527 65528
65529 65530
65531
8 bytes make one block of double variable (8 bytes make one unit)
If you need the number stored to the next of the base address you need not count 4
bytes if it is integer and 8 bytes if it is double type, just add 1 to the base address
pointer.
note that the addresses of the variables are retrieved by using “&” before the variable. ex. &a, &name, &address, &num etc.
Ex. demo of addresses
#include <stdio.h>
#include <conio.h>
void main(){
int a=10, b=20;
float c=10.4;
char d='C';
printf("\nThe
printf("\nThe
printf("\nThe
printf("\nThe
}
base
base
base
base
address
address
address
address
of
of
of
of
a is : \t%u",&a);
b is : \t%u",&b);
c is : \t%u",&c);
d is : \t%u\n",&d);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 463
note that all the data types are presented using “%u” conversion character as
it represents the unsigned integer.
the * is also called as indirectionor deference operator because it can point to
the address and also retrieve the values stored in the address.
the name of the pointer when used with the “*” sybol will point towards the value stored at the address and when used without any “*” symbol it produces the
address of the variable.
Ex. demo of pointers
#include <stdio.h>
#include <conio.h>
void main(){
int v=10, *p;
p=&v;
printf("\nAddress of v=%u", &v);
printf("\nAddress of v=%u",p);
printf("\n Value of v=%d", v);
printf("\n Value of v=%d", *p);
printf("\n address of p = %u\n", &p);
}
Void Pointer
Void pointer is a pointer declared with the keyword “void” so that it can be
used for storing any type of variable.
the pointer while initializing, it is implicitly casted into a specific datatype of
pointer.
ex.
void *ptr;
int a=10;
float b=20.344;
ptr = &a;
*((int *)ptr) will produce the value stored at ptr(pointer). First the address is converted into int type and then the value is extracted
since the * is used before the pointer.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 464
Ptr=&b;
*((float *)ptr) will produce the value stored at ptr(pointer). First the
ptr variable is type casted into float type of pointer and then since
the * is available before it, it will fetch the value stored at that address.
Ex. Void pointer demo
#include <stdio.h>
#include <conio.h>
void main(){
int a = 10;
double b = 4.5;
void *vptr;
vptr=&a;
printf("\na=%d", *((int *)vptr));
vptr= &b;
printf("\nb=%lf\n",*((double *)vptr));
}
null pointer: null pointer is a pointer initialized to NULL. It points to nowhere or
nothing.
Double pointer:
Double pointers are pointers to pointers.
These point towards address of pointers.
declared with ** symbols.
ex. int a= 20;
int *p;
int **q;
p = &a;
q = &p;
simply use p or q with printf to print the addresses which is stored in them.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 465
use *p or **q to point towards the value stored in the given address. Both
the pointer and double pointer points to the same values stored in the given
variable. ex. *p = 20 and **q=20 since both point to the same variable a.
Array of pointers
you can have a array of pointers, which will be holding addresses of different cells.
syntax: data_type *pointer_name[size];
arrays of pointers can also be initialized and used in a similar fashion as we use other variables.
ex. int *p[9];
p[0]=&a;
p[1]=&b;
p[2]=&c;
where a, b, c should be declared as int type.
Arrays and Pointers
Arrays are basically pointers. The name of the variable point towards base address
of the array.
In arrays the data is stored in a single line one row after the other in a sequence.
the name of the variable which is declared as the array holds the base address, with
the help of which we can access all the cells and their values by using the pointers.
the address of the cells are read in blocks of bytes(depending on data types).
if x[5] is declared as an array, then the first element(base address) is revealed by
using x. the next element is revealed using x+1, and next element as x+2 so on.
once the address is retrieved, the value can be easily got by using a * before it.
that is x = first element of the array, x+1 is second element of the array and so on.
Ex. array as pointer
#include <stdio.h>
#include <conio.h>
void main(){
int x[5] = {20,40,6, 8,100}, k;
printf(“\nArray elment\t\telement’s value \t\t address”);
for(k=0; k<5; k++){
printf(“\nx[%d] \t\t%d\t\t %u”,k,*(x+k), x+k);
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 466
Ex. using pointers
#include <stdio.h>
#include <conio.h>
void main(){
int marks[10], I, sum=0;
float avg;
printf(“enter marks of each student:\n”);
for (i=0; i<10; i++){
scanf(“%d”, marks+i);
sum+=*(marks+i);
}
avg=sum/10;
printf(“\nThe average is : %f”, avg);
}
Pointers and 2D arrays.
Two dimensional arrays are an extension of one dimensional array.
the base address for the 2D array is the same as that of one dimensional array.
all the elements in the same row are stored one after the other and every row is
stored one row after the other consecutively(side by side in a sequence).
An array of two dimensions can be made for using pointers. It will form an array of
given columns and rows which would store pointer values in it.
while declaring the 2D pointers array we should mention only the number of rows.
The syntax is data_type (*ptr_variable)[size2];
ex.
int (*x)[5]; is the declaration used for 2D pointers array.
int x[2][5]; is the declaration we generally use for 2D arrays.
in the above example int (*x)[5] specifies that the variable “x” is of type pointer and
it has 5 columns of elements.
here the number of rows is automatically determined when we initialize the array.
If you assign with 7 elements, the first 5 will be allotted to the first row and the next
two elements are assigned to the next row and initializing the other three elements
in the second row with zero.
the example int (*x)[5] tells the system that “x” is the base address (or pointer) of
the array and that it is containing 5 elements consecutively in one row. So as the
elements are initialized they are divided into 5 elements per one row.
Address of elements
int (*x)[5];
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 467
the first base address is denoted by the name of the variable declared ie., “x”.
the array x[3][3] is stored in memory as :int x[3][3] = { {1,2,3}, {4,5,6}, {7,8,9} };
1
6250
2
6254
3
First block/row
6258
4
6262
5
6266
6
second block/row
6270
7
6274
8
6278
9
6282
third block/row
every single block contains 4 bytes since the array is declared as int.
every element of the array can be accessed by using
*x+0 = 1
*x+1 = 2
*x+2 = 3
*x+3 = 4
*x+4 = 5
*x+5 = 6
*x+6 = 7
*x+7 = 8
*x+8 = 9
if you need the value of 2 dimension array use two “*” symbols before the
base pointer(name of the array variable).
If you need the value of 3 dimension array use three “*” symbols before the
base pointer.
This is called dereferencing the pointer. So, use the number of “*” as many
as the dimension of the array.
“x+1” is used for denoting the next row in a multi-dimentional array.
If “x+1” is used for 3 dimensional array it refers to the second row.
“(*x+1)” is used with required dereferences will produce the single row wise
values. Base pointer plus next single row.
“(*x+1)+1” is used you get the next element to the given second block. Base
pointer next single row plus element
That is the blocks in this case refer to the rows from the lowest form and not
the row of the given array.
x
x+i
: pointer to 1st row
: pointer to ith row
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 468
*(x+1) : pointer to first element in the ith row
*(x+i)+j : pointer to jth element in the ith row
*(*(x+i)+j)
: value stored in the cell i, j
Ex.pointer representation
#include <stdio.h>
#include <conio.h>
void main(){
int p[2][3]={ {1,2,3}, {4,5,6} };
printf("\np=%u\t\tP=1=%u", p, p+1);
printf("\n*p=%u\t\t*(p+1)=%u",*p,*(p+1));
printf("\n*(p+0)+1=%u\t*(p+1)+1=%u",*(p+0)+1,*(p+1)+1);
printf("\n*(*(p+0)+1)=%u\t\t(*(p+1)+1)=%u\n\n",*(*(p+0)+1),*(*(p+1)+1));
}
Ex. Adding two matrices
#include <stonio.h>
#inlcude <conio.h>
#define m 2
#define n 3
void main(){
int (*a)[n], (*b)[n], *(sum)[n], i, j;
printf(“enter first matrix : \n”);
for(i=0; i<m; i++)
for(j=0;j<n;j++)
scanf(“%d”, *(a+i)+j);
printf(“enter second matrix : \n”);
for(i=0; i<m;i++){
for(j=0;j<n;j++){
scanf(“%d”, *(b+i)+j);
printf(“\nThe sum matrix is : \n”);
for (i==0;i<m;i++){
for(j=0;j<n;j++){
*(*(sum+i)+j=*(*(a+i)+j)+*(*(b+i)+j);
printf(“\t%d”,*(*(sum+i)+j));
}
printf(“\n”);
}
}
Pointer operations
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 469
A pointer can be assigned with another pointer, if both the pointers are of the same
data type.
Ex
int a,b,
float c;
int *p1, *p2;
float *f;
p1=p2 is legal and valid since both point to same data type.
One pointer can be subtracted from other pointer provided they point to same elements of same array. For example.
Integer data can be added to or subtracted from pointer variables.
Ex. *p1+2, *f+1.
One pointer can be subtracted from other pointer provided they point to elements of
same array. For example : -
#include <stdio.h>
#include <conio.h>
void main(){
int a[]={45,89,54,29},*pf,*pl;
pl=a;
pf=a+2;
printf(“%d”, pf-pl);
}
Two pointers can be compared with each other provided that they are same object
type. Ex. If(p1<p2) {
}, is valid.
An address to a pointer cannot be assigned directly as an integer, though it may be
a memory address. It is not valid. Ex. P1=654456 is not valid.
Null value may be assigned to the pointer. Ex. P2 = null is valid.
Two pointers cannot be added or multiplied together or even a constant cannot be
added to a pointer. Ex. P1+p2; p1* p2; p1*2; are invalid
Passing pointer to a function
Passing a pointer means passing the address of the variable.
This type of addressing is also called as “call by address or call by reference”.
When the pointers are passed as parameters to the function from the calling statement, both the calling arguments and the receiving parameters should be of same
data type.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 470
when the function receives and makes changes to the values of the received variables they are permanent changes. That is the changes made inside the function
are reflected on the values outside the function.
Ex.
calling statement : addGraceMarks(&marks);
receiving function : void addGraceMarks(int *m)
marks is declared as a variable of int type.
addGraceMarks is a function receiving int pointer into “m” variable.
Ex. Passing pointers to functions
#include <stdio.h>
#include <conio.h>
void conversion(char *);
void main(){
char input;
printf("Enter character of your choice:\n");
scanf("%c", &input);
conversion(&input);
printf("\nThe correspoinding character is : \t%c \n",input);
getch();
}
void conversion(char *c){
if(*c>=97 && *c<=122)
*c=*c-32;
else if (*c>=65 && *c<=90)
*c=*c+32;
}
String and pointers
Since there is no such data type of string, in C, every string is a collection of characters, that is array of characters.
As told earlier an array is by itself is a pointer, so every string is also a pointer.
If a string is printed using %s format specifier, and the name of the string variable
is given then the whole values (ie., characters) starting from the base address of the
string till the end of the string, until it encounters a null character, is printed.
Ex.
char name[25] = “Ramesh”;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 471
Usage of string
Result
name
ramesh
name+1
amesh
name+2
mesh
name+3
esh
name+4
sh
Dynamic Memory Allocation(DMA)
Dynamic memory allocation is a process where memory is allocated during the execution of the program (runtime).
Once the program is loaded into the memory and is running, this is called the “runtime”.
When memory is manipulated at this jucture, it is called to be “dynamical”.
In situation where you do not know how much memory you need unless the program is executed, then the DMA techniques are useful.
For example you need to enter the number of students into a program for process
and you do not know how many students are there. In this situation you need to
use DMA techniques.
Here DMA refers to the RAM(ramdom access memory).
Once the program is finished it has to release the memory used by it for other
processes.
malloc(), calloc(), free(), realloc() are functions of C, which are defined in “stdio.h”
library file.
malloc()
it allocates requested size of memory bytes and returns a pointer to the first byte of
the allocated space.
Syntax: ptr=(data_type*) malloc (size_of_block);
“ptr” is a pointer.
“data_type*” is a explicit typecasting into given data type. Note that the *
symbol is given after the data type (ex. Int*)
”size_of block” is the number of bytes of memory.
Ex. X=(int*) malloc(100*sizeof(int));
calloc()
allocates required memory.
Syntax: ptr=(data_type*) calloc (no_of_blocks, size_of_each_block);
“ptr” is a pointer.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 472
“data_type*” is a explicit typecasting into given data type. Note that the *
symbol is given after the data type (ex. Int*)
”size_of block” is the number of bytes of memory.
“size_of_each_block” is the size of each block required.
Ex.
x=(int *) calloc(5, 10*sizeof(int));
x=(int*) calloc(5,20);
free()
this function is used to modify the size of previously allocated space using calloc,
malloc etc.
syntax : free(ptr) where ptr is a pointer to the memory which has been allocated.
realloc()
this function is used to modify the size of previously allocated space, either to reduce the allocated space or increase the allocated space.
syntax: realloc(ptr, newsize);
ptr is a pointer of the memory.
newsize is the size of the new memory.
Ex.DMAdemo
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
void main(){
int n, i;
float *p, sum=0, avg;
printf("\nHow many students are there?\t");
scanf("%d", &n);
printf("\n Enter marks of each student\n");
p=(float*)malloc(n*sizeof(float));
for (i=0;i<n;i++){
scanf("%f",p+i);
sum+=*(p+i);
}
avg=sum/n;
printf("\nThe average marks of");
for (i=0;i<n;i++)
printf("\t%.2f",*(p+i));
printf(" is : %.2f\n\n",avg);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 473
free(p);
}
ex. DMA sorting
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
void get(float *, int);
void display(float *, int);
void sort(float *, int);
int main(void){
int n;
float *num;
printf("\nEnter number of elements in our array\t");
scanf("%d", &n);
num=(float *)malloc (n*sizeof(float));
get(num, n);
sort(num, n);
display(num, n);
printf("\n\n");
getch();
return 0;
}
void get(float *nums, int n){
int i;
printf("\nEnter %d numbers : ", n);
for(i=0;i<n;i++)
scanf("%f", nums+i);
}
void sort(float *nums, int n){
float temp;
int i, j;
for(i=0; i<n-1; i++){
for (j=i+1; j<n; j++){
if(*(nums+i) > *(nums+j)){
temp=*(nums+i);
*(nums+i)=*(nums+j);
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 474
*(nums + j)=temp;
}
}
}
}
void display(float *nums, int n){
int i;
printf("\nThe numbers in ascending order:\n");
for(i=0;i<n;i++)
printf("\t%.2f", *(nums+i) );
}
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 475
Structures
A structure is a collection of variables under a single name.
Variables inside a structure can have different data types.
Variables are called as members of the structure.
A structure is a new data type containing different data types.
Syntax:
struct structure_name{
data_type member_variable1;
data_type member_variable2;
…
….
data_type member_variablen;
};
Structure is declared with the keyword “struct”.
Once declared a structure is treated as a new data type.
Variables can be declared of type structure as below : struct structure_name structure_variable;
Ex.declaration examples
1. struct student{
char name[20];
int roll;
float marks;
char remarks;
};
here “student” is a new data type containing variables name, roll, marks, remarks inside it.
variables of structure “student” should be declared as :
struct strudent st1, st2;
where st1 and st2 are new data type variables.
“struct” keyword should be used to tell the system that it is a structure.
Variables can be of different data types.
The structure should be terminated with a semicolon.
Variables of structure will be accessed using a “.” (dot) operator.
Ex. st1.name, st1.roll, st1.marks, st1.remarks.
2.
struct student{
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 476
char name[20];
int roll;
float marks;
char remarks;
} st1, st2;
Variable names of the given type of structure can be declared along with the
structure declaration itself as given above.
Here st1, and st2 are two variable names of structure student.
3.
struct {
char name[20];
int roll;
float marks;
char remarks;
} st1, st2;
name of the structure can be omitted as given above but it is obvious that we
cannot declare anymore variables apart from what are declared along with
the stucture itself.
Structure initialization
variables inside the structure can be initialised using the dot operator.
ex. st.name=”ram”;
st.rollno=100;
st.marks=56.78
variables can initiatialised all together at a time but the number of elements
and the sequence of the elements should match the variable in sequence and
type of data it holds.
Ex.structure:
struct student{
char name[20];
int rollno;
float marks;
};
declaration:
struct student = {“ram”, 100, 45.67};
NOTE: see that the type of data and sequence is managed.
struct student = {100, “ram”, 45.67} is not valid.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 477
variables of the structure cannot be initialised inside the structure definition
as other normal variables are done.
Ex. structure demo
#include <stdio.h>
#include <conio.h>
void main(){
struct student{
char name[20];
int roll;
float marks ;
char remark;
};
struct student s;
printf("enter name : \t");
gets (s.name);
printf("\nEnter roll :\t");
scanf("%d", &s.roll);
printf("\n Enter marks:\t");
scanf("%f", &s.marks);
printf("enter remark p for pass or f for fail: \t");
s.remark=getche();
printf("\n\n\n The student's information is \n");
printf("Student name \t\t\tRoll\tMarks \tRemarks");
printf("\n__________________________________________________\n");
printf("%s\t\t%d\t%.2f\t%c\n\n\n",s.name, s.roll, s.marks, s.remark);
getch();
}
Storage of structures
structures are stored in memory in consecutive blocks.
ex. structure storage
struct student {
int roll;
float marks;
char remarks;
};
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 478
struct student st={ 200,60.5,’P’ };
st.roll
65518
st.marks
200
65522
st.remarks
60.5
65530
‘P’
Array of structures
array of structures is a collections of structures in a array.
the declaration assignment and treatment of structures are same as other data
types.
Ex. Array of Structure declaration
struct Employee{
char name [20];
int emId;
float salary;
};
struct Employee emp[20];
struct Employee{
char name [20];
int emId;
float salary;
} emp[20];
Ex.Array of structure
#include <stdio.h>
#include <conio.h>
void main(){
struct student{
char name[30];
int roll;
float marks;
char remark;
};
struct student s[5];
int i;
float tempForMarks;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 479
for(i=0;i<5;i++){
printf("\n\nEnter Information of student no %d\n",i+1);
printf("Name : \t");
scanf("%s", s[i].name);
printf("\nRoll:\t");
scanf("%d", &s[i].roll);
printf("\nMarks : \t");
scanf("%f", &tempForMarks);
s[i].marks=tempForMarks;
printf("Remarks(P/F) :\t");
s[i].remark=getche();
}
printf("\n\nThe detail information is \n");
printf("Student Name\tRoll\tMarks\tRemarks");
printf("\n________________________________________________\n");
for(i=0;i<5;i++)
printf("%s\t\t%d\t%.2f\t%c\n",s[i].name, s[i].roll, s[i].marks,
s[i].remark);
}
Initialising Array of Structure
Each independent array element can be initialized as we initialize a normal structure.
as given below.
ex.
struct Book{
char name[20];
int pages;
float price;
};
struct Bookb[5] =
{
“programming in C”, 200, 150.5,
“Let Us C”, 455, 315;
“Programming with c”, 558, 200.15,
“Easy steps in programming”, 800,580,
“How to program in c”, 450, 370
};
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 480
NOTE: ensure that the type of data and the sequence of data is correctly given and separated by commas properly.
Structure within structure
one structure can be nested within another structure in C.
ex. structure of “day” within a structure “person”.
Date of Birth
struct data {
int day;
int month;
int year;
};
struct person{
char name[20];
int id;
struct data dateOfBirth;
float salary;
} p;
in the above example, the date structure is declared first so that it can be included
in another structure with three variables of int type (day, month, year).
then the given structure is added in another structure as a variable in another structure person.
one variable of type struct “person” is also declared with a structure name p1.
address the variables of structure date as
ex.
p.dateOfBirth.day
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 481
p.dateOfBirth.month
p.dateOfBirth.year
members within the person structure are addressed as normal.
ex.
p.name
p.id
p.salary
The above structure can also be nested as below : struct person {
char name[20];
int id;
struct date {
int day;
int month;
int year;
} dateOfBirth;
float salary;
}p;
Ex. Structure within another structure
#include <stdio.h>
#include <conio.h>
void main(){
struct date{
int day;
int month;
int year;
};
struct Employee{
char name[20];
int id;
struct date dateOfBirth;
float salary;
} emp;
printf("Name of Employee:\t");
scanf("%s", emp.name);
printf("\nID of Employee:\t");
scanf("%d", &emp.id);
printf("\nDay of Birth:\t");
scanf("%d", &emp.dateOfBirth.day);
printf("\nMonth of Birth:\t");
scanf("%d", &emp.dateOfBirth.month);
printf("\nYear of Birth:\t");
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 482
scanf("%d", &emp.dateOfBirth.year);
printf("\nSalary of the Employee:\t");
scanf("%f", &emp.salary);
printf("\n\nThe Detail information of entered employee\n");
printf("\n___________________________________________________________\n");
printf("%s\t%d\t%d\t%d\t%d\t%.2f\n",emp.name, emp.id, emp.dateOfBirth.day,
emp.dateOfBirth.month, emp.dateOfBirth.year, emp.salary);
}
Pointer with structure
Structure type of pointers can also be created as we create another variable pointers.
Structure pointer can normally be declared as we declare pointers of other types.
Pointer of structure type can hold address of the given structure type.
Ex. Structure pointer
struct book{
char name[25];
int page;
float price;
};
struct book b, *bptr;
NOTE: here “b” is a normal structure variable while “*bptr” is a pointer variable which can hold any address of structure “book” type address.
bptr=&b;
will allocate the base address of “b” to pointer “bptr”.
Individual members of the structure can be accessed by using “->” operator(arrow operator).
arrow operator is for structure pointers.
syntax: ptr_variable -> member;
ex. bptr->name;
bptr->page;
bptr->price;
other wise these members can also be accessed alternatively using variable like : b.name; b.page; b.price.
ex.structure with pointers
#include <stdio.h>
#include <conio.h>
void main(){
struct book{
char name[20];
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 483
int pages;
float price;
};
struct book b, *bptr;
printf("Enter book name:\t");
gets(b.name);
printf("\nNumber of pages:\t");
scanf("%d", &b.pages);
printf("\nPrice of the book: \t");
scanf("%f", &b.price);
bptr = &b;
printf("\n\nBook Information using pointer ie., arrow operator");
printf("\nBook Name =%s\tPages=%d\tPrice=%2.f", bptr->name, bptr->pages, bptr>price);
printf("\n\nBook Information Using pointer ie., * operator");
printf("\n\nBook Name=%s\tPages=%d\tPrice = %.2f", (*bptr).name, (*bptr).pages,
(*bptr).price);
printf("\n\nBook Information using structure variable ie dot operator");
printf("\nBook Name=%s\tPages=%d\tPrice=%.2f\n\n", b.name, b.pages, b.price);
}
Function and structures
structure members can be passed to a functions as normal variables.
complete structure can also be passed to functions as normal variables.
Passing structure variables
struct employee{
char name[20];
int id;
float sal;
} emp;
Calling statement:
display(emp.name, emp.id, emp.salary);
Receiving function: void display(char name[], int id, float sal)
emp.name, emp.id, emp.salary are members of structure employee.
variable name is emp.
Passing structure
struct book{
int pages;
int price;
} bk1;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 484
Calling statement:
display( bk1);
Receiving function: void display(struct book bk)
bk1 is a variable of structure book.
receiving function is receiving book type structure into variable bk.
Passing structure pointers
struct employee{
char name[20];
int id;
float sal;
} emp;
Calling statement:
display( &emp);
Receiving function: void display(struct employee *eptr)
Passing structure array
struct student{
char name[20];
int roll;
float marks;
char remark;
};
struct student st[5];
/array declaration for structure student
Calling statement:
display(st);
Receiving function: void display(struct student st[])
Unions
unions are same as structure in every aspect except that the memory for unions
work differently.
All the members of the union share the same memory unlike structure which have
memory allocation for all the members of the structure.
System allocates a single memory block of the size of the biggest member held by
the union.
ex.
union student {
int roll;
double marks;
}
in this example “int roll” occupies 4 bytes and “double marks” occupies 8 bytes.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 485
So the system allocates 8 bytes for the whole structure to work.
It means that the whole union has only 8 bytes of memory for the members to operate.
We can hold only one member at a given time in unions.
Apart from this functions, pointers, array etc work the same way as they work with
unions.
Nesting of unions inside a structure can also be done.
Ex. Union
#include <stdio.h>
#include <conio.h>
void main(){
union student {
int roll;
double marks;
};
union student st;
st.roll=455;
printf("\nRoll = %d", st.roll);
st.marks=78;
printf("\nMarks = %f\n\n\n",st.marks);
}
C Programming
1. Which of the statements related to the structures in C are true?( Choose two)
a. Member of the structure are accessed using structureMember.Variable syntax.
b. Member of the structure are accessed using structureVaraible. Member syntax.
c. Structure is a data type which represents different data types within the same
group.
d. Structure is a data type which represents only the same data types within the
same group.
2. Which of these statements are correct with respect to variables?
a. A variable name should describe the kind of data in it.
b. Letter such as 0 and 1 should be avoided in variable names.
c. The first character can be followed by a sequence of alphanumeric characters
and can also include special characters such as an underscore.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 486
3.
4.
5.
6.
7.
8.
d. Using proper name is a good method for naming variables.
e. Variable names can begin with an alphabet or number.
Presenting the algorithm to a group of peers in involved in ______________________
type of testing.
a. Dry Run
b. Independent Inspection
c. Structured Walkthrough
Identify the correct syntax to accept an integer value.
a. scanf(“%d”,&a);
b. scanf(“%f”,&a);
c. scanf(‘%d’,&a);
d. scanf(‘%f,&a);
A variable of type int has been declared in the program, and later an alphabet(say ‘A’) is
stored into it. What kind of an error would arise in this case?
a. Logical Error
b. Runtime Error
c. Syntax Error
Displayed below is a simple code and is presumed to be in the pseudo code format. Verify the validity of the statement.
BEGIN
ENTER A, B
SHOW A+B
FINISH
a. False
b. True
Validate the below pseudocode
BEGIN
DISPLAY ‘LEARN PSEUDOCODE’
STOP
a. Error in Line 1
b. Error in Line 2
c. Error in Line 3
d. No Error
Which of these declarations are correct with respect to a variable?
a. Int Num;
b. Int Num_23;
c. Int_num;
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 487
d. Int2num;
e. Iny Num23;
9. Which of the format specifier used to accept a string?
a. %c
b. %d
c. %f
d. %s
e. None of the above
10. Which of the following three are derived data types in C language?
a. Boolean
b. Double
c. Float
d. Long
e. Short
f. Unsigned
11. In the _____________ category, most compliers indicate the line which has given to the
error.
a. Execution error
b. Logical error
c. Syntax error
12. A modular approach has the advantage of
a. Altering parts of subprograms without affecting other parts of the program
b. Ease of understanding
c. Redundancy of code
d. Reusability of code
13. Placing most frequently used statements inside a separate function:
a. Allows reusability of code
b. Helps to avoid repetition of code
c. Increases redundancy
d. Reduces redundancy
e. None of the above
14. To avoid unnecessary repetition of code, it is a good programming practice to:
a. Place most frequently used statements inside a separate function
b. Place least used statements inside a separate function.
c. None of the above
15. ‘rand()’ is present within the ___________________library C.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 488
a. <math.h>
b. <stdio.h>
c. conio.h
d. stdlib.h
16. the advantage of modular approach programming are
a. Ease of understanding
b. Efficiency of maintenance of code
c. Functions return values.
d. Repetition of code
17. The general form of a WHILE loop is:
a. WHILE condition DO statement set DO END
b. WHILE condition DO statement set END DO
c. WHILE DO (condition) statement set DO END
d. WHILE DO (condition) statement set END DO
18. In C, sometimes to exit a loop even before the test-condition are satisfied, we use the
keyword:
a. BREAK
b. CONTINUE
c. NEXT
d. STOP
19. To exit the loop even before the test-condition fails to satisfy, we use the keyword
‘CONTINUE’.
a. False
b. True
20. To terminate the current iteration and continue with the next iteration, we use ‘CONINUE’ keyword.
a. False
b. True
21. The ______________ loop repeats a statement or set of statements while a certain specified condition is true.
a. Do
b. Repeat? Until
c. While
22. A method of algorithm-writing which uses a certain standard set of words which makes
it resemble code is termed as:
a) program
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 489
b) pseudo code
c) snippet
d) standard function
23. In ‘sorting’, once the value of the first element has been compared with all the other
elements in the array, it is said to have completed a/an ……………………
a. order
b. session
c. pass
d. phase
24. Binary search requires sorting of the selected array.
a. False
b. True
25. In linear search even if value in an element matches the value to be searched for, the
process does not end. The operation continues till all the elements are checked.
a. False
b. True
26. Sorting method involves comparing the value present in the first element with each of
the subsequent elements in the array.
a. False
b. True
27. Which of these statements are true with respect to comparison operator?
a. Comparison operators always return true.
b. Comparison operators are always evaluated left to right.
c. Comparison operators are binary operators.
d. Comparison operators can compare more than two expressions.
e. Comparison operators have precedence among the other type of operators
28. Which of the following is the correct syntax for IF construct?
a. IF
Statements
END IF
b. IF
Condition
Statement
END IF
c. IF condition
Statements
END IF
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 490
d. Al l of the above
29. When the IF condition is evaluated to true, then the control………………………
a. Comes out of the loop.
b. Enters into the loop again
c. Is passed on to the statement outside its body.
d. Is passed on to the statement within its body.
30. In a FOR statement, if the counter variable is not initialized, then:
a. It is optional for the program to go into the initialization section.
b. The program has to pass into the condition section and then into the initialization section
c. The program has to go into the initialization section
d. None of the above
31. Which of this syntax are correct for IF construct in C?
a. If (condition)
{
Statement;
}
b. If (condition);
{
Statements;
}
c.
If condition;
{
Statements;
}
d. None of the above
32. While declaring an array, the number in brackets denotes:
a. Array
b. Array index
c. Array type
d. None of the above
33. Identify the type of array the4 following statement depicts:
‘Array [3][2][5][7]’
a. Five dimensional array
b. Four dimensional array
c. One dimensional array
d. Three dimensional array
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 491
e. Two dimensional array
34. A two-dimensional array stores a series of values as a single line with each adjacent to
the other in the memory.
a. False
b. True
35. An array index is the number of the element that is included along With the array name
for accessing values from an array.
a) False
b) True
36. In the expression A+B , which of these statement are true?
a) + is an operand
b) A and B are operators
c) A is an operand
d) A +B is an expression
e) B is an operand
37. The …………… keyword is used to terminate the current iteration and continue with the
next iteration.
a) Break
b) Continue
c) Skip
38. In a do…….. While loop.
a) It is not necessary that the loop will execute even once if the condition is satisfied.
b) None of the above
c) The condition is evaluated at the bottom of the loop
d) The condition is evaluated at the start before the loop executes
e) The loop is executed at least once.
39. The two main kinds of loops are
a) Conditional
b) Iterated
c) Selection
40. The working of the function is not transparent to the developer.
a) False
b) True
41. When code is broken up into subprograms, it is easy to determine where an error has
taken place.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 492
a) False
b) True
42. Most programming language provides us a way of breaking a long, continuous program
into a series of subprograms, each of which performs a specific task.
a) False
b) True
43. ………….. provides a meaningful name for some location in memory, by which they can
be accessed.
a) Flowchart
b) Variable
44. In a pseudo code, comments are represented by…………
a) /*….. */
b) //
c) Rem
d) REM
45. In a c program, working of a program begins……………
a) Form main function
b) From the declaration point
c) From the include statement
d) None of the above
46. A flowchart can have more than one START but only one STOP point.
a) False
b) True
47. A set of instructions in a pseudocode is collectively called as …………..
a) Collection
b) Construct
c) Iteration
d) Sequence
48. Keywords are word reserved by a language for specific purpose but it is also permitted
to users to use these keywords as variable. Verify the correctness of the statement.
a) False
b) True
49. When the array size is greater than the size of the string stored in it, then the adjacent
field after the last character in an array is always reserved for the
a) Function character
b) Null character
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 493
c) Procedural character
d) Value character
50. In defining an array, base elements are also termed as
a) Lower bound of the array
b) Upper bound of the array
c) None of the above
51. Identify the correct statement defining an array.
a) An array consists of one variable using the same name
b) An array consists of one variable using one name
c) An array consist of several variable using one name
d) An array consists of several variables using the same name.
52. When the condition is false and NOT operator is applied, what will be the result of the
expression?
a) False
b) True
53. Which of these operators are unary operators?
a) And
b) Not
c) Or
54. In C, which of these symbols are used to perform a modular operation?
a) $
b) %
c) > >
d) ^
e) MOD
Access Note
Introduction to Database and Database Management Systems
A database is a tool for collecting and organizing information. Databases can store information about people, products, orders, or anything else. Many databases start
as a list in a word-processing program or spreadsheet. As the list grows bigger,
redundancies and inconsistencies begin to appear in the data. The data becomes
hard to understand in list form, and there are limited ways of searching or pulling
subsets of data out for review. Once these problems start to appear, it's a good
idea to transfer the data to a database created by a database management system
(DBMS), such as Office Access 2007.
Database
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 494
•
A database is a container (usually a file or set of files) of objects is used to store
organized data. One database can contain more than one table. For example, an
inventory tracking system that uses three tables is not three databases, but one database that contains three tables. Unless it has been specifically designed to use
data or code from another source, an Access database stores its tables in a single
file, along with other objects, such as forms, reports, macros, and modules.
Evolution of Database
The importance of data has been obvious form time immemorial. Before the advent of
computers, this data was written in books of registers; these could be considered
as ‘manual’ databases. Ever since computers were introduced as means of storing
data, the concept and structure of a database have undergone a sea change.
Database existed earlier also, but in the form of files. That is, data was stored in tabular format, with the rows in the table called ‘records’ and columns called ‘fields’.
Here, all the data was put into one table and term ‘database’ was used synonymously with ‘table’. Flat-file system was not very efficient, as searching operations
were very tedious. Finding a record involved looking through all the records till
that particular record was arrived at, or no more data remained to be searched.
This problem was solved with the help of an indexed-file oriented system. This system revolved around an index file, which stored a map of records and their locations. The index file in an ‘indexed file oriented system’ helps speed up the
process of searching for records. Although this change brought many benefits,
some problems still persisted. Some of these limitations were:
Data Redundancy- some data got stored unnecessarily in more than one place.
•
Data Inconsistency- this refers to maintaining the consistency of same data in the various
files.
•
Security- data sorted in these systems could be easily accessed by anyone, and therefore
prone to misuse.
Database Models
In the process of evolution, the database was designed on different database models,
with each model adding more efficiency to the database.
A database model can be described as a ‘description’ of the data container and a methodology for storing and retrieving the data. A database model is a theory or
specification describing how a database is structured and used. It is usually a set
of mathematical algorithms and
concepts. The analysis and design of these data models has been the cornerstone of
the evolution of databases.
Common models include:
• Hierarchical Model: - A hierarchical data model is a data model in which the data is organized into a tree-like structure. The structure allows repeating information using parent/child relationships: each parent can have many children but each child only has one
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 495
parent. All attributes of a specific record are listed under an entity type. In a database, an
entity type is the equivalent of a table; each individual record is represented as a row and
an attribute as a column. Entity types are related to each other using 1: N mapping, also
known as one-to-many relationships. The most recognized example of hierarchical model
database is an IMS designed by IBM.
•
•
Network Model: - The network model is a database model conceived as a flexible way
of representing objects and their relationships. The network model original inventor was
Charles Bachman, and it was developed into a standard specification published in 1969
by the CODASYL Consortium.
Relational Model: - The relational model for database management is a database model
based on first-order predicate logic, first formulated and proposed in 1969 by E. F. Codd,
in the famous work called “A Relational Model of Data for Large Shared Databanks”.
He specified a set of 12 rules that have become popular as Codd’s rules. A database that
meets these rules is classified as a true or complete RDBMS (Relational Database Management System).
Database Management System
A database management system (DBMS) is computer software designed for the purpose of
managing databases. DBMSes may use any of a variety of data models, such as the network
model or relational model. The role of a DBMS in a larger system is to allow other software, or
users, to store and retrieve data in a structured way.
A "Database Management System" is software that defines a database, stores the data,
supports a query language, produces reports, and creates data entry screens.
It can be described as a system involving: • Data
•
•
The software that utilizes the hardware (in order to store the data and provide a standardized method for retrieving or changing data.
The users who turns the data into information
A DBMS is a complex set of software programs that controls the organization, storage, management, and retrieval of data in a database. DBMS are categorized according to their data structures
or types. It is a set of prewritten programs that are used to store, update and retrieve a Database.
The DBMS accepts requests for data from the application program and instructs the operating
system to transfer the appropriate data. When a DBMS is used, information systems can be
changed much more easily as the organization's information requirements change. New categories of data can be added to the database without disruption to the existing system.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 496
Relational Database Management System
A Realtional Database is a collection of interelated data and programs.The data in the database
has to be related. Relational Database Management Systems(RDBMS) are among the most
popular types of DBMSs.
Some popular RDBMS are:• Microsoft Office Access 2007
• Microsoft SQL Server 2005
• Oracle 8.0 Server
• Saybase SQL Server
Relation, Tuples and Atributes
In the relation data model, the data in a database is organised in ‘relations’. A ‘relation’ is
synomyous with a ‘table’. A table consists of columns and rows, which are referred to as field
and records in DBMS term, and attribute and tuples in RDBMS term.
Common Term DBMS Term RDBMS Term
Database
Table
Database
Table
Table
Relation
Column
Field
Attribute
Row
Record
Tuple
Table
When you store information in your filing cabinet you don't just toss it in a drawer.
Rather, you create files within the filing cabinet, and then you file related data in
specific files.
In the database world, that file is called a table. A table is a structured file that can
store data of a specific type. A table might contain a list of customers, a product
catalog, or any other list of information.
Data in a database is stored in the form of tables. This data includes not just user data
but also system data, such as the structure of the tables, the data types etc. This
later category of data is referred to as ‘meta –data’ and is also maintained in tables
separate form the ones that contain the user data. Meta- data is best described as
‘data about data’.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 497
•
An ‘Attribute’ is a property or characteristic which hold some information about a relation.
•
A ‘Record’ or ‘Tuple’ is a complete collection of related fields
ItemCode
101
102
ItemName
Rara
Lux
ItemRate
14
18
A
•
Features and Responsibilities of an RDBMS
Control Data Redundancy: - Since data in an RDBMS is spread across several across
tables, repetition or redundancy of data is reduced. Redundant data can be extracted and
placed in another table, along with a field that is common to both tables.
•
Data Abstraction: - This would imply that the RDBMS hides the actual way in which
data is stored, while providing the user with a conceptual representation of the data.
•
Support for Multiple Users:-A true RDBMS allows effective sharing of data. That is, it
ensures that several users can concurrently access the data in the database without affecting the speed of the data access.
•
Multiple ways of Interfacing to the System: - This would require the database to be accessible through different query languages as well as programming languages. It would
also mean that a verity of front-end tools should be able to use the database as a backend.
•
Restriction Unauthorized Access:-A RDBMS provides a ‘security’ mechanism that ensures that data in the database is protected form unauthorized access and malicious use.
The security that is implemented in most RDBMSs is referred to as ‘User Level Security’, wherein the various users of the database are assigned usernames and passwords. Only when the user of the database enters the correct username and password is he able to
access the data in the database.
•
Enforcing Integrity Constraints: - RDBMSs Provides a set of rules that ensures that data entered into a table is valid. These rules must remain true for a database to preserve integrity. ‘Integrity Constraints’ are specified at the time of creating the database, and are
enforced by the RDBMS.
•
Backup and Recovery:- In spite of ensuring that the database is secure from unauthorized access as well as invalid entries, there is always a danger that the data in the database could get lost. This could happen due to some hardware problem or a system crash.
It could therefore result in a loss of all the data. To guard the database from this, most
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 498
RDBMSs have inbuilt backup and recovery techniques that ensures that the database is
protected from these kinds of fatalities too.
•
Users of an RDBMS
Database Designers: - These would be the people who analyze the kind of data that is to
be stored in the database, and would design the structure of the database.
•
Database Administrator: - More popularly known as the ‘DBA’, this would be a person
who monitors operations on a database and ensures that it is maintained efficiently.
•
Application Developer: - This category of people takes care of writing programs for accessing the database.
•
End User: - Entry of data and manipulation of this data is taken by the end users.
Database and Table Design
Before actually creating a database, it is extremely important to design it. It involves
creating a ‘Conceptual Model’ of the database. This can be ‘blue print’, based on
which the database will be crated later. The model should be designed such, that
the database should be able to satisfy the current as well as the future information
needs of the organization needs of the organization in picture.
The database designer would have to bear in mind the fact that this conceptual model
should not be dependent on the database model (whether hierarchical, network or
relation). In addition to this, the model should be independent of the RDBMS being used. One of the database designing models is Entity Relationship Model (ER
Model).
E-R Model
Designing of a model begins with the database designer and the end user discussing
and deciding on the data that is to be stored in the database. Data is collected and
collated by the designer from the various business truncations records and documents such as bills, reports, forms, and memos. With the help of the end user, the
designer then gathers information regarding the operational and the data
processing needs of the organization. He then follows this up by removing unrelated and redundant data.
At the end of this, the database designer identifies the tables, the relationships between different tables as well as the fields in each of the tables. To do this, the ER Model is generally used.
The Entity Relationship Model views the entire system as being composed of entities,
which are related to one another.
Entities
Entity can be used to denote a person, place, thing, object, event or even a concept,
which can be distinctly identified. It is therefore obvious that this term covers a
very broad spectrum. A student, having ‘Roll No’ ‘1’ or an institution called ‘Trinity College’ could be categorized as entities. An entity may be abstract too, like
an idea or a concept.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 499
Attributes
Each entity has a set of properties or characteristics that defines an entity; much like
the way adjectives describes a noun in spoken language. For example, the ‘Order
Number’, the name of the item that has been ordered, the quantity of items ordered, is examples of the attributes of the entity ‘Order’.
Relationship
A ‘Relationship’ can be defined as an association among entities. For example, a
‘Customer’ places an ‘Order’ for some item. This is an association between ‘Customer’, ‘Order’ and ‘Item’.
Creating Database & Table in Microsoft Access
First of all you need to understand how Microsoft Access breaks down a database.
Some keywords involved in this process are: Database File, Table, Record, Field,
and Data-type. Here is the Hierarchy that Microsoft Access uses in breaking
down a database.
Database File: This is your main file that encompasses the
Database
entire database and that is saved to your hard-drive.
Example) StudentDatabase.accdb
Table: A table is a collection of data about a specific topic.
Table
There can be multiple tables in a database.
Example #1) Students
Example #2) Teachers
Field: Fields are the different categories within a Table.
Field
Tables usually contain multiple fields.
Example #1) Student LastName Example #2) Student
FirstName
Data
Type
s
Data types: Data types are the properties of each field. A field
only has 1 data type. FieldName) Student LastName
Data type) Text
Values
Create a blank database
1. On the Getting Started with Microsoft Office Access page, under New Blank Database,
click Blank Database.
2. In the Blank Database pane, type a file name in the File Name box. If you do not supply a
file name extension, Access adds it for you. To change the location of the file from the de-
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 500
fault, click Browse for a location to put your database
(next to the File Name box),
browse to the new location, and then click OK.
3. Click Create.
Access creates the database with an empty table named Table1, and then opens Table1 in Datasheet view. The cursor is placed in the first empty cell in the Add
New Field column.
Create a new table
Click the Microsoft Office Button, and then click Open.
1. In the Open dialog box, select and open the database.
2. On the Create tab, in the Tables group, click Table.
A new table is inserted in the database and the table is opened in Datasheet view.
Add a new field to a new table
1. Click the Microsoft Office Button, and then click Open.
2. In Open dialog box, select and open the database.
3. On the Create tab, in the Tables group, click Table.
4. Access inserts a new table in the database and opens it in Datasheet view.
5. Type your data in the cell below the Add New Field column header.
When you enter data in the new column, Office Access 2007 uses the information
you type to recognize the appropriate data type for the field. For example, if you
type a date in the column, such as 1/1/2006, Office Access 2007 sees the information you entered, recognizes it as a date, and sets the data type for the field to
Date/Time. If Access doesn't have enough information from what you enter to
guess the data type, the data type is set to Text.
The following table shows how automatic data type detection works in Datasheet
view.
If you type:
Office Access 2007 creates a field with
a data type of:
John
Text
http://www.contoso.com
Hyperlink
You can use any valid Internet
protocol prefix. For example, http://, https://, and
mailto: are valid prefixes.
50000
Number, Long Integer
50,000
Number, Long Integer
50,000.99
Number, Double
50000.389
Number, Double
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 501
12/31/2006
The date and time formats recognized are those of your
user locale.
December 31, 2006
10:50:23
10:50 am
17:50
$12.50
The currency symbol recognized is that of your user
locale.
21.75
123.00%
3.46E+03
Date/Time
Date/Time
Date/Time
Date/Time
Date/Time
Currency
Number, Double
Number, Double
Number, Double
Save a table
1. Click the Microsoft Office Button, and then click Save. -Or2. Right-click the table's document tab, and then click Save on the shortcut menu.
-Or3. Click Save on the Quick Access Toolbar.
4. If you are saving the table for the first time, type a name for the table, and then click OK.
Creating the ‘Relationship’ between the tables
A Relationship is a link that is created and maintained between two tables that enable
data to be accessed from both the tables simultaneously. Once the table has been
created, there is need to specify the relationship that exists between the tables.
This will come in handy when the user wants to retrieve information that exists in
more than one table, as one unit. Although, this can be done even at a later stage,
it is appropriate that we define the relationships when the tables are initially being
created.
Defining a relationship would involve linking the common fields in two tables. Once
this is done, data from either table can be extracted and displayed. In many of
Visual RDBMS tool, such as MS-Access, setting a relationship is simple and user
friendly.
Keys
A Key is a field or column in a table that is used to identify records.
Types of Keys
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 502
•
•
•
•
•
Primary Key: -A Primary Key is a field of a group of fields that uniquely identify
records in a table. It ensures that each record is unique. The Primary Key for a table can
be assigned when the table is created itself. In the Customer table, for example, every
customer has a customer code that can never be duplicated. In other words, the customer
code is always unique. This field ensures that every record in a table is unique. Such a
field is assigned as the Primary Key. Although, it is not mandatory that a Primary Key be
assigned to every table, it is usually a good practice to do so.
Composite Key: - If the Primary Key constraints are enforced on a combination of two
or more field is called Composite Key. This might be necessary when a combination of
fields uniquely identifies records in a table.
Candidate Key: - A field that qualifies to be a Primary Key in a table, or one that could
be used as an alternative to a Primary Kay is referred to as a Candidate Key or Alternative Key. It should consist of one field, or a set of fields, which could uniquely identify
each row in the table.
Secondary Key: - An Alternative Key that is not used as a Primary Key is called Secondary Key.
Foreign Key: - This is a field in a table that refers to a Primary Key field in another table. Consider the example of the relationship between the Customer and OrderMaster
able illustrated below.
The ccode field in the Customer table is Primary Key, while the ccode field in the
OrderMaster table is not. When we set a relationship between these two fields, the
ccode field in the OrderMaster table is said to be Foreign Key. This field in the
OrderMaster table can only have values that already exist in the ccode field of the
Customer table. A Foreign Key can therefore be defined as a copy of a primary
key in another table.
The table which has the Primary Key field is referred to as the Master table, while the
related table which has the Foreign Key is referred to as the Detail table. A Foreign Key can have a NULL value.
RDBMS like MS-Access provide a feature called Referential Integrity. It is a set of
rules, which ensure that every value that is entered into the foreign key field of the
detail table is validated to check that it exists in the primary key field of the master table.
For example, the OrderMaster table in the example above has a foreign key that
points to a field in the Customer table. Referential Integrity would prevent you
from adding a record to the OrderMaster that cannot be linked to the Customer table. That is, the RDBMS does not permit the user to enter a record in OrderMaster, with a customer code that does not exist in the Customer table. In a similar
manner, it would also forbid the user form deleting a record from the OrderMaster
table, if it has a related record in the OrderDetails table.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 503
In other word, it can be said that Referential Integrity ensures that every Child
Record (a record in the Detail table) has a corresponding Parent Record (a
record in the Master table). It is often described as a mechanism provided by the
RDBMS that ensures that no Orphaned Records (child records without parent)
exits in the database.
In addition to this, the referential integrity rules might also specify that whenever the
user deletes a record from the Customer table, any records from the Customer table, any records in OrderMaster that are linked to the deleted record will also be
deleted. That is, when the user deletes a record pertaining to customer code
‘TLT’, corresponding records belonging to the particular customer are automatically deleted from the OrderMaster table. This is called Cascade Delete. Another
thing that the referential integrity rules could specify is that whenever you modify
the value of linked fields in a table, all records in the related table are also modified accordingly. That is, changing the customer code of a particular customer in
the Customer table would cause the customer code of the related customer to be
changed. This is called Cascade Update.
Creating a Database using Access 2007
Starting Access 2007
Double click on the Access 2007 icon on the Windows desktop
(see right), or click-on the Start button in the lower left
corner of the screen, then click-on Programs, and then
click-on Microsoft Access 2007.
The Getting Started with Microsoft Office Access screen will appear (image below).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 504
For previous Access users: The above menu screen
is new in Access 2007. Take a few minutes to
peruse this screen. You will notice that (on the
top left of the screen) that the “old” Access
Templates (already created databases) are still
available.
As we move through this tutorial, many features of
“old” Access will be familiar to you.
Left Mouse Button
In this tutorial, whenever we indicate that you need to click the
mouse, it will mean to click the left mouse button – unless we indicate that you should click the RIGHT mouse button. So, always
“click left” unless we tell you otherwise.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 505
Creating an Access 2007 Database
This tutorial will assist you in creating a database that includes the features most often used in databases. Once you gain skill with the database you create, you will
be able to use and understand the already created Microsoft Access databases
mentioned on the last page.
We’ll begin with a Blank Database and increase our database knowledge with each
step.
Look at the center of your Access
screen. You will see – Getting
Started with Microsoft Office
Access. Below the title you will
see a Blank Database button.
Click the Blank Database button.
As soon as you click the Blank Database button, the right side of your Access screen will
change and look like the image on the left.
Saving your work
One of the unique things about Access database is that it requires you to save your database as soon as you enter the program.
You can save your work on a floppy diskette in
the A: Drive, on a USB key/Flash Drive or on
your C: Hard Disk, or in some other drive.
Please save to one of these areas and substitute
your Drive in the instructions.
To choose the Drive, on which you will save
your Access database, click the small folder to
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 506
the right of File Name:
A New File Database menu screen similar to the one below will appear when you
click the folder.
In the upper left corner of the File New Database menu screen that appears, you
will see a Save in: area (see upper left arrow above). Click-on the small down
arrow on the right and it will show you the various disk drives available on
which you can save (see right upper arrow above). Point to the drive on which
you want to save your database, and click-on it. If you choose the 3½ Floppy
(A:), make sure you have a formatted disk in the A drive. If you choose the C:
drive, choose the folder in which you want to save by double clicking on the
folder. Your selection should now appear in the Save in: area
Next click-in the area to the right of File Name:. Delete any text that is entered in
the area and then type-in the word PERSON as shown at the bottom of the
above image (see lower left arrow).
Now click-on the OK button or tap the Enter key (see
lower right arrow on last page).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 507
You will now return to the Getting Started with Microsoft Office Access screen. On
the right side of the screen you will see your database File Name and below it,
the Drive on which you will create your database.
Click the Create button.
Creating a Table
When you click the Create button your Access 2007 screen will change to the image
below. This is the “new look” in 2007 Office. You will now see Tabs and Ribbons that automatically appear for the area in Access on which you’re working.
Instead of a Menu Bar and drop down selections, you’ll now see these new features.
When we clicked the Create button Access assumed we desired to create – within
our Person database – another database – which is called a Table. You’ll notice
that at the top of the above image that the Table Tools and Datasheet Tabs appeared to assist you. The Ribbon below these Tabs is composed of Groups of selections you’ll use to assist you as you create your Table. We’ll be working with
these Tabs/Ribbons throughout this tutorial.
In the lower portion of the above image you’ll see selections that indicate we are creating a new Table.
On the left of the Table Tools-Datasheet Tab/Ribbon you’ll see a View
button. Click the View button.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 508
When you click the View button the image on the left will appear.
Since we want to create or design a new Table, we’ll click the Design View selection.
A Save As menu screen will appear
similar to the image on the
right. Type personnel in the Table Name: area and then click
the OK button.
Your Access 2007 screen will now change again – to the image below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 509
We’ve enlarged the upper left corner of this image
below.
Notice (in the image above) that our Table Tools Tab still appears. However, because we are now in the Design process, the lower Tab/Ribbon has changed to
Design – to assist us with designing our Table.
In the image on the last page
you will notice that the
Primary Key button is
“orange” and, in our Personnel Table, that it is also
“orange” – with a little key
to the left of ID.
In database language this is called “keying.”
Keying, or indexing, is somewhat advanced. You can get a good description by
searching in Help for Keying or Primary Key.
To “turn off” the Primary Key, click the Primary Key button. You’ll notice that they
Primary Key button is no longer “orange” and the little key is gone from the left
of ID.
If the Personnel Table image does not “fill” the screen,
click-on the small square between the “minus and
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 510
the X” in the upper right hand corner of the screen (see arrow and image on
right). This will Maximize the screen.
Notice, under the Blue Bar at the top of the Design screen there are (3) things: Field
name, Data Type, and Description
And, in the lower half of the window; Field Properties.
We’ll be creating the Field Names that make up a database. This is similar to creating a blank personnel form (on paper) that will be "filled-in" for each employee
(Name, Address, Phone Number, etc.). The areas that will be filled in are called
Fields in a database. When you fill in all of the fields for a person, the individual
"forms" are called records in a database. There will be a record, or form, for
each employee. All the forms, together, make up a Table (database).
So let’s create a personnel database.
Significant Note:
When creating a database it is always best to “break down”
a field into its “smallest parts.” For example – Name would break down into
First Name, and Last Name (you could also have Middle Initial, Title, etc.) Address would break down into Street Address, City, State, and Zip (you could also
have Apartment Number, etc). Because we are working in Access 2007 it will be
very simple to “put the fields back together” with a few mouse clicks when we
need to do this. Trust us. This will save you a lot of time later on.
Look at the image on the
right. Click-in the area
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 511
or space under Field Name and type-in Last Name (to replace ID). Tap Enter
or click-in the area to the right under Data Type. The cursor now moves to the
right under Data Type. Click the down arrow under Data Type on right (see arrow on right). Your design screen should look like the one on the right.
Now we’ll talk about Data Types.
Data Type
Text
You may type in any alphabetical/numerical data that you desire - up to a maximum of 255 characters. As indicated, this is a text field, so you can't do mathematical calculations. Examples of Text data are: names, addresses, stock numbers, room numbers, zip codes, etc.
Memo
This field is for lots of text. You can have up to 32,000 characters.
Number
This field is for numbers where you want to add, subtract, multiply, divide, average, and do numerical calculations. This field can be a very large size, so when
we get to Field Properties, we'll talk about "sizing" this field so it doesn't take up
to much "space" in storage.
Date/Time
Dates and Times. You may format these later, as you may desire.
Currency
Dollars ($). You may format these later, as you may desire.
AutoNumber
This field is an "automatic" counter that assigns a number each time you
put data into a new field.
Yes/No
This is a "True/False" or "Yes/No" type of field.
OLE Object
This means "Object Link Embedding" which indicates you can insert a graphic,
picture, sound, etc. Pretty neat to put a photograph in a personnel record or a
picture of an inventory item in the stock record (advanced stuff).
Since this is a simple, introductory Access tutorial, we won’t work with Hyperlinks,
Attachments, or Lookup Wizards.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 512
We'll leave Last Name as a Text Data Type. To the right under Description you
may make any remarks you feel are appropriate to someone who may want to
know how/why you designed the field as you did.
Now notice in the lower part of the screen, under Field Properties, that a box appeared when you selected the Text Data Type. This box is "tailored" to the Text
Data Type that you selected above. Your Field Properties should look like the
one below when you finish doing the steps indicated below.
Field Properties
Click-in each area (to the right of the words) as you read about it below
Field Size
Is currently set to 255 characters. That's pretty large for a name. So, clickin this area and change the number to 25 (you can make this larger or smaller
later if you have to).
Format
Now click-in the Format Area. Next tap the F1 function key to activate Help.
Since you are in the Format area, Help will be "tailored to" this area. When the
Help Window appears, click Format Property.
Now click Text and Memo Data Types. Notice that there are several choices to
make your characters upper or lower case. This gives you an idea of some formats. We'll use one later. Now click-on the “X” in the upper right corner of the
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 513
Microsoft Access Help – Format Property Window to close it.
Input Mask
We'll come back to this feature later.
Caption
Look at the Light Blue Help area to the right. It explains about Caption.
Default Value
We'll come back to this feature later.
Validation Rule
We'll come back to this feature later.
Validation Text
We'll come back to this feature later.
Required
Look at the Light Blue Help area to the right.
Allow Zero Length Look at the Light Blue Help area to the right.
Indexed
Look at the Light Blue Help area to the right.
Unicode Compression
Look at the Light Blue Help area to the right.
IME Mode
Look at the Light Blue Help area to the right.
IME Sentence Mode
Look at the Light Blue Help area to the right.
Smart Tags
Look at the Light Blue Help area to the right.
Now we’ll repeat this process and create different Field Names and Data Types.
Type-in the Field Names as indicated below and set them to the Data Types and
Sizes indicated. Start each new Field Name and Data Type - below the previous
field (see example below)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 514
Field Name
Last name
First name
Social Security #
Data Type
Size
Text
Text
Text
25
20
15
(Already Completed)
We'll use an Input Mask for our Social Security Number. Click-in the Input Mask
area in the Field Properties area at the bottom of the screen (see left arrow below).
Notice the three "dots" (...) in a box on the right. Click-on the three dots (see right
arrow above). An Input Mask Wizard will appear: "Must Save Table First. Save
Now?".
Click-on Yes.
A Save As Window may now appear. If it does, type-in Personnel in the area under Table
Name:, and click-on OK.
The Input Mask Wizard will show
you some SamPrepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 515
ple Masks (you may scroll up/down to view them). We'll use Social Security
Number, so click-on it. Your screen should look like the one below.
Now click-on Next at the bottom of the Input Mask Wizard screen.
You will now see a default number of 000-00-0000 using dashes (-) between the
numbers. You can use anything you want.
We'll leave it as is, so click-on Next> again (at the bottom of the Input Mask Wizard
screen).
On this Input Mask Wizard screen you’ll see two choices. Click-in the little circle to
the left of With symbols in the mask, like this:. Sometimes, when we use Access
data as a part of mail merges or in labels, if we don’t save the dashes, they won’t
appear in our document. So, it always a
good idea to save dashes.
Click-on Next> again.
Now click-on Finish.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 516
You will see some “special” numbers written in the Input Mask area for Social Security #. When you begin to enter data in this field, you’ll see how this works.
Your Field Properties area should look like the image below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 517
Now continue entering the following information in the Field Name and Data Type areas as we
did above.
Street address
City
State
Text
25
Text
Text
20
2
Here we'll use a Format. First make the Field Size 2 then click-in the area to the
right of Format.
A down pointing arrow, like the one above (see arrow), will appear on the right
side of the Format area. If you click-on the arrow, the area will appear blank
(that's because we haven't entered a Format). Tap the F1 key in the row of
Function Keys at the top of the keyboard. A Help menu screen “tailored” to
Format will appear )like the one below).
Since you are in the Format area, Help will be "tailored to" this area. When the Help Window
appears, click Format Property.
Since we are working with a Text Data Type,
click-on Text and Memo Data Types (see
arrow below).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 518
Notice that a > will change any alphabetic character you type into all upper case
letters. Now point and click the “X” in the upper right hand corner of the Format Help Screen (notice that the Help Window closes "automatically").
Now type a > in the Format area. Your Field Properties area should look like the
one below.
Continue entering the following information in the Field Name and Data Type areas as we did
above.
Zip
Gender
Text
Text
5
1
Insert a > in the Format area to make all gender entries become upper case (capitals - like
you just did for State).
Favorite Number
Number (Note: this is the first Number field)
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 519
Here we'll learn about Numbers, the Validation Rule and Validation Text. We'll limit the
person's favorite number to a number between 1 and 999. Leave the Field Size set to
Long Integer.
Now click-in the area to the right of Decimal Places. It currently indicates Auto.
When you click, you will see a little down arrow on the right side of the area.
Click-on the little arrow. Select “0.” This indicates that decimal places are not
allowed in the Favorite Number.
Next, click-in the Validation Rule area. We'll "build" a mathematical expression that
will only allow numbers from 1 to 999. Type in the following expression (in the
area to the right of Validation Rule):
> 0 and < 1000
This tells Access that the number entered must be between 1 and 999.
You’ll notice that when you click-in the Validation Rule area that three periods (…)
appear just like they did in Input Mask. If you want to click-on the three periods
they will bring up an Expression Builder which you can use to create the mathematical formula above. Please note that frequently, if you are really not great at
math, the Expression Builder can cause problems. Sometimes, the Expression
Builder will “insert” an <<expr>> in the formula. If it does this, delete the
<<expr>>. This will confuse Access, and will frequently cause the program to
“stop” until you remove <<expr>>. So, if you want to look at Expression Builder,
please do so. But – be careful.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 520
If someone does not enter a number correctly, an error message will appear. Now
we'll create an appropriate error message. Click-in the Validation Text area
and type-in:
Favorite Number must be between 1 and 999.
When you finish all of the above, your Field Properties should look like the one below.
Continue entering the following information in the Field Name and Data Type areas as we did
above.
Date hired
Date/Time
In Format area click the small down arrow on the right side of the Format area
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 521
and choose Short Date. In the Input Mask area click the three dots (...), Save the table,
and choose Short Date again, click Next>, click Next> again, then click Finish. (This will
insert a / between the day, month, year).
Your Field Properties should look like the image below.
Salary
Currency
In the Decimal Places Field Properties area click-on the small down arrow on the
right side and select 0 – this indicates “no cents.” Type a 0 (zero) in the area
to the right of Default Value. This will indicate 0 income if no Salary figure is entered.
Your Field Properties screen should look like the image below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 522
Application Received
Yes/No
We’ll make this a “Yes/No” or “check box” field. When we begin entering data in
the database, you’ll see how this “box” works.
Now that we have created our Person Database and Personnel Table it would be a
good time to Save the last few changes.
Microsoft Office Button
The Microsoft Office
Button has replaced File
in the Menu Bar. In the
upper left corner of your
Access 2007 screen you
will see a button similar
to the image on the
right. This is the Microsoft Office Button.
Click the Microsoft Office Button.
You will now see the Access
2007 Microsoft Office Button selections.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 523
First, notice that many of the “old” File-Menu Bar choices are included in this menu
(they are all here – we’ll show you).
Since we Saved our database at the beginning of the tutorial, we only have to click
the Save choice.
Quick Access Toolbar
You could also click the small diskette in the
Quick Access Toolbar in the upper left
corner of your Access screen.
Entering data in the database
At this point you will still be in the Design view. To enter data
into your Table you will need to be in a Datasheet
View. In the upper left corner of your screen (under
the Home Tab) you will see that the first button on
the left that has a small sheet of paper (see arrow
on the right) – the View button. Point to this button
with the mouse and pause, you will see a "Tool Tip"
that indicates that this button is the View Button.
This is logical because you have been designing your table and now want to view
the data that you will enter in your Table (database). If you are familiar with
spreadsheets it looks like a tiny version spreadsheet. Click the View button.
When you click the View button, the top of your Access screen will look like the image below. Notice that all of the Fields you created are – in the order you
created them – along the top of the Table.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 524
Some of the Field Names may be “cut off” a bit. We’ll widen our fields in a moment.
You can enter data in each Field. But let’s widen some of our columns a bit so we
can see the titles.
Widening Columns in Datasheet View
To widen columns so
you can see the
Field Names in the
Datasheet View you
will need to move
your cursor over the “line” between two Field Names (like we did in the image
above). When our cursor was over the line between Street Address and City, it
turned to a line with two arrows pointing left and right. When you see this line
with the arrows, click and hold down the left mouse button and move your cursor to the right a bit. You will see the column get larger as you move your cursor. When you have the column as wide as you desire, take your finger off the
mouse button. You may desire to widen other columns so you can see all of
your data – like First Name, Last Name, Street Address, etc. You widen as you
desire.
One note – since we have a Validation Rule in one of our Fields, if we try to widen
a column we will get the Validation Rule error message. So, it’s best to only
widen columns when you are not entering data.
Entering Data
Under Last Name you will see a flashing cursor; this means that you are ready to
begin entering data. You may type the data and tap Enter, or click with the
mouse in each field. If you make a mistake you may retype the data. If you see
a mistake later you can come back at any time and correct it.
Under each field, type the following in the area below the Field Name:
Field Name
To be typed
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 525
1. Last Name
Smith
2. First Name
Fred
3. Social Security #
123-45-6789
4. Street address
100 Main Street
5. City
Lynchburg
6. State
va
7. Zip
24501
8. Gender
m or f (your choice)
9. Favorite Number
2007
10. Date Hired
07/01/1993
11. Salary
40000
12. Application Received
Point the mouse to the little square and click the left mouse button. You will see a check mark appear in the square. A click in
the square indicates that the application has been received. If you
do not click, then that will mean the application has not been received.
As you are entering this data you will notice several things.
Social Security Number and Date Hired –
You’ll “see” your Input Mask work.
State and Gender – you typed in small letters – notice how the Format ( > ) forced the letter(s) to be capitals.
Favorite Number – since the Favorite Number is “too big” you will see your error message
appear. Click-on OK in the message screen and then create a Favorite
number that will work.
Salary -
notice how your Currency formatting created a $, commas and periods.
When you have completed typing the information, tap Enter so the cursor will move
down to the next record. You are now ready to insert your second entry.
Note: When you tapped Enter, Access automatically saved your first record. This
can be confirmed by the display of the hourglass.
Also note: As you began typing your first record a small pencil appeared in the left
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 526
margin. This indicates that you are "writing to" this record (editing). Below the
pencil an * (asterisk) also appeared. This indicates that your next record will go
below the first.
There are (2) methods for entering data into the database:
1. The method you just used is called Datasheet View method.
or
2. You can use the Form View method (we’ll create a Form in a bit later in the
tutorial).
Exiting and Saving
Anytime you need to leave your database, click
the Microsoft Office Button in the upper left
corner of your Access screen, then click Exit
Access – in the lower right corner of the menu screen. If you have not saved
your spreadsheet, a reminder box will appear asking you to do so.
Notice the Access Options button to the left of Exit Access. Earlier, we indicated
that all of the choices under File in the Menu Bar are still available using the Microsoft Office Button. Click the Access Options button. The Access Options
menu screen (top of next page) will appear. As you can see, all of the choices
available under File in the menu bar are here – as well as many more.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 527
If you click the Resources selection in the Access Options menu, you will see some
great on-line resources available to assist you with Access.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 528
After you have reviewed the Access
Microsoft Office
button choices,
click the Exit Access button.
If Access asks: “Do you want to save?,” click. If Access shows you a Save file
screen, give it a name of your choice and click on OK. You should then exit to
the Windows Screen with no problems.
Since you have already named everything for this exercise, you should not have to
name any files as you exit.
Opening Access Database - again
If you decide to Exit Access 2007, and then return to continue the tutorial, refer to
the instructions at the beginning of this tutorial (Page 1) to open Access again.
A neat thing about Access 2007 is the
Open Recent Database area on the
right side of the screen. Once you
have created a database, you will
see your database in the Open portion of the area (see arrow and image to the right). You can simply
click-on the file, in this tutorial Person, and it will open.
When Access 2007 opens, you will see that the bottom portion of your screen is blue
and that the below message appears above the blue area. Access has long been
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 529
a source for worms and viruses when e-mailed to other people, so Access 2007
has this additional feature to protect you. Click the Options button to the right
of the Security Warning.
When you Click the Options button to the right of the Security Warning, the Microsoft Office Security Options menu screen will appear. Take a few minutes to
read this information. If you receive an Access database from someone who you
do not know, you can use the features in this screen to assist in protecting you.
Since you are opening your own database, click the small circle to the left of Enable this content (see arrow below). Then click the OK button.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 530
When you click the OK button you will see, on the left side of your screen, that your
Personnel:Table turns orange. This means that it is OK and that you now can
open it again to enter more data. You have two choices to open your Table.
1. You can move your cursor over the orange area and click the LEFT mouse button twice
quickly – and your Table will open in the Datasheet View.
2. You can move your cursor over the
orange area and click the RIGHT
mouse button. You will see a drop
down menu appear. You can click
on Open
You are now ready to continue entering the data in the Datasheet View.
Form View and Datasheet View
As indicated previously, you have a choice to enter your data. You can use the Datasheet View, like we have done so far, or you can use a Form. Both methods work
well.
Creating a Form in Access 2007 is really different than in previous versions of
Access. We’ll now use the new Tabs and Ribbons to Create a Form for our Personnel Table.
First, look
at the
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 531
top of your Access screen and click the Create Tab (we want to Create a Form).
Look in the Create Ribbon in the forms Group and you’ll see the Form button.
Click the Form button.
You’ll see your screen change significantly in many ways. The first thing you’ll notice is that Access 2007 – knowing you were entering data from the Personnel
Table – created a Form with all of the Fields in your Table! You’re all ready to
enter data in this form.
Your Personnel Form should look something like the image below.
Another new feature of Access
2007 is the Tab layout for what
you’re working with. Look just
above the Form and you will see two Tabs. Notice the small image on the left
of each Tab. The left Tab is your Personnel Datasheet and the right Tab is your
Personnel Form. You can click on whichever Tab you want to enter Data in your
Table.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 532
You may enter data in Form View the same as in
Datasheet View. To Save your new Form you
can click on the Small Save Diskette in the
Quick Access Toolbar. Since your form will be
a part of your Person Database, it will automatically save as the Tab Name.
Or, you can move your cursor over the Personnel Form Tab and click the RIGHT
mouse button. When the drop down
menu appears, click the Save selection.
The data entry form is now saved as Personnel, just like the Table. Notice, at the
bottom of the Form screen, that there is a status area (see below) that tells you
what record you are on. You can use the arrows to “move” from one record to
another, or select a new record in which to enter data. Click-on each of the arrows to see how they work. Some will take you forward or back to the next or
previous record, and some will take you to the beginning or end of your records.
The arrow with an asterisk will take you to a new blank record. Enter a few
records to see how the Form View works.
When you first “open” your Person
Database, you may choose your
favorite method to enter data: The
data Form or Datasheet. Look on
the left side of your screen and you
will see All Tables. Under All
Tables, you will see your Personnel Table with two selections below it: Personnel: Table and Personnel. Notice the image on the left of each selection (like at
the bottom of Page 23). You can switch back and forth from the Datasheet entry to the Form entry by clicking on your choice (as outlined on Page 22).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 533
At the lower left corner of the menu screen, you will see some text that indicates
that you are either using Form or Datasheet View to enter your data.
When you have opened your
Datasheet View and Form
View you can switch back
and forth by clicking on the Tabs.
The View buttons on the upper
left indicate what “view” you are
using: Design View, Form View,
or Datasheet View. You can
move back-and-forth between
views by clicking-on the down
triangle (see arrows and images)
and then choose the View you
desire.
Note: When you are finished entering data and preparing to exit Microsoft Access, or Close
the form, if you did not save before exiting, the program will ask if you want to Save the
Form. This is up to you. You may save it with your choice of names and it will then
show-up as a form when the Person Database Main Window appears. Or, you can indicate No, and re-create the form again with the Wizard.
Important
To record enough information so that you can see the power of Access database
does enter 24 or more records now. You may use either Form View or Datasheet View.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 534
Querying the Database
This is what a database is designed for: finding specific information
about some of the data in the table(s) very quickly. A query is a search for general or specific data in a field or fields in your database (e.g. the first and last
names and birth dates of all employees, just the Jones’s, the people from CA,
salaries > $10,000, etc.). In order to do this, we need to click on the fields we
want to query. So, let’s start by finding just Last Names in our table.
If you are not in the Database: PERSON screen which shows the Tables, Queries,
etc., go there by following the instructions on Pages 21-24 .
If you have the Personnel Datasheet or Personnel Form open (to add data), close them before you begin your queries. The Access program sometimes
becomes logically confused when you try to do queries when it “thinks” you also
want to add data. You may see “error” messages if you leave the Form or Datasheet open.
You can RIGHT click on the Datasheet and Form Tabs and then select Close – if you
have them open. Your Access screen should look similar to the image below.
Click the Create Tab at the top of the
Access screen (left arrow above).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 535
Then move your cursor over the Query Design Button in the Create Tab/Ribbon
(right arrow above).
When you move your cursor over Query Design in the Other Group you will see an
image similar to the one on the right.
Click the Query Design button.
Two new windows will appear: Query 1: Tab and Show Table. You will first have to
select the table(s) you desire to query. The Show Table screen should look like
the one below.
Click Add First
Then click Close
The Show Table window will disappear, and the Query 1: Query window, will appear.
Click-on the expansion square in the upper right
corner
to enlarge the Query 1: Select Query window.
Your screen should now look similar to the one below.
These areas
are magnified below
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 536
Notice, in the upper half of the window, a small box on the left indicates: Personnel. At the top is an asterisk ( * ) and below, in an elevator box, are the fields
from the Personnel Table (you can move up-and-down the list as you desire).
What we need to do next is place the Fields we want to query in the lower area of
the screen. Notice the lower area on the left border. The first row indicates
Field:, followed by Table, Sort:, Show:, Criteria:, and or:.
In the lower half of the screen click-in the first cell to the
right of Field:. We'll start with a query on Last Name, State,
Favorite Number and Salary. Now click-on the down arrow
and then click-on Last Name. Notice how Last Name now
(check) is seen in
appears to the right of Field: and a
the Show: cell (The
means that you will see Last Names
in your query.). Notice, also, to the right of Table:, that Personnel (the Table from which we queried) is showing.
Your query screen should
now look like the one on the
right.
Now move to the next Field cell on the right and, using the down arrow click-on
State. In the next two fields to the right, insert Favorite Number and Salary.
Your Query1: Select Query screen should look like this:
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 537
Now, look in the Button Bar at the top left of the
screen. In the middle of the bar you will see an
exclamation mark ( ! ) like the one on the
right. If you move the cursor over it, the help
text box will indicate "Run." Click-on the (
This click executes your query.
!
).
Your query screen should
look similar to the one on
the left.
Notice, the screen ONLY
shows the four fields that
you queried.
You
can add or remove fields, as you desire. To do this we need to
return to the Design View where we created this query. To
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 538
return to Design View click-on the small button in the upper left corner of the
screen that has the blue triangle, pencil, and ruler (like the one on the right).
Then, simply click-in the Field area and select a new field and it will replace the
old one. Or, click-on the field you want to remove and tap the Delete key.
Sometimes you may have a lot of fields and it will be too large for a single sheet
of paper.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 539
To see how your query will
look, if you print it, we’ll
show you how to open a
Print Preview
First, click the Microsoft Office Button on the upper
left of your Access
Screen. Then move your
cursor over the Print selection. A Preview and
print the view area will appear on the right. Move your cursor over Print Preview and click on this selection.
While you’re in the Print Preview you’ll see a little magnifying glass that you can
move over your query. If you click the left mouse button once the magnifying
glass will “zoom” in and enlarge the view. If you click the left mouse button
again it will zoom out.
To return to your query, click-on the Close Print
Preview button on the right side of the Print
Preview Tab/Ribbon. This will take you back
to the Normal View of your query.
Adding a Print Preview Button to the Quick Access Toolbar.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 540
It took a lot of “clicks” to get to Print Preview. So, let’s add the Print Preview button
to our Quick Access Toolbar at the top of the screen. Then all we’ll have to do is
click this button for a Print Preview!
Repeat the steps at the
top of this page to
“get to” the Print Preview selection. When
you “see” the Print
Preview selection – click the RIGHT mouse button. When the drop down menu
appears, click the Add to Quick Access Toolbar selection.
After you add the Print Preview button to your Quick Access Toolbar,
the toolbar will look like the image
on the right. Notice that Print
Preview may now be accessed by clicking this button.
You can use this “method” to add any
button you desire
to your Quick
Access Toolbar.
There is a small arrow on the right side of the Quick Access Toolbar (image on
right). If you move your cursor over the arrow, you will see that it indicates Customize Quick Access Toolbar. You can work with this as you desire.
You can customize the Quick Access Toolbar in each 2007 Office application as you
wish.
Sorting the Database
If you are not in the Query Design Screen, you’ll
need to be in that view. So, go to the Design
Screen (bottom Page 28). Notice that the third
row, in the lower half of the screen, indicates
Sort: (like the image at the right). Click-in the
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 541
Sort: area under Last Name. A down arrow box appears; click-on the down arrow. Let's sort the Last Names in Ascending order. Click-on Ascending. Notice
that Ascending now appears in the Sort: area. Click-on the ( ! ) to see the new
query. Notice that the names you entered are alphabetized. Click-on the Design View button (triangle-ruler-pencil). Now change the Ascending under Last
Name to (not sorted). On your own, try sorting some of the other fields. When
you are finished remember to set the fields to (not sorted) unless you do want
to sort on those fields.
You may also sort various fields in your database whenever you are in the Datasheet View, whether you are viewing the entire Table, or a Query from the Table. Notice that the Field Names are shown at the top of each column in gray
cells.
If you click-on
one of the
blue area
field names
(like State),
the entire
column
(Field) turns
“blue” (like
the image on the right). This indicates that you have “marked” the entire column (Field).
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 542
On the Home Tab/Ribbon, on the right side, in the
Sort & Filter Group, you will see two buttons
with “down” arrows (like the image on the
right). When you move the cursor over these
two buttons a text help box will indicate: Sort
Ascending or Sort Descending. If you click-on
one of the buttons, the Field which you selected
(highlighted) will be sorted in the order selected. Give this a try and see how it
works.
You can always click the Undo Arrow in your Quick Access
Toolbar if you desire to go back to the original order.
New to Access 2007 – A Filter/Sort Arrow for each Field!
In the image on the right we
clicked the small down arrow
to the right of State. A drop
down Filter/Sort menu appeared! This is new in Access
2007. You also use this menu
to enhance your sorts. Notice
that the A to Z and Z to A are
in this menu, as well as text
Filters. You can experiment
with these filters as you desire.
This is a neat new feature that
will assist you greatly in doing
your queries.
So, there are several “ways” you can sort your Tables and Queries.
Specific Queries
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 543
So far we have listed everything under each Field Name that we selected. However,
many times you will probably want to find something specific in your Table (database - e.g. people from a certain state or city, people whose favorite number
is 7 or salaries between $ 20,000 and $ 50,000). This is fairly common sense,
but it can get tricky.
To get an idea of various criteria (you might
want to use), click-on the Help Question
Mark in the upper right corner of the
Access Screen.
The Access Help Task Pane
will appear on the right
side of your screen.
Notice that there are
already a number of
Help topics already included in this Task
Pane.
When your screen appears,
click-in the Search area
in the Task Pane. Typein “query criteria” and
then tap the Enter key.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 544
A Search for: Task Pane will
now appear (like the
one on the right).
Click-on the Examples of
query criteria selection.
Another Access Help
Screen will appear
similar to the one
on the right. Click
the Maximize
square in the upper
right corner of this
screen so that you can see all of the criteria examples more easily.
Use the Elevator Bar on the right side of this Help screen to view all of the various
criteria for queries. This is a wonderfully updated feature in Access 2007 that
really gives you an Access Manual for criteria.
When you are finished, click-on the “X” in the upper right
corner of the Microsoft Access Help Topics menu screen
to close the screen.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 545
You may return and explore additional help screens as you become more accomplished with Access 2007 database. These help screens are like having a
plete Access 2007 manual on your computer.
Now we'll try a few specific queries. First let's find a specific
state.
You should be back in the Query1: Select Query menu Design
window. It should look like the image below. If you’re not
then click the Design button in the upper left corner of the
screen (like the one on the right).
Click-in the cell to the right of Criteria: in the State column. You will see a flashing
cursor (Make sure you are in the State column.). Type-in the abbreviation for
one of the states you entered in your Personnel Table. Your Query should look
like the image below.
Now click-on ( ! ). A new Query1 window will appear. Only persons
from the state you selected should show.
This is a
SPECIFIC
query
for that
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 546
state.
Click-on Design View Button (triangle-ruler-pencil) to return to
Design View.
Delete the state you entered.
Now we'll look for Favorite Numbers larger than 600. Type-in >600 in the Criteria
cell under the Favorite Number Column.
Click-on ( ! ). Everyone
with a favorite number larger than 600
should show. If no
one is indicated you
don't have a person
with a number larger than 600, or you might have typed the >600 incorrectly.
Return to the Design View. Delete the >600 and run the query with no criteria.
You should “see” all the fields again. Return to the Design View again.
Make sure all the Criteria: cells are empty.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 547
Next we'll look for persons with salaries equal to or larger than $ 20,000 and equal
to or less than $ 50,000. In the Salary field column, in the Criteria: cell type-in:
>= 30000 and <= 40000
Click-on the ( ! ).
You should now see a specific query that indicates those persons in the range you
chose.
Go back to Design View. Delete the criteria you entered under Salary.
Now, on your own, if you desire, add or delete some fields to your query and experiment with some combinations.
Don't get frustrated if no specific items appear. Frequently you might query for
something that can't exist (e.g. states of VA and CA – a person can't be from
both states at the same time) or there just isn't anything that matches. For fun,
notice the or: just below Criteria to the left of the Design View. Try one state in
the Criteria: cell under State and another in the or: cell.
Go back to your Query Help (Page 32) and try some of the criteria you see.
When you have a good feel for queries you’re ready to end your query session.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 548
Make sure that your query is completely clear of criteria – we’ll use this query later
for a report!
RIGHT click on the Query1 Tab. A
Drop down menu will appear.
Move your cursor over Save
and click on Save.
A Save As window will appear.
Name the Query anything you
like, we’re going to name our
query “Test Query 2007.” Clickon OK.
When you click the OK button you will notice several things - the Query1
Tab changes to the
name you chose, and on
the left side of your
screen you now see you
new query is available to use again, as you desire. You can activate this query
and change things just like you did above.
You can close your Query by RIGHT
clicking on the Tab and then clicking
Close.
Any time you desire to open this query again, you simply click twice quickly on the
query selection on the left side of your Access screen. Or, you can RIGHT click
the query and choose Open.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 549
Reports
Reports can be very complex.
In this tutorial we'll cover the very basic
steps of creating Reports. A good manual or some knowledgeable assistance
will be essential to mastering reports.
There are several types of reports. We'll use Access Wizards and Tabs/Ribbons to
design several simple reports.
For those who are accomplished with Access reports – from earlier versions of
Access – this will be a whole new adventure with the Tab/Ribbons of 2007 Office.
First, make sure that you have closed any Tables, Forms, or Queries on which you
are open.
Your Access screen should look similar to the image below.
Click the Create Tab and the Create Ribbon will appear. Look at the Ribbon on the
right side. You will see the Create Reports Group
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 550
The Create Reports Group is enlarged on the right. We’ll begin
our Report lesson using the Report Wizard. Once you’ve
created a Report with the Wizard, you’ll be somewhat familiar
with Reports. We’ll then use
some of the other selections in
this Group to create Reports.
Click the Report Wizard selection in the Reports Group.
The Report Wizard
Menu screen will
appear:
Read all the information in the Report Wizard menu screen. Only the fields you select from your table will show-in the report. To bring fields into the report individually you click-on the name of the field (in the list of fields in the area under
Available Fields:) and then click-on the >. The order which you click-on the
fields will be their order in the report. The >> brings over all of the fields. The <
brings back one of the fields which you have selected and << brings back all of
the fields. If you make a mistake, or want to start over, click the << selection to
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 551
bring back all of the fields and try again.
Look at the image above. Notice the
arrow pointing to the down arrow on the right side of the
Tables/Queries area. Click this
arrow and select your Table:Personnel.
Your Report Wizard menu screen should look like the large image in the middle of
this page.
Let's begin. Click-on First Name, then click-on > (notice how the First Name field
went from the Available Fields: to Selected Fields:). Now do the same with the
Last Name, State, Gender and Salary fields. These are the fields that will appear
in our first report.
Your Report Wizard menu screen should look like the one below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 552
If it does, click-on the Next> Button. If not, use the << to bring all the fields back
and try again.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 553
Grouping in Reports
This Report Wizard menu screen asks if you want to add Grouping. Grouping simply
“groups” records by an item in the report you are designing. We’ll group by
state. This means that “records” from a state will be in a “group” (e.g. people
from Virginia will be in one group, the folks from Washington in another, and so
on). This will be easy to see when we look at the report. So, click-on State,
then click-on >. If you make a mistake, no problem, just use the <.
Your screen should now look like the one below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 554
Click-on Next> again. Another Report Wizard menu screen will follow.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 555
First, the above screen requests that you indicate a Sort Order. This simply means
that within each “group, the alphabetic order in which you want the fields
sorted. We’ll sort by Last Name and then First Name. This way you’ll have the
names, grouped by state, in Last Name order and, where you have several
people with the same Last Name, they’ll be sub-sorted in First Name order. Notice the Ascending button to the right of the Sort boxes. This indicates that the
Field that you select is in A to Z or ascending order. If you click-on this button, it
will reverse the order from Z to A, or descending order. Click-on the small down
arrow to the right of the first box and select Last Name. Leave the order as Ascending. Now, select First Name in the second box. When you are finished, your
Report Wizard menu screen should look like the one above.
Notice a Summary Options button below the sort fields you have selected. Access
2007 is “really smart.” Whenever you see the Summary Options box it is because Access 2007 knows that you selected a number field for your report. The
Summary Options box ONLY appears when a number field is selected! Click-on
the Summary Options… button.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 556
The Summary Options menu box allows you to enter calculations for numerical and
currency fields if you have selected any. It will summarize these calculations by
each group, and in total. So, since Salary is a currency field, we can obtain calculations. Click-in the boxes under Sum and Avg; this will furnish these calculations (as you will see in the report). If you want percentages as well, click-in the
box next to Calculate percent of total for sums.
Click-on OK. This will return you to the previous Wizard screen. Click-on Next>
again.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 557
This Report Wizard screen allows you to select a layout for your report. Click-in the
small circles to the left of each choice in the Layout area and observe the results. For the moment, we’ll stay with the default: Stepped. So click-again it
that circle. Leave the report in Portrait Orientation.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 558
Note:
At the bottom of the last Report Wizard menu screen (on the last page) there is a
check in the small box to the left of Adjust the field width so all fields fit on a page.
This is a very important check. This means that no matter how many fields you place in
your report, they will all fit on one page. With a few fields in the report, this is no big deal.
However, if you have a lot of fields, they will be all “scrunched” up and you’ll notice that sometimes the Field Names and data for these fields are “cut-off” a bit. As mentioned at the beginning of the Reports section of the tutorial, this is where an advanced course or manual are
almost essential.
Click-on Next> again.
The next Report Wizard will appear.
This menu screen allows you to select the Style that you would like for your report.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 559
Click-on the choices (Apex, Aspect, etc.) and see what each “looks like”. Choose
whichever style you desire and click-on Next> again.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA, MCTS,MCSE -2010 Certified (IT Professional)
Microsofr Certified Technology Specialist
http://www.mrr.com.np
MRR 560
The next Report Wizard screen is the last screen in the sequence. It allows you
to select a title different from the name of your database - if you so choose.
Note that the small circle in front of Preview the Report is “dotted”. When
we click the Finish button Access 2007 will go to a preview copy of your report. We’ll title this report State Report. Use this name, or any name you desire, and click-on Finish.
This is a report in Tabular (Columnar) format. Your screen should look something like the one below.
Notice the #### symbols under Salary and on the right of Sum and Avg. The
fields are not wide enough to display these numbers. We’ll show you how
to adjust column widths in a moment.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 561
Notice in the upper left Corner of the Access screen
that you are currently in Layout View. If you click
the small down arrow under View, the drop down
menu on the right will appear.
To “really see” what the State Report will look like,
you’ll need to go to a Print Preview. You can either click on the Print Preview selection in the
menu on the right, or click the Print Preview button you placed in the Quick Access Toolbar at the
top left of your screen.
In the Print Preview image below you can see that the Salary, Sum and Average
amounts are “cut off.” We’ll need to go to the Design View to enlarge these
“boxes” so that we can see all the numbers.
Notice in the lower left corner of the State Report screen that you are on Page 1
of the report.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 562
Notice the “triangle arrow” buttons to the left and right of Page 1. These take
you to the first page of the report, the previous page, the next page, and the
last page. Try clicking-on them.
Notice that your cursor – in this Preview Report screen is a magnifying glass.
This shows you how a page of your report will appear when you print it. Each
time you click the magnifying glass you will “zoom in” or “zoom out” making
your report appear larger or smaller. You will zoom to the “place” where you
place your magnifying glass – just like if you were using a real magnifying
glass and a real piece of paper. You’ll magnify the place where you are “holding” the magnifying glass. So, give this a try.
To return to your State Report,
click-on the Close Print Preview
button on the right side of the
Print Preview Tab/Ribbon. This
will take you back to the Layout
View of your Report.
You will see your State Report with all of the #### symbols.
Click the down arrow below the View button in the upper
left corner of your Access screen and then click the Design
View selection.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 563
We’ll explain about what you see in the image above on the next page.
New Report Design Tools Tab/Ribbon in Access 2007
In addition to the change to the Design View, you will see that the Home
Tab/Ribbon is replaced by a Report Design View Tab/Ribbon. In previous versions of Access, small menu windows would open for Design View. These
have now been placed in the Tab/Ribbon you see below.
We enlarged a part of this Tab/Ribbon so you can see that the Tab/Ribbon
Groups – Grouping & Totals, Gridlines and Controls have replaced the “old”
menu boxes.
When you become more comfortable with Access Reports, you’ll find that these
tools come in quite handy.
Now, about the areas you saw in the Design View on the last page……
First: Notice, to the left, in the light blue part of the screen, it indicates: Report Header,
Page Header, State Header, Detail, State Footer, Page Footer and Report
Footer (see arrows on the last page).
Report Header:
If something shows here, it will only be shown on the first page of the
report.
Page Header:
If something shows here, it will show on each page of the report at
the top of each column.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 564
State Header
This “sets-off” the State Grouping.
State Footer
This “ends” the State Grouping.
Detail:
These are the field names from our database. Access will “pull” the
data for the individual fields from our database records.
These are the database fields themselves. The fields print each time there is a
person in the database. This field information is drawn from the database.
As you enter more people in the database and run the report again, more
people will be shown. The "size" of the box you see on the screen was
created when we created the field sizes.
Page Footer:
This is what shows at the bottom of each page.
Report Footer:
This is what shows only on the last page of the report.
Also note, the lower right corners of the State
and Report Footer area boxes indicate:
= SUM([Salary]). This is a calculation box the Wizard
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 565
created. This is what gave you the calculations for your average and the sum
of the salaries in the State area and the grand total of all salaries in the Footer area.
Enlarging the Salary, Sum and Average “boxes”
On Pages 43 and 44 we saw that the Salary, Sum and Average numbers were
“cut off.” We’ll now show you how to widen the boxes so you can see “all
the numbers.”
In Design View, click on the Salary box in the Detail area. The border around
the box will turn orange. Carefully move your cursor over the right side of
the box – you will see a two-headed arrow – your Detail area should now
look like the image below.
When you see the two-headed arrow, click and HOLD
DOWN the LEFT mouse button and move your cursor
slowly to the right. You will see the Salary box get
larger – as well as the Salary area in the Report Header. Take your finger off the left mouse button. Your
Salary box and Salary Header should now look similar
to the image on the right. If you have not made the
area large enough, or too large, you can return to the
Design View and adjust as need be.
Now move to the State Footer area and
do the same for the Sum box.
And, then the Average box.
Clic
k
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 566
a Print Preview button (like you did at the top of Page 44). You should now
see “all” of your numbers.
Saving Reports
Since you have already “named”
your Report (State Report),
move your cursor over the
State Report Tab and click
the RIGHT mouse button.
When the drop down menu appears, click Save. You will see your State Report in the area on the left of your screens with you Table, Form and Query.
Close this report again as you did previously (by RIGHT clicking on the State Report Tab and selecting Close).
Quick Reports
On Pages 36 and 37 we showed you how to create a report using a Report Wizard – to give you a “feel” for how Reports are produced. A really neat new
feature of Access 2007 is what we’ll call “Quick Reports.” Now that you know
how to use the Wizard and understand basic reports, you can create similar –
simple reports – with a couple of “clicks.”
Click the Create Tab. Then, click your Personnel selection under All Tables. Move
your cursor over the Report selection in the Reports group. Read the pop-up
Help box and then click Report.
You will see several things occur at the same time. On the lower right side of
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 567
your Access screen you will see the Quick Report (image at the top of the
next page).
Notice that Access has chosen a name for the Report based on the name of your
Table.
Also notice that a new Report Layout Tools Tab – with a Formatting Tab/Ribbon –
appears to assist you.
You can experiment with this Report and the Formatting Tab/Ribbon as you desire. Don’t worry if you really create a Report that you don’t want. You can
use the Undo Arrow to go back a step or two or you can RIGHT click on the
new Report Tab and select Delete.
As you create reports you may save or not save, as you desire.
Reports can become very complex, very quickly. This is only an introductory tutorial, which furnishes a simple guide to report design. You might want to
purchase a book on Access or try a separate tutorial on reports. Our favorite
book is Microsoft Press Access 2007 – Inside Out from Microsoft Press
When you are finished simply exit Access as you did on Page 19.
Now that you have the basics, you might want to try some things on your own.
Try using the Wizards in Table, Query and Reports.
We'll, that about does it for now. If you have comments on this tutorial, simply
send e-mail to the Internet address below.
Prepared By: Moti Raj Rai
e-mail: [email protected],[email protected]
MCID No. 7695310 Since 07-2010
MCP,MCSA,MCTS,MCSE -2010 Certified (IT Professional)
Microsoft Certified Technology Specialist
http://www.mrr.com.np
Page 568