Centering Pub 2003 and 2007 pages. PING dtsclothing, Spike, Jo, brelade, Mike, Rob and...

D

DavidF

Don has been providing good instructions for centering Pub 2000 and 2002
files for some time, but we have been fumbling around trying to center Pub
2003 and 2007 pages. Jo and Spike provided some code and methods, but they
didn't seem to work in all cases, or be very easy. I think I have found two
methods of centering your webpages that appears to work for Publisher 2003
and 2007. Would any and all of you test these methods and see if they work
for you? Also if any part of directions are unclear or come up short, please
note that too. Thanks.

-------------

Directions for centering web pages in Publisher 2003 and 2007:

When you "Publish to the Web" direct the output (the index.htm file and the
index_files folder if you are using the subfolder option) to a folder on
your computer where you can find it. Each of your *.htm files requires
adding a centering code after the existing </head> code.

Method 1: Manual method.

Go to the folder on your computer where you directed your web files.

Open each *.htm file in NotePad by right clicking the file > open with >
NotePad. If you are using the subfolder option in Pub 2003 or 2007, your
index.htm file is your home page, and your other *.htm files for your other
pages are usually contained in a subfolder called "index_files".

Find the </head> code, and replace with:

</head><table border="0" cellpadding="0" cellspacing="2"
width="760"align="center"><tr><td>

If you are using a page width that is different than 760 pixels, change the
width in the code string with the width of your web pages. Close NotePad and
save the changes.

After editing the code on each *.htm file and opening the edited .htm files
in IE to test the change, you can upload your files to your host.

Method 2: Semi-automatic method.

With this method you can find the </head> code, and replace it with the
revised code string in each *.htm file semi-automatically.

Download and install the free "Replace In Files" program:
http://www.emurasoft.com/index.htm

Open "Replace in Files". The four boxes in the "Replace in Files" program
require the following information:

Find: </head>

Replace with: </head><table border="0" cellpadding="0" cellspacing="2"
width="760"align="center"><tr><td>
(Note: the code string may wrap in this message, but it is one line. Also
change the width to the pixel width of your web pages.)

File Types: *.htm

In Folder: Use the ... button to browse to the folder where you directed
your web files on your computer when you Publish to Web.

Assuming that you are using a subfolder, check the box at the bottom
"Replace in Subfolders".

Click "Replace All", and you should get a "Finished" dialog that will
confirm the replaced strings of code for each *.htm file/page in your web
files.

After opening the edited .htm files in IE to test the change, you can upload
your index.htm file and your index_files folder to your host.

You will have to run Replace in Files each time you modify your Pub file and
produce new web files.
However, once the options in Replace in Files are filled out and the
"Replace all" is selected, the entries are retained for the next time you
use the program.

-----------

Thanks for testing these instructions and offering any feedback about how
they could be written so they are more clear. Let me know...thanks.

DavidF
 
R

Rob Giordano \(Crash\)

Seems to work.
Try this;
</head>
<!--webbot bot="HTMLMarkup" startspan --><table border="0" cellpadding="0"
cellspacing="2"
width="760"align="center"><tr><td>
<!--webbot bot="HTMLMarkup" endspan --></div>

The webbot comments would normally keep fp from disturbing the html within,
it would be interesting to see what effect it would have on Publisher - if
it did then you'd not have to keep editing the pages everytime you publish.

--
~~~~~~~~~~~~~~~~~~
Rob Giordano
Microsoft MVP Expression
 
D

Dan

I am trying to design my first website and I had the same problem with
centering my page. This is how I solved my problem. I went to
FSile/Pageetup. Under layout I selected custom and edited the Width untill
the page was centered. This seems to have worked. Please tell me if there
is a reason I shouldn't be using this method to center my page.
 
D

DavidF

I don't quite understand. Are you saying to insert this code snippet into a
Publisher web publication using the insert html code fragment? That would be
the only way the edit would stick when you changed the page and produced new
web files in the future. If you are suggesting substituting your code string
for the one I used in the directions, then you would still need to edit the
code each time you publish new .htm files??

DavidF
 
D

DavidF

The concept is ok, but just because it is centered in your browser window
doesn't mean it will be centered in mine. What if my browser window is only
800 pixels wide? I would guess that you made your page so wide that if I
viewed it in my browser window, I would have to scroll horizontally to read
it. That could be a bad plan...it will drive away viewers.

Publisher produces fixed width pages, that are left justified by design.
There are many great looking left justified websites, and you can simulate a
centered page...just be careful about how wide you make it. MSFT added a
wider default width of 984 pixels for a page to Pub 2007, when before the
options were 760 and 600 pixel widths. I think it is probably wise to make
your page no wider that 984 pixels. It would be worth your time to read:
Understanding background padding in a Publisher web (aka white space):
http://msmvps.com/blogs/dbartosik/archive/2006/01/07/80563.aspx

Centering a page by editing the code has the advantage of dynamically
centering your page to whatever size browser window the viewer is using.
There are arguments for keeping your page at 760 pixels wide and using a
background color or texture to fill the padding. Some feel a dynamically
centering page looks and works better than using extra wide pages...thus the
effort to work out the code and the workaround. How to center a page is one
of the most frequently asked questions in this group, and we have been
struggling with trying to find a workaround that is practical. Hand editing
every page each time was not a practical solution, especially for larger
sites. What is new about these instructions is that you can now use Replace
in Files to semi-automate the process in Pub 2003 and 2007 much as Don's
method for 2000 and 2002.....I hope ;-)

But...it is an extra step or two, and only you can decide if it is useful to
you.

Hope that answers your question.

DavidF
 
D

Dan

Thank you for your response. I will think twice before publishing in this
format, but this has brought up a new question. I am using Publisher 2003.
I changed the page setup to default standard 800 x 600. Now I have blue
edges around the page on publisher. When I upload the site anything in the
blue area does not publish. Do I need to make all the text and pictures
smaller now?
 
R

Rob Giordano \(Crash\)

Yes, I mean try my snippet in code fragment insert then make a change
somewhere else and re-publish...see if it stays or gets fried....curious.

--
~~~~~~~~~~~~~~~~~~
Rob Giordano
Microsoft MVP Expression
 
D

DavidF

Experiment done...with 2003 & 2007...you can't insert a code fragment with
</head>. Publisher actually warns you when you try, which is consistent with
what I have understood about not being able to insert anything into the head
section. When I insert the rest of the snippet into the body via a code
fragment, it does not center the page...darn.

When I edit the .htm file and add the code after </head> and before the
<body>, in the same place as the code snippet I used, it works...the page is
centered in a browser window. This also implies that I could use it with
Replace in Files.

The question then is what advantage would there be to use this string of
code instead of the one I am already using?

I really wish it had worked when inserted via a code fragment...that is
still the second most ideal solution for centering Publisher web pages, with
the first being MSFT simply adding the page centering option...but I am not
holding my breath on that one.

DavidF
 
D

DavidF

Don't limit the page length to 600. Leave it at the default length.
Publisher 2003 will truncate the page after the last design element on the
page when you Publish to the Web, which allows you to have custom length
pages.

If you resized the page from a width wider than 800 pixels then Publisher
will not automatically adjust your layout...you will have to do that
manually. It sounds like you have elements in the scratch area. Be sure to
run the Design Checker under tools.

DavidF
 
R

Rob Giordano \(Crash\)

It's the same code as you had provided except wrapped in a FrontPage webbot
comment. In FrontPage this comment would keep fp from messing with the code
within the comment. I wanted to see if the same would happen in Publisher,
and since I didn't have time to do the entire experiment...create a Pub
web...blah blah blah...I passed this along to you to try.



--
~~~~~~~~~~~~~~~~~~
Rob Giordano
Microsoft MVP Expression
 
D

DavidF

All righty then ;-).

I don't really expect you to test these things out, but certainly appreciate
the suggestions, comments and input you do make. You bring a perspective and
a level of expertise beyond mine. I understand Publisher webs pretty well,
but I am just a hack when it comes to actually coding...simply trial and
terror without knowing the why for something works or doesn't. So thanks
again for your efforts.

DavidF
 
R

Rob Giordano \(Crash\)

"We're all Bozo's on this bus"
:)





--
~~~~~~~~~~~~~~~~~~
Rob Giordano
Microsoft MVP Expression
 
M

MAURH

DavidF, I have been testing out your instructions for centring the pages in
2003 and after a few false starts….my fault not yours….I have now got my
pages centred, using ‘Replace in Files’. For the benefit of others like me
who do not really understand much about coding and don’t really need to know
why or even how it works, I thought maybe I would share my experience of
finally getting it done.

I followed your instructions, but just to reiterate:



Download the free ‘Replace in Files’ from http://www.emurasoft.com/index.htm
as you suggested.



Save any changes you make to your website doc., and ‘Publish to the Web’.
In the ‘Save as’ box which appears, make sure that you have the name of the
folder in which you have saved your index_files and index.htm. In my case
they are on my desktop in a folder marked ‘Website HTM’. The ‘file name’ at
the bottom of this box should read index.htm…..click on save.



At this point I close this folder and open my ‘Website HTM’. I reduce the
size of this window to about half it’s size. I then open ‘Replace in Files’
and place it next to this window. I found this useful as I now have both
working windows in front of me.



Now enter the information in each box in ’Replace in Files’ as per DavidF’s
instructions, i.e.



Find: </head>



Replace with: </head><table border="0" cellpadding="0" cellspacing="2"
width="760"align="center"><tr><td>



This bit was one of my stumbling blocks. I found I could not copy and paste
this line of code from DavidF's instructions into this box in one line, it
only pasted the first part of the line, so the code didn’t work. So I copied
it into Notepad, changed it into one line and then did copy and paste from
there….that worked.



File types: *.htm



In Folder: Click on the small box next to the blue chevron … to browse to
your folder i.e. my ‘Website HTM’, click ok and the name of this folder
should appear in this box.



The other boxes in this window also proved a challenge as some are
ticked/checked by default, but after trial and error, I discovered only one
of them to be necessary. So these boxes are as follows:



Match case: leave empty



Save backups: leave empty



Replace only Words: leave empty



Replace Subfolders: Tick/Check



Now click on ‘Replace All’ and a box will appear showing how many strings of
code etc., there are, i.e. number of pages in your website, click ok.



Close ‘Replace in Files’ programme and upload your web pages as usual. Check
your site on the web and “voila” your site is centred! And by the way, I
also noticed that all my links that open in new windows, are also
centred….good call.

When you next need to republish, open ‘Replace in Files’ and you will find
your settings have been saved. Just click on ‘Replace Subfolders’ and
‘Replace All’ once again….and you are good to go.



Whilst I know that you will have to do this every time you publish, it is
only a couple of extra clicks and takes no time at all. A small price to pay
if you really want your site centred.



Once again DavidF you have given us the method to solve yet another problem
with Publisher…thank you!…what a shame Microsoft can’t do the same, but that’s
a subject for another day!



I hope some people will find the results of my experience helpful, it’s
really not that hard. Good luck!



MAURH http://www.devonviewcaravans.co.uk/
 
M

MAURH

Sorry folks, for some reason or other this message posted with large gaps
between the paragraphs. I didn't type it like that in my original message,
so the gremlins have got in! If there's anyone who finds it difficult to
follow the instructions, let me know and I'll re-post.

MAURH
 
D

DavidF

Thanks Maurh. With your help and others, maybe we will eventually get these
directions simplified and clear.

DavidF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top