Convert HTML tags to Style

Hello,

I have a Pages document with simple HTML in it:

italic
bold
Click here


and I need to convert it to styled text, i.e. italic, bold, Click here. Is this possible in Pages? Any advice would be greatly appreciated!

Thanks in advance,

topher

15" Mac Book Pro, Mac OS X (10.5.1), iPhone 4gb

Posted on Jun 23, 2009 1:46 PM

Reply
7 replies

Jun 23, 2009 2:07 PM in response to topher

topher,

Are you saying you want to style just the words *+"Click here"+* to italic bold? Or the entire sample of HTML that you have shown?

To create a style in Pages you simply make the text appear the way you want it and:

+Menu > View > Show Styles Drawer (cmd shift T) > Right Mouse Click on the downward pointing arrow of the Paragraph/Character/List Styles > Create New Paragraph/Character/List Styles from Selection… > Give it a name+

Then you can apply that style by selecting type and clicking on the style name in the Styles Drawer.

If you are seeking to use the HTML fomatting and convert that, you may be better off viewing the formatted HTML in a browser and copying and pasting that into Pages. It will retain the text formatting, however converting that into styled text will either be a manual task or one for an AppleScript.

Pages can search and replace styled text but it searches on its own Named styles.

Peter

Jun 23, 2009 3:27 PM in response to PeterBreis0807

This is what I've done.

We are in the process of redesigning our website and the web firm wants a copy of all our text content on our site. With so many events entered into the database I figured rather than copy and pasting into a document from the actual webpages I would export the data as a .cvs file from the MySQL database. Once I did this I opened it and converted it to a Numbers file. In Pages I did a Mail Merge to construct the document.

The problem with this is that when we entered content into the database it applies basic HTML formating to display italics, bold, etc. I need a way to convert this code into those actual styles in the Pages document so the code disappears.

Hope this is helpful and I hope there is a solution.

Topher

Jun 23, 2009 3:40 PM in response to topher

Why use Pages?

Almost any other Text/Word Processor or Browser would do a better job of this.

e.g. Assemble it in TextEdit and export as HTML or simply open the assembled HTML text in a web browser where it would have the appropriate formatting and then copy and paste it as I suggested.

If you must use Pages you will need to create and run an AppleScript to do the formatting for you.

Peter

Jun 24, 2009 1:38 AM in response to topher

--

-- [SCRIPT html2Pages]
(*
Save the script as an Application or an Application Bundle.
Application Bundle if you want to use it on a MacIntel.
Store it on the Desktop.
Drag and drop the icon of a html document on the script icon.
You may also double click the script's icon.
The script will open it in Safari then copy paste into a Pages WP document.
Yvan KOENIG (Vallauris, FRANCE)
24 juin 2009
*)
property permitted : {"public.html"}
--=====
on run (*
lignes exécutées si on double clique sur l'icône du script application
• lines executed if one double click the application script's icon *)

tell application "System Events"
if my parleAnglais() then
set myPrompt to "Choose a Html document"
else
set myPrompt to "Choisir un document Html"
end if -- parleAnglais

set allowed to my permitted
my commun(choose file with prompt myPrompt of type allowed without invisibles) (* un alias *)
end tell
end run
--=====
on open (sel) (*
sel contient une liste d'alias des élémentsqu'on a déposés sur l'icône du script (la sélection)
• sel contains a list of aliases of the items dropped on the script's icon (the selection) *)

my commun(item 1 of sel) (* an alias *)
end open
--=====
on commun(theFile)

my activateGUIscripting()

tell application "Safari" to open theFile

my shortcut("Safari", "ac", "c")

set myNewDoc to my makeAnIworkDoc("Pages")
my shortcut("Pages", "v", "c")
end commun
--=====
on makeAnIworkDoc(theApp)
local t, n
if theApp is "Pages" then
set t to ((path to applications folder as text) & "iWork '09:Pages.app:Contents:Resources:Templates:Blank.template:") as alias
else if theApp is "Numbers" then
set t to ((path to applications folder as text) & "iWork '09:Numbers.app:Contents:Resources:Templates:Blank.nmbtemplate:") as alias
else
if my parleAnglais(theApp) then
error "The application “" & a & "“ is not accepted !"
else
error "l’application « " & a & " » n’est pas gérée !"
end if
end if

tell application theApp
set n to count of documents
open t
repeat
if (count of documents) > n then
exit repeat
else
delay 0.1
end if
end repeat
set n to name of document 1
end tell -- theApp
return n
end makeAnIworkDoc
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
on activateGUIscripting()
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
end tell
end activateGUIscripting
--=====
(*
==== Uses GUIscripting ====
*)
on shortcut(a, t, d)
local k
tell application a to activate
tell application "System Events" to tell application process a
repeat with k in t
if d = "c" then
keystroke (k as text) using {command down}
else if d contains "c" then
if d contains "s" then
if d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
else
keystroke (k as text) using {command down, shift down}
end if
else if d contains "k" then
keystroke (k as text) using {command down, control down}
end if
end if
end repeat
end tell
end shortcut
--=====
--[SCRIPT]


Yvan KOENIG (from FRANCE mercredi 24 juin 2009 10:37:51)

Jun 25, 2009 1:37 PM in response to topher

hi i am looking for a mac software program that works like ms. frontpage i need to create ebay auctions but the text program requires you to create this html thing to make you description look bigger better but in frontpage you could do anything copy any text add any image just the way you want and then in the lower end of the screen you have 3 options tabs regular text tab,html texttab,preview texttab so if you click on any of these tabs it will do what it states i need some program to do this for me i want to copy any image/text add it to my screen and then just at a push of a button it would convert it to html code ready for ebay auction description insertion

Jun 25, 2009 1:38 PM in response to PeterBreis0807

hi i am looking for a mac software program that works like ms. frontpage i need to create ebay auctions but the text program requires you to create this html thing to make you description look bigger better but in frontpage you could do anything copy any text add any image just the way you want and then in the lower end of the screen you have 3 options tabs regular text tab,html texttab,preview texttab so if you click on any of these tabs it will do what it states i need some program to do this for me i want to copy any image/text add it to my screen and then just at a push of a button it would convert it to html code ready for ebay auction description insertion

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Convert HTML tags to Style

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.